Adventure Game Studio

AGS Development => Editor Development => Topic started by: eri0o on Tue 18/01/2022 09:26:44

Title: [SOLVED] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: eri0o on Tue 18/01/2022 09:26:44
🚨!!Just to test log, backup things, if you are playing with this!!🚨

⚠�>Download: AGS-3.6.0.35-Beta15_DebugLog.zip (https://github.com/ericoporto/ags/releases/download/v.3.6.0.20.afix/AGS-3.6.0.35-Beta15_DebugLog.zip)<⚠�

So, we currently have logging in the engine, and it's very nice, it has all sorts of options. You can use [tt]System.Log[/tt] (https://adventuregamestudio.github.io/ags-manual/System.html#systemlog) function for it. But currently you have to either use AGS through command line or configure it to log to a file.

See log levels at the end of page here: https://adventuregamestudio.github.io/ags-manual/StandardEnums.html#loglevel

Well, I want to add a panel so when you run it through the Editor debugger you can pick up your log messages right there. You may have to enable it, in the above build, by clicking on Help-> Show Debug Log

(https://user-images.githubusercontent.com/2244442/184573788-dc1755ed-263d-401a-a730-1826dd3d4dac.png)

Anyway, would this be useful to others? Is there anything in particular you want to use in such feature?
Title: Re: [FEATURE TEST] Log in the Editor
Post by: Pogwizd on Tue 18/01/2022 10:45:26
I think this is a great idea. This would make my life way easier, because every single time I want to check how (or if) a variable changes I need to create a gui, add a label and then update it's text all the time. Provided it's a string, if it's float or int I have to parse it and so on and so on. So yeah, having a simple console logging function would be great.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: eri0o on Tue 18/01/2022 11:44:59
Play testing this feature it really shines if you have a second monitor, otherwise you need to play the game windowed - it's fine in single monitor if your game is not HD and your monitor is reasonably big though.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: arj0n on Tue 18/01/2022 11:59:12
Quote from: Pogwizd on Tue 18/01/2022 10:45:26
I think this is a great idea.
+1
Title: Re: [FEATURE TEST] Log in the Editor
Post by: Crimson Wizard on Tue 18/01/2022 13:22:31
By the way, this is somewhat related, but theoretically one could write a stand-alone application that either reads the engine log on the fly, from the file or stdout; or connects to the engine using same "Debugger" interface as editor uses, and then displays all messages in a window. This way one would be able to see game's log even without the editor.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: FanOfHumor on Wed 19/01/2022 14:55:53
Could you also include a list off to the side having all the objects and characters and their coordinates beside them as a window.The log shows where the characters go to but not where they are.
I cant remember all the times when I wished I knew where the character was exactly at a certain moment.
I know this Is a bit extra to ask.Especially since there might not be any room to place a window.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: Crimson Wizard on Wed 19/01/2022 15:06:05
Quote from: Pajama Sam on Wed 19/01/2022 14:55:53
Could you also include a list off to the side having all the objects and characters and their coordinates

It's going to be a whole separate feature:
1) gather all this information inside the engine and pass it to the debugger (editor);
2) parse in the editor, and arrange as the list or table;
3) display this list somewhere.

I think it's doable though. The question is mostly which data to pass and how to organize visually in a nice way.
This has to allow for expansion, because as soon as it shows coordinates people will ask for other things too.


Otoh, if it's only about knowing where the character walked from when it starts walking, this may be just added to the existing log message.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: FanOfHumor on Wed 19/01/2022 15:23:49
What I imagine it would look like:
The information from the current room editor would be moved to a scrollable window.The objects and characters names would be placed somewhere in the list like what the room editor has.all unused characters and objects would have their default names and have no coordinates.The used objects and characters would have  changing coordinate numbers beside them.I dont know if Im explaning what I imagine it would look like correctly or not.But of course as you said having this would mean more things people would want from it.
how would you add the characters constant position to the log wouldnt it have to be still or it would fill up the log.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: Crimson Wizard on Wed 19/01/2022 15:28:52
Quote from: Pajama Sam on Wed 19/01/2022 15:23:49
how would you add the characters constant position to the log wouldnt it have to be still or it would fill up the log.

I meant, if you only need this information when character begins to move, then this information may be added to the log message that tells about character starting to walk. It will not be displayed every game frame. This is an option.

If you need to see this information every time coordinate changes, then of course it should not be printed into the log.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: FanOfHumor on Wed 19/01/2022 15:38:50
QuoteIf you need to see this information every time coordinate changes, then of course it should not be printed into the log.
Yes definitely.
Title: Re: [FEATURE TEST] Log in the Editor
Post by: eri0o on Thu 20/01/2022 02:04:12
The Engine has already log groups and log level, so I added this in the logging pane:

