Skip to main content
copy edited
Source Link
Tetrad
  • 30.1k
  • 12
  • 96
  • 143

How should iI manage multiple entityentities?

im pretty new to game development. Before iI start making somea game, imI'm trying to figure out how iI will manage thingthings. One One of the first thing imthings I'm not sure about, is how to manage entityentities (enemy, player, projectile...)

Language i could use, since these are language i know or im learning:I'm going to be using either C, C++, JAVAJava, or C#

One of the idea i gotideas I have is to use anone array for projectile,projectiles and one for enemy, eachenemies. Each time iI have a new entity, iI grow my array. Here is the problem: If player/enemy is firing, that creates a new entity, projectil which means the projectile array is growing. 

Suppose its projectilprojectile #2053, when it hit something, iI free it, then in my loop to check which projectilprojectiles are to do something, like getting closer to there target, iI check if every # of my array to see if its null, if not, check is trajectory. But the problem is that the array will grow each time a new projectilprojectile is fired, and iI will get a memory problem at the end, how should i manage entity? (sorry if its unclear, its even unclear to me on how i will do thing). Can someone explain me

So how toshould I manage entity, or point me to any good article about thismy entities?

I need an awnser that covercovers both, object oriented and standardprocedural, since iI mainly do thingthings in C.

Here is what i understand on how to use entity:

How should i manage multiple entity?

im pretty new to game development. Before i start making some game, im trying to figure out how i will manage thing. One of the first thing im not sure about, is how to manage entity (enemy, player, projectile...)

Language i could use, since these are language i know or im learning: C, C++, JAVA, C#

One of the idea i got is to use an array for projectile, one for enemy, each time i have a new entity, i grow my array. Here is the problem: If player/enemy is firing, new entity, projectil array is growing. Suppose its projectil #2053, when it hit something, i free it, then in my loop to check which projectil are to do something, like getting closer to there target, i check if every # of my array to see if its null, if not, check is trajectory. But the problem is that the array will grow each time a new projectil is fired, and i will get a memory problem at the end, how should i manage entity? (sorry if its unclear, its even unclear to me on how i will do thing). Can someone explain me how to manage entity, or point me to any good article about this?

I need an awnser that cover both, object oriented and standard, since i mainly do thing in C.

Here is what i understand on how to use entity:

How should I manage multiple entities?

Before I start making a game, I'm trying to figure out how I will manage things. One of the first things I'm not sure about is how to manage entities (enemy, player, projectile...)

I'm going to be using either C, C++, Java, or C#

One of the ideas I have is to use one array for projectiles and one for enemies. Each time I have a new entity, I grow my array. Here is the problem: If player/enemy is firing, that creates a new entity which means the projectile array is growing. 

Suppose its projectile #2053, when it hit something, I free it, then in my loop to check which projectiles are to do something, like getting closer to there target, I check if every # of my array to see if its null, if not, check is trajectory. But the problem is that the array will grow each time a new projectile is fired, and I will get a memory problem at the end.

So how should I manage my entities?

I need an awnser that covers both object oriented and procedural, since I mainly do things in C.

Source Link

How should i manage multiple entity?

im pretty new to game development. Before i start making some game, im trying to figure out how i will manage thing. One of the first thing im not sure about, is how to manage entity (enemy, player, projectile...)

Language i could use, since these are language i know or im learning: C, C++, JAVA, C#

One of the idea i got is to use an array for projectile, one for enemy, each time i have a new entity, i grow my array. Here is the problem: If player/enemy is firing, new entity, projectil array is growing. Suppose its projectil #2053, when it hit something, i free it, then in my loop to check which projectil are to do something, like getting closer to there target, i check if every # of my array to see if its null, if not, check is trajectory. But the problem is that the array will grow each time a new projectil is fired, and i will get a memory problem at the end, how should i manage entity? (sorry if its unclear, its even unclear to me on how i will do thing). Can someone explain me how to manage entity, or point me to any good article about this?

I need an awnser that cover both, object oriented and standard, since i mainly do thing in C.

Here is what i understand on how to use entity: