Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 27 Oct 2006
Offline Last Active Yesterday, 09:12 AM

Posts I've Made

In Topic: Entity Component System questions/tips

31 March 2014 - 03:28 PM

One part that I would spend more time on is determining how to build the objects (layout).  I know phil_t suggested using a text file and this answed your question but you need to have more questions in this area.  I see very little point to using an ECS if you're going to hard code how your objects are created.  You need somekind way to define your objects and then created them using that define / template.
Here is a really simple lua script I just rattled off, not how I would do it but it gets the point across.


defines =
    truck_heavy_red =
        physics    = { weight = 10, max_speed = 25.0 },
        render = { model = 'trucka', texture = 'foo.dds' },

game:loadDefines( defines )

game:createEntity( 'truck_heavy_red' )


Also the ids to index the array is fine and should be used in conjunction with somekind of weak reference system.  You will want some references to an object to get invalidated when they are destoryed.  Think of your tank having a reference to it's target.  I use something like the method described in Game Gems I

I would also have another class called Game that contains your World.  I put stuff like my modes in there (GameMode, PausedMode, HelpMode etc).  Also access to some systems like lua, game options and UI.  I treat the World as the simulation only.  Just a thought.


In Topic: A question about where to store the Camera!

31 March 2014 - 09:29 AM

I am not a fan of cameras being a component or an entity.  I do make them using a class and have helper functions for culling etc but they live in thier own hierarchy outside of my object system.  I have found it's better for things to have a reference to a camera instead if they really must.  Now where the camera is created and stored will be specific to your game.  Create in your script perhaps and make it the currently active camera in the world is the simplest and may be enough for your game.  It's hard to say without seeing everthing and know the scope f the game.


The most important part of this question IMHO is the rendering part and I would say without a doubt it should be passed to the rendering functions.  I have a RenderJob I pass around and it's main purpose is for multi-threading but it does also hold a reference to the camera, lights, rendertarget etc.  This is more flexible for rendering objects.  I use the same render call with a different job to render an entity to a texture and use it in my ui as I do for rendering in the actual world.

In Topic: What are some good books for ios development?

31 March 2014 - 09:08 AM

What I do if I have a new topic to learn is subscribe to http://www.safaribooksonline.com/ for as long as I need to get up to speed.  It gives you a libray of books instead of committing to just one.  I have found this the fastest and likely the cheapest option.

In Topic: OpenGL ES Texturing

31 March 2014 - 08:49 AM

Very true.  I actually keep a bitmask around to represent what is set but if you're starting out I would set it redundantly until you're rock solid.

In Topic: OpenGL ES Texturing

29 March 2014 - 08:24 PM

It was the glEnableVertexAttribArray for texture coords.  I told him in chat.