Best practice for rendering in a tick game

lixu's Avatar


27 Dec, 2011 07:10 AM

I am making a shooting game.In my game, the model layer has the "Game" class, which contains all the game objects(bullets, players..), the view layer does all the rendering. and i have a game loop signal as suggested from here.

My questions are

  1. Should i create a Command that listens to the "TICK" event from the game loop signal and update the "Game" in that command? and call gameMediator.render?

  2. In the gameMediator Class, should i create a dictionary map which maps all the views(like BulletView) with all the game object models(like BulletModel)? So that I can tell which model should be updated when the view is clicked.

  3. Say my game is running at 30FPS, is it too many TickCommand Instances created?

Please bear with my newbie questions..I really want to get it right at the first place..
Thanks in advance.

  1. Support Staff 1 Posted by Shaun Smith on 28 Dec, 2011 07:36 AM

    Shaun Smith's Avatar

    Hello lixu,

    I would not recommend involving an application framework, like Robotlegs, inside of your "game loop".

    Application frameworks are designed to deal with higher-level, application concerns. For example: loading a level, saving a game, posting high-scores to a web server.

    Things like physics, collision detection, enemy AI, user input and rendering should be handled by a game framework (or custom game engine). There are a number of game engines out there depending on the type of game you are making: Flixel, Flash Punk, Push Button Engine, and Ember2 with more appearing daily. Or, you could build a custom engine using a library like Box2D for physics and the Starling framework for GPU-accelerated rendering.

    I would use one of the above for the game loop, and use Robotlegs to bootstrap the application and wire together the higher level aspects.

    Hope that helps :)

  2. 2 Posted by lixu on 28 Dec, 2011 07:52 AM

    lixu's Avatar

    cool, thanks Shaun..I will have a try..

    : )

  3. lixu closed this discussion on 28 Dec, 2011 10:56 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac