Search the Community
Showing results for tags 'fsm'.
-
Hello, That's my first post so... I hope I'm in the right place for such request... I'm a website developer and I created a jQuery library to manage and fix some complex GUI problems I had in javascript and jquery with the help of an FSM. In itself, the library proposes a jquery extension to create (hierarchical) finite state machines on DOM objects reacting on javascript or virtual events... I'm not in the game devs at all but I was wondering if the library could be used in this area and would be great if that could be... I'm looking for people who would accept to give it a try for a "real" game or some "real" game test, in order to have feedback as: - perhaps that's the library is of no use for game dev :-( - perhaps what's really missing to be useful - possible improvements on features, speed, etc. The library is available on github : https://github.com/intersel/iFSM There are some examples to show how it works - http://www.intersel.fr/ifsm-jquery-plugin-demos.html#demolist and you can see some game bad mockups: http://www.intersel.fr/assets/gitdemos/iFSM/Mastermind.html http://www.intersel.fr/assets/gitdemos/iFSM/Example_BouncingBall_reacting_to_mouse.html using jCanvas Thanks for any help :-) Emmanuel
-
My question:Do you use a plain (but heavily branched) game loop or do you split your game by a principal like MVC or MVP ? Yes I know, I know.. this classical question is related to programming, not to gaming itself. I think I established a really nice and well working architecture in my flash/flex projects. Those projects were something between an App and and a Game as I'm cerating a lot of short termed, microsite like apps und pages (10 to 30 working days) for advertising agencies and there customers. I still create flash projects. But in the past year I've seen myself doing more and more Javascript only projects and as somebody with a flash background of 15 years it was inevitable that I will join the HTML5 gaming community A typical flex project nowadays looks like this:Robotlegs as my application framework Finite state machine (FSM) to carefully manage my transitions between my content screens. Service and Models classes to retrieve and manage any data. Communicate with events between my mediator and my views, and use Signals and Commands to trigger actions in a mediator or a data fetching service class. Four years ago I used PureMVC instead of Robotlegs and before then I used Cairngorm MVC.It always was a battle to organize my code and establish a solid communication between all elements. My flash projects are now fine. It absolutely works for me. But I still battle the code with each new project as the app flow is never the same. I sometimes re-adjust my FSM, sometimes I need no FSM and control everyhting myself in a global 'big daddy' controller. I created so many many many projects with flash & flex. I love JS and I always use Backbone Views & Router to manage my HTML Frontend. I'm programming well tested backends in Rails for two years now. The whole ecosystem I work with is a pleasure. It's fun. Now I dived deep into HTML5 (or more to say JS with Canvas/WebGL) aaaand welcome back in 1999. It's not that I'm struggling with it. But there is a large battle in my mind. Should I use a plain game loop or do it the fancy and OOP'ish way I know from Flash, Rails and my Frontend JS. Of course, I decided to do it the fancy way. And it totally feels like over-engineering my code.I'm currently building a small advertising game. It will run on Facebook and standalone. Nothing complex you and I would say. It's a Whac-A-Mole clone with a totally not mole related story overlayed.There is a Timer, some Levels adjusting the speed and difficulty, some messages presented as an overlay.There is a qualification round, and all the game levels itself. You get a penalty when you miss to hit a mole. Then penalty is shown in an overlay, the timer is paused. At the end you have a highscore in form of a duration you survived before missing too many moles. Easy isn't it ? I can clearly see you guys programming this within hours or days with a simple branching game loop. And what did I ? I havea state machine with 4 states (introduction, qualification, qualification results, competition & results)a bloated game modela levelmanager model (LevelConfig, LevelItem, LevelManager)a player modelan isolated class to manage to the gameplay logic itself (Mole, Whacker, Referee)an overlay controllera view and presenter/mediator for each stageAdditionally to the FMS big daddy controller, where I init my game models(player, game, levelmanager), initializing my mediators with my views, expose some global APIS like (stopGame, restartGame, playMusic) and listening to the FSM to trigger an overlay or change a state in my fat game model.No clear way of communication. Sometimes I listen for changes in my game model,Sometimes I call something via a global saved instance of my bid daddy controler, sometimes I use my global command bus (which is: a globally available event bus) sometimes I listen for a change in my game model. Yeah i's working! It's not finished but in a good progress and I feel good about the result itself. I used Phaser and I'm feeling really happy with it.But can you see it? This is over-engineered!! I hate it! It's like I'm knowing to much about architecture and that I messed it all up. I do not want to do it again in this manner. I can't do it the easy way and switch over to a game loop. My brain is not able to think in a single game loop. I grew up with MVC, with decoupling & events. And that's the reason why I'm asking here you pros: What's the architecture of your small or large games ? Sorry for that long story telling. Thanks for any comment, advice or question!Regards George By the way, my game loop looks like this://a state of Phaser JScreate: function(){ this.whackAMole = new Game.WhackAMoleGame(this.game) //init big daddy controller this.whackAMole.start()}update: function(){ //nothing.. phaser is doing all the game loop stuff, my game is totally event based}
- 9 replies
-
- architecture
- robotlegs
- (and 6 more)
-
This is a really nice and compact finite state machine package. Good examples and docs and no 3rd party libs used. Well worth considering for game dev. http://codeincomplete.com/posts/2013/1/26/javascript_state_machine_v2_2_0/