[SOLVED] Log in the Editor | AGS-3.6.0.35-Beta15_DebugLog

Started by eri0o, Tue 18/01/2022 09:26:44

Previous topic - Next topic

eri0o

🚨!!Just to test log, backup things, if you are playing with this!!🚨

⚠�>Download: 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] 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



Anyway, would this be useful to others? Is there anything in particular you want to use in such feature?

Pogwizd

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.

eri0o

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.

arj0n


Crimson Wizard

#4
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.

FanOfHumor

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.

Crimson Wizard

#6
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.

FanOfHumor

#7
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.

Crimson Wizard

#8
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.

FanOfHumor

QuoteIf you need to see this information every time coordinate changes, then of course it should not be printed into the log.
Yes definitely.

eri0o

#10
The Engine has already log groups and log level, so I added this in the logging pane:

||

I also added a debounce, so the received logs are accumulated before showing up in the panel, it appears to work alright too!

eri0o

I updated the link on the first post with an updated version of this.



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().

eri0o

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.

jumpjack

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:


Code: ags
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.

jumpjack

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.

jumpjack

Quote from: eri0o on Tue 05/04/2022 22:57:56I updated the link on the first post with an updated version of this.



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.

Crimson Wizard

#16
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.

Crimson Wizard

#17
Another update:
https://cirrus-ci.com/task/4777755552776192

This is how it looks like, overall:


Crimson Wizard


SMF spam blocked by CleanTalk