Game Object Architecture for RTS

Started by
3 comments, last by Krypt0n 8 years, 7 months ago

Hi,

my current project is a rts game using my own game engine (C++, OpenGL 4.2).

My game engine doesn't provide its own game object architecture because I wanted to try different approaches.

However, a rts game is yet different again. I'm tending to use a property-centric architecture since all units have mostly everything in common.

For example those properties: HP, Mana, Mesh, CollisionBoundary and so on.

But I need it to be extensible through scipts. I am going to add hell a lot of units (let alone be the human race with around 50 units).

Is an property-centric suitable for a rts game or does there exist another approach (other than ECS), which supports data locailty?

It's not a shame to make mistakes. As a programmer I am doing mistakes on a daily basis. - JonathanKlein

Advertisement

What exactly is your question?

ECS should lend itself well to data oriented design if that is what you wanted to ask.

My question is: which design is suitable for an rts game?

It's not a shame to make mistakes. As a programmer I am doing mistakes on a daily basis. - JonathanKlein

Well what have you tried so far?

I would say that the ecs approach is a good fit.

It lets you easily mix different behaviours to make the units relatively unique without requiring you to write hundreds of specialized classes. (at least in theory)

I'm tending to use a property-centric architecture since all units have mostly everything in common.
For example those properties: HP, Mana, Mesh, CollisionBoundary and so on.

that's a good starting point, you can describe all units in an RTS with the same properties. buildings can be the same objects but with a "max-speed" of 0. tanks and soldiers are the same with different speeds and fire power.
you can set 'flags' for special needs like e.g. ammo type, some units might fire arrows, others cannonballs, which look and move differently, but those have still the same property types (damage-per-hit,speed,fire-delay,precision,....)

that will also make scripting very simple, as you just have one type of object to cover and you can script everything you want with every unit. e.g. if you have an "on-hit" bool that indicates whether the unit explodes when it hits something (e.g. cannon-ball), you could switch on this flag for a jeep via script and call it a suicide vehicle that the player needs to stop before it reaches base....

This topic is closed to new replies.

Advertisement