Open mzaks opened 8 years ago
This would be awesome! What's the procedure on getting it in? I think I could help with it :)
I am not sure yet :)
First just wanted to see how much interest there is for such a feature.
Let's meditate on it for a couple more days and than flesh out a plan.
It sounds pretty interesting. Would it be possible to also see which system did the action?
This is what I meant by Logical events. Combined with state events you would see something like
2015-12-26T09:56:21Z game1 user1 session1 InitSystem1 startExecution
2015-12-26T09:56:21Z game1 user1 session1 CorePool 34526 45673 1 e_created
2015-12-26T09:56:21Z game1 user1 session1 CorePool 34526 45673 1 c_added PositionComponent(5,4)
2015-12-26T09:56:21Z game1 user1 session1 InitSystem1 finishExecution
2015-12-26T09:56:21Z game1 user1 session1 SystemA startExecution
2015-12-26T09:56:21Z game1 user1 session1 CorePool 34526 45673 1 c_replaced PositionComponent(5,4) PositionComponent(5,5)
2015-12-26T09:56:21Z game1 user1 session1 SystemA finishExecution
This might get chatty, but I think it worth a try. We can also adjust the log levels.
Ah, ok, was looking at the examples. Then I'm all for it as I've been wishing for a way to see what systems use what components (in an easier way than searching around in the code).
That was actually what I planned to do. Figuring out all the hooks and maybe providing a few classes, which will make it easy to use those.
An integrated logging system could also make sense to use it as a foundation for visualization tools. A consistent logging output across projects could enable visualizing behaviour over time (e.g creating, changing and removing entities) which might help find some bugs.
It might help finding some bugs but as @mzaks said it would be useful only in dev state. The log output would be insane. If done I would like to see it as kind of plugin that is not built in to framework. I agree with @SvDvorak checking for system-component dependencies is troublesome. Similar thing to Artemis-odb Component-Dependency-Matrix could resolve that issue quite nicely.
@kicholen I agree. It should be very easy to deactivate the logging. In the future I can imagine that we can build all kinds of visualization tools etc based on this data
One of the major problems with Unity development is there is no standard easy to extend logging interface. There have been attempts to replace the built in logger with something better but nothing that the entire community is using.
I think whatever solution you guys come up with needs to be easily extendable / modifiable to use 3rd party loggers.
Yes, I don't plan to add a logging framework (I already did one, it's open source NLog) I plan to provide sth to plug into with any logging tool you like
@mzaks what's the state with this?
@sschmid Can add it to the new Plugins structure. Schools I clone develop or wait until the release and make PR on master?
Might be safer to wait for the next release. PR on develop please (default branch) Does it require changes in entitas? or is it a Plugin?
It is a Plugin. Sending the system will/did execute event schools be figured out though. But it will still be a Plugin
It's been a while :) I saw a working prototype ages ago. Shall finalize this? Whats the state with the web UI?
Motivation:
There are two main reasons why one would consider introducing logging in a game.
Logging for Bug finding and fixing
It is fairly easy to unit test a system and therefore write robust code which transforms state in a expected manner. This however doesn't mean that one will not run into bugs. There are always a possibility for a behaviour which we do not expect. The unknown unknowns. For this type of situations it is crucial to have a logging infrastructure which can provide us with context and historical development of the state which lead to the bug. It helps us to understand and reproduce unexpected behaviours.
Gathering User Data
There are multiple reasons for gathering user data:
This data than can be used for refining game design decisions, UI decisions and even for a creation of interactive agents and NPCs.
Hoover this kind of logic is very game specific and can already be achieved with smart use of reactive systems.
Therefore this proposal will concentrate on the Logging for Bug finding and fixing starting from here.
General Context
In order to analyse the logging data every logging statement has to be provided with context.
Time and order related context
Time seems to be the important data point for this context. Two other data points can be seen as optional.
Identification context
Entitas specific events
I see two types of events which can help developers in finding and fixing Bugs
This events also need context which is Entitas specific:
Entitas state context
For component related events it would be nice to see the data the component was storing. Something like:
This would be hard to achieve automatically because a component can store any kind of data. Therefore I suggest to introduce a
ILoggable
Interface:Which when implemented by a component class will lead to a more verbose log statement.
Examples of Log Statements:
Which can be decode as following
Now by searching for
game1 user1 session1 CorePool 34526 45673 1
we can find out the whole history of entity with creation index 1. By excluding the creation indexgame1 user1 session1 CorePool 34526 45673
we can see how and when this entity instance was reused during the whole session1.Logging BackEnd infrastructure
Logging all the events that I have described in Entitas specific events means that every instance of the game will generate a massive amount of data. This is why I would suggest using such high level logging only during development and maybe internal beta releases. However even for this controlled scenarios we would need to have a Log receiving part which can handle so much data.
Without trying it out my self, I would suggest to use Papertrail and see how much load it can handle. Papertrail provides a nice infrastructure for storing and querying Log statements.