|(https://i.imgur.com/9ZA4wgX.gif)| (https://user-images.githubusercontent.com/2244442/150253391-10e02da3-39f4-4412-a7a7-1164390fa5e6.mp4)

I also added a debounce, so the received logs are accumulated before showing up in the panel, it appears to work alright too!
Title: Re: [FEATURE TEST] Log in the Editor
Post by: eri0o on Tue 05/04/2022 22:57:56
I updated the link on the first post with an updated version of this.

(https://user-images.githubusercontent.com/2244442/161847014-2beff5c6-1abd-4569-9916-d2d6be8308e5.gif)

You now only have two groups active in the Editor log, which is the Game log group, with things that are reported from the engine internals that are relative to the Adventure game parts, and the Script log group, which are the logs you yourself can output by using System.Log().
Title: Re: [FEATURE TEST] Log in the Editor
Post by: eri0o on Sat 20/08/2022 19:31:04
Updated this to use a latest version. This version though will add lines in your game project file, so don't use this in nothing beyond a test game and backup any project before running with this version.

The log panel can be configured by using the properties window when the log panel is selected.
Title: Re: [FEATURE TEST] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: jumpjack on Tue 17/01/2023 08:43:58
Quote from: Crimson Wizard on Tue 18/01/2022 13:22:31By the way, this is somewhat related, but theoretically one could write a stand-alone application that either reads the engine log on the fly, from the file or stdout; or connects to the engine using same "Debugger" interface as editor uses, and then displays all messages in a window. This way one would be able to see game's log even without the editor.
It's what I am currently doing with my favourite text editor, PSPad, which has an "autoupdate" feature,to show in real time how a loaded file is changed by other applications.

I created this function:


function debugPrint(String text,  bool displ) {
  File *output = File.Open("$SAVEGAMEDIR$/log.txt", eFileAppend);
  if (output == null)
    Display("Error writing to log file.");
  else {
    DateTime *dt = DateTime.Now;
    String dateText = String.Format("%4d/%02d/%02d %02d:%02d:%02d" , dt.Year, dt.Month, dt.DayOfMonth,  dt.Hour,  dt.Minute,  dt.Second);
    String filetext = dateText.Append(" - ");
    filetext = filetext.Append(text);
    output.WriteRawLine(filetext);       
    output.Close();
    if (displ) { // blocking message
        Display(filetext);
    }
  }
 }

It saves log into "Saved games" system folder.

But having this function embedded in the editor would be of course much better.
Title: Re: [FEATURE TEST] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: jumpjack on Tue 17/01/2023 08:53:03
Quote from: FanOfHumor on Wed 19/01/2022 14:55:53Could you also include a list off to the side having all the objects and characters and their coordinates beside them as a window.The log shows where the characters go to but not where they are.
I cant remember all the times when I wished I knew where the character was exactly at a certain moment.
I know this Is a bit extra to ask.Especially since there might not be any room to place a window.
You are mixing up editor features with engine features...

The list of objects should be placed in the Explore Project panel of Editor window (I wonder why Chris did choose that strange view mode for objects, areas and whatelse).

The runtime engine should show current character(s) position. Showing the positions of dozens of objects looks not feasible/useful: too many data.
Title: Re: [FEATURE TEST] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: jumpjack on Tue 17/01/2023 08:58:10
Quote from: eri0o on Tue 05/04/2022 22:57:56I updated the link on the first post with an updated version of this.

(https://user-images.githubusercontent.com/2244442/161847014-2beff5c6-1abd-4569-9916-d2d6be8308e5.gif)

You now only have two groups active in the Editor log, which is the Game log group, with things that are reported from the engine internals that are relative to the Adventure game parts, and the Script log group, which are the logs you yourself can output by using System.Log().

Interesting, but listboxes are quite uncomfortable for continuous usage: I would suggest two static lists of radioboxes on the right or left.

I would also suggest separated panels for game messages and script messages.
Title: Re: [FEATURE TEST] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: Crimson Wizard on Tue 09/05/2023 13:06:26
There's an updated version built on top of 3.6.x wip update, may be downloaded here:
https://cirrus-ci.com/task/6132921954729984

Has some performance optimizations and fixes compared to the old one. Also, the log level settings were since removed and log panel now uses the Properties panel instead (you have to select the log panel to make its settings shown).

The log font may be also configured in the Editor preferences (on Advanced tab).

Quote from: jumpjack on Tue 17/01/2023 08:58:10I would also suggest separated panels for game messages and script messages.

I think multiple tabs could be implemented later as an additional enhancement, if really wanted. For the time being we are focusing minimal necessary setup where you may filter message types. There are potentially more message groups than game and script; also if messages of different types are displayed on different panels that might make it more difficult to find out if they are related. So it's something to think over and experiment with before making any actual changes.
Title: Re: [FEATURE TEST] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: Crimson Wizard on Wed 24/05/2023 10:30:16
Another update:
https://cirrus-ci.com/task/4777755552776192

This is how it looks like, overall:
(https://user-images.githubusercontent.com/1833754/240559473-79fa1df9-2b44-42d8-bc52-095f6005e70e.png)
Title: Re: [FEATURE TEST] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: Crimson Wizard on Sat 27/05/2023 12:07:25
Now implemented as a part of a 3.6.1 update:
https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-1-beta/
Title: Re: [SOLVED] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog
Post by: Crimson Wizard on Wed 24/01/2024 04:59:24
This is a proper feature in 3.6.1 now.