AlbertTJames Posted August 8, 2016 Share Posted August 8, 2016 Hey everyone, I am currently coding a boilerplate for scientist like myself who wish to create web based tasks using the latest technology the web has to offer This boilerplate is not aimed to be babylon.js specific but the two main example from which users could build upon would be in 3d in BabylonJS and in 2D probably using ... phaser ? did not decide yet. The design needs to be built independently of the game engine used and I was wondering if you had any advices on how i should build my object hierarchy. What is special with experimental tasks is that everything has to be collected at the millisecond, well stored, exportable etc. So beside the general hassle of building a robust game state system I need to handle inputs and data asynchronously. I created this little flow chart that you are welcome to modify if you have any relevant comment/idea, I'll be very glad to have any input from you guys ! https://drive.google.com/file/d/0BxggOFF8_iXkLUpXeXlyTkh2a2c/view?usp=sharing Thank you ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 9, 2016 Share Posted August 9, 2016 Hello this is cool but I'm not sure to catch what you are looking for Quote Link to comment Share on other sites More sharing options...
AlbertTJames Posted August 9, 2016 Author Share Posted August 9, 2016 Ahah, Well maybe the real question is, how do you keep track of states in a video-game ? Should inputs be treated always asynchronously or should we built some kind of Event heap to treat them in series at each update. For example I want my system to be able to keep track of the exact time a target appeared on screen, the exact time the subject pressed a key to respond, then wait for a fixed amount of time after keypress before showing a feedback etc.. While making the system high level enough to adapt to any lower level design constraints. the way Babylonjs handle event is through the actionManager no? But that is very low level (although it is very powerful and asynchrone). I am currently working on the stateManager and I think the object hierachy will work, but since I want to share it with the community and make a good project people could build upon, I'd like to really nail this state management in the best way possible and not make something that just "work" or reinvent the wheel. I am sure people must have thought about this problem before me and came up with great solutions... no? Do you have any advice on how to manage states at a higher level, the level of the game, or the scene.. ? Or maybe a good ref. on how professional game designer manage states in complex vieogames ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 10, 2016 Share Posted August 10, 2016 it depends on the game and the technology On the web using JS, there is no asynchronous per se, so you have to deal with event in a serial way. Things seem async but they are not There is only one thread and this is a constraint to keep in mind. babylon.js is ultimately using events from inputs (mouse, webvr, touch, etc..) to keep track of input states. Then on every frame, it updates objects state Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 10, 2016 Share Posted August 10, 2016 You might use a scene level after renderer to record anything you like, or schedule things to happen on the next frame. I use one to set my system wide time for the next frame, so all objects will have the same time. This enables either realtime or fixed FPS. Also useful for system wide animation pause / resume. Quote Link to comment Share on other sites More sharing options...
AlbertTJames Posted August 11, 2016 Author Share Posted August 11, 2016 Thanks for the input I will look into that ! If you think of any other advices I am open to all suggestion. I will share a working version here maybe somebody would have use of an overkill state/datamanager Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 11, 2016 Share Posted August 11, 2016 http://doc.babylonjs.com/overviews/Observables@AlbertTJames you can build complex structures with, at least i can. AlbertTJames 1 Quote Link to comment Share on other sites More sharing options...
AlbertTJames Posted August 11, 2016 Author Share Posted August 11, 2016 Oh that's great for keeping track of precise event timing ! Thanks Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 11, 2016 Share Posted August 11, 2016 On 8/10/2016 at 4:29 PM, JCPalmer said: You might use a scene level after renderer to record anything you like, or schedule things to happen on the next frame. Just to clarify, I believe JC was talking about scene.afterRender = function() { record whatever and even hot-swap scene.beforeRender function! }. One other thing. The scene collision system is "rubbery". I highly suggest that you NOT use mesh.collider.onIntersect ... to position real-life nano-surgery probes or other "mission critical" robotics. kbye. AlbertTJames 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.