Hi JGO-Community,
i have been following this forum since almost a year now and i really like the way you help each other, so i thought why shouldn’t i join you?
Since some time i am thinking about creating a little 2D platform shooter with libgdx and box2d, but for some reason i did never start, but continue thinking about different mechanics.
I allready have some experience with libgdx (the 0.9.9) but until now i had some problems with the code organization. The main problem was, that i wanted to see fast progress to keep myself motivated, but the result was a dirty mixture of texture loading, drawing and logic in the same classes.
Cause of this now i am trying to find a way to create clean and working code.
After reading the libgdx changelog i saw, that libgdx now has a ECS (Ashley), which really seems interesting. However i have now experience with this systems and so i am not sure if this is what i want to use for my little game. So i hope you can tell me if and how i can/should use ECS in my game.
To the game:
As i said, the game should become a 2D platform shooter, where the player can move it’s character with the keyboard (they keys should be changeable in the settings) and aim with the mouse.
He should be able to hold 5 different weapons, where ofc only one at a time can be active.
There should be a few different weapon types:
Ranged weapons, which shoot bullets. Those bullets can be affected by gravity or not (box2d offers the method “setGravityScale”). Also they can be explosive, so damage all entities in a radius or “normal” and damage only the entity they hit.
Melee weapons, which only hit enemies in front of you, at almost the same heigth and in range.
Thrown weapons, which again “shoot bullets” (actually you throw granates, logically it should be the same). They are affected by gravity and are explosive. They can explode after some time or on contact (with wall, bullets or player/npcs).
Mines, which places a mine in front of you. They are affected by gravity (if there is no block under them they will fall) and are explosive. They can explode after some time, on contact or remote controlled.
Also there should be enemies, controlled by an AI.
The AI can have different states, so i want to use a “Finite State Machine”.
Also a NPC should be able to hold different weapons, again only one at a time can be active.
The “States” should be more or less the same for all enemies, however different enemies should have different AIs for the states. A “Melee-Enemie” for example tryes to get near to you, while a “Sniper-Enemie” tryes to hit you from far away.
In this case (for this game) is it better to use ECS or easiere and maybe even cleaner without using an ECS?
If i should use ECS, how would the system look like? Which componente and which entities should be there?
For me it seems like a weapon is a component (hold by the player and npc entities) as well as an entity, having the bullet-properties as components.
It would be great if you can help me with this an just share your thoughts
Thanks a lot!