Open crazzymad777 opened 6 years ago
States of objects changes only when Process() called? If yes, we can update user interface form (e.g. gas tank, pressure's value and valve status, if it is broken then close form) for object at the same time with Object's Process. Else preferred make separate process.
This issue is actually pretty complex by its nature, so it will request some time from me to describe my vision properly. So I will answer in details in couple days probably. But TLDR: changes everywhere will be needed (server, core, client), the issue is big.
Some notes can be found here #106
We want a way to display an arbitrary complex interface to user and interact with game via this interface. There will be plenty of such interfaces, and it would be nice to have ability to create them in a swift manner.
The game has 3 main parts: representation, core and server. All visible information is passed via frame https://github.com/griefly/griefly/blob/5445dda253aa8a9bac27de23a97c6cc4a18409bc/sources/core_headers/CoreInterface.h#L19 so it should be possible to fully draw interface from frame data (i.e. no chain dependencies from previous frames). Obvious choice of a data format in frame for UI is JSON, but maybe there are better ways. Overall:
MakeClickMessage
, but with some JSON as a parameter).Represent
is requested (basically, every tick) the game object which represents the UI generates an appropriate JSON (or something) for client-side.Currently I think to pick HTML and JS as base for such UI, because they are easy tools for flexible interfaces. QWebChannel
/QWebEngine
can be very helpful here. UI should have 1 main entry point - something like stateUpdate(json)
which will be called with new data each tick.
There are a lot of other small details, and they can be discovered only during the development. It may request a lot of testing and changes.
I want to start work on user interface (for consoles, gas tank, pumps, fire alarms, air alarms, gas mixers, etc) but I don't know archicture of project.
So I need consultaion, how much better introduce it, interaction between objects and ui, etc..
E.g. Gas Tank, I already made window for that one, it will show pressure and valve's status and player with it will can toggle valve.
But how introduce it? Where place it? In client/represation? But when player clicks on gas tank, it should create form probably through an interface (I supposed). For example,
Or something like that.