I am working on a game that will be a 3D-shooter (camera trailing player), and want to impose some architecture on the game being that a level
is composed of rooms
where each room can hold entities
(the player, enemies, pickups, projectiles), AInodes
, walls/floor, and doors
(more on these in a little)
my first concern/iteration is to get a single room functional, and then link rooms together in a later iteration(this is so that rooms to render are dynamically chosen to accelerate render times on larger level). my direct question for this iteration is what would be an optimal data structure for holding my entities
for the room? keeping in mind that whatever structure I use needs to be searchable, removable(single/group of items), sortable(this can be given up if needed), growable, and possibly be able to take pointers to the gameObjects
. this structure would probably also be used for my doors. my initial thought was to use linked list though removing items from linked lists can be a chore, and if not done right can just create a memory black-hole.
I keep bouncing back, and forth on putting walls/floor into the same structure as the entities
as it would be mostly efficient for collision detection (i think), but I know it can cause a graphics nightmare (more things being rendered means longer it takes), so maybe keeping walls separate, and create a separate list of walls to be rendered vs collisions.
the next part would be linking the rooms together by doors(see picture bellow where the joint between each room is a door
) where my first though was adjacency list. I understand that the std::graph
has an adjacency list that it uses though I don't feel that it would work in my situation as just rooms 05
, and 11
/15
don't work within a std::graph
so would it be worth while to build a custom adjacency list (might need to see an implementation as I keep getting lost on connecting adjacent things that should be connected)
- S: start
- F: finish
: room number
thing
in the game world. while a entity extends/inherits from gameObject, and is allowed to more, and have collisions resolved on them (be moved as a result of the collision). I can understand that they are similar, but I am talking about 2 different things myself \$\endgroup\$boost::ptr_vector
s though I have little experience making things like graphs, or adjacency lists which I think I need for holding the level itself \$\endgroup\$