Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,484 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
1000 ents? #394513
02/14/12 00:02
02/14/12 00:02
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
I´m creatig a game, and the monsters spawn under a certain moment, but just with 10 the game lags, anyone have and idea why?


CAUTION :The content above could blow your mind
Re: 1000 ents? [Re: wdakfenixx] #394514
02/14/12 00:13
02/14/12 00:13
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
The engine can handle 1.000 entities without any problems. How many vertices and triangles does a single or your entities have?


Always learn from history, to be sure you make the same mistakes again...
Re: 1000 ents? [Re: Uhrwerk] #394517
02/14/12 00:20
02/14/12 00:20
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
And if they have actions assigned, they could be very time-consuming...


Also, once it starts to lag, what happens if you leave it running for 10 mins?
Does it eventually crash? Does the lag get worse?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: 1000 ents? [Re: EvilSOB] #394519
02/14/12 01:00
02/14/12 01:00
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
No in this case it only spawn 15 and the lag is the same it didn´t get crash neither


CAUTION :The content above could blow your mind
Re: 1000 ents? [Re: wdakfenixx] #394520
02/14/12 01:05
02/14/12 01:05
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
and when i use low poly models the lag is less certainly, but still huge


CAUTION :The content above could blow your mind
Re: 1000 ents? [Re: wdakfenixx] #394522
02/14/12 01:26
02/14/12 01:26
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You don't give any information about how you spawn them, what they are supposed to or currently do, what kind of models (big textures, ...) you use, and how your code looks like.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: 1000 ents? [Re: Superku] #394525
02/14/12 01:39
02/14/12 01:39
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
well I use the free version of A8, i use ent create to put them on the map with a wait of (-3) before each one, the low poly models have around 50 faces and a wait texture are just spheres, they should decide between stay where they are or walk around avoiding objects and if they see the player chase him, however the action code does not have more than 250 lines of code

Last edited by wdakfenixx; 02/14/12 01:40.

CAUTION :The content above could blow your mind
Re: 1000 ents? [Re: wdakfenixx] #394526
02/14/12 02:01
02/14/12 02:01
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
The lines of code does not say a thing about their performance. The question is how efficient the action deals with resources and how complex the calculations are. Please post your code.


Always learn from history, to be sure you make the same mistakes again...
Re: 1000 ents? [Re: Uhrwerk] #394529
02/14/12 02:30
02/14/12 02:30
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
Code:
//Theese functions put the enemies:
var Max_hordes=2;		//maximo numero de hordas
function reset_values() // reinicia los valores
{
	var i;
	vec_set(GMSA,vector(0,0,0));	vec_set(GMSB,vector(0,0,0));	vec_set(GMSC,vector(0,0,0));
	vec_set(GMSD,vector(0,0,0));	vec_set(GMSE,vector(0,0,0));
	for(i = 0; i < 20; i += 1)
	{
		GM_S_NE[i] = 0;
	}
}

function initialize_values(var h) // posicion de aparicion de los monstruos y numero maximo en total y de cada uno de ellos
{
	switch(h)
	{
		case 0:
			vec_add(GMSA,vector(0,0,0));				vec_add(GMSB,vector(1040,2720,180));			vec_add(GMSC,vector(780,2040,180));
			vec_add(GMSD,vector(1660,2840,180));	vec_add(GMSE,vector(1363,1567,180));
			GM_S_ME[0] = 5;	GM_S_ME[1] = 3;	GM_S_ME[2] = 4;	GM_S_ME[3] = 0;	GM_S_ME[4] = 0;
			GM_S_ME[5] = 0;	GM_S_ME[6] = 0;	GM_S_ME[7] = 0;	GM_S_ME[8] = 0;	GM_S_ME[9] = 0;
			break;
	}
}

function GM_S_CE(var cual_mostruo)
{
	var create_position;
	vec_set(GMSA, vector(1650,2150,0));
	vec_add(GMSA, vector(250 - random(500),250 - random(500),0));
	create_position = 0;
	create_position = integer(random(4));
	create_position %= 4;
	wait(-1);

	switch(cual_mostruo)
	{
		case 0:		ent_create("egg.mdl", GMSA, zombie);	break;
		case 1:		ent_create("egg.mdl", GMSA, zombie);	break;
		case 2:		ent_create("egg.mdl", GMSA, zombie);	break;
		case 3:		ent_create("chopper.mdl", GMSA, NULL);	break;
	}
	++GM_S_NE[cual_mostruo];
}

function Game_Mode_S(var Nhorde, var end_horde)
{
	var i, number_monsters, create_position, horde = 0;
	while(1)
	{
		wait(1);
		if(horde < Nhorde)//nNhorde
		{
			reset_values();	number_monsters = 0;
			initialize_values(horde);
			for(i = 0; i < 20; i ++){end_horde += GM_S_ME[i];}
			while(!player){wait(1);}
			while(number_monsters < end_horde)//End horde
			{
				for(i = 0; i < 20; i ++)
				{
					if(GM_S_NE[i] < GM_S_ME[i])
					{
						GM_S_CE(i);
						++number_monsters;
						wait(-2);
					}
				}
				wait(1);
			}
			++horde;
			//break_off();
			switch(horde)
			{
				case 0:
					//activa un evento X de acuerdo a la horda actual
					//muestra un mensaje
				break;
			}
			//crea municiones
			//crea curas
			wait(-15);
		}
		//muestra mensaje de victoria
		//cierra el nivel
		//muestra tabla de resultados
	}
}
// and this is the monster code:

function CCD()
{
	if(my.skill88 == 0)
	{
		my.skill88 = 1;
		wait(-5);
		my.skill92 = integer(random(2)) + 1;//camino o me quedo quieto?
		my.skill88 = 0;
	}
}

action zombie()
{
	VECTOR* SPOTTEDP,C_speed, temp, temp2, IFOM, GGC; //IFOM= in front of my, MDTTF = my distance to the floor, GG = gravedad
	ANGLE temp_ang;
	my.skill89 = 35;
	my.health = 100;
	my.skill98 = 1000;
	my.skill97 = 250;
	my.skill94 = 0;
	
	my._id = _id_enemy;
	
	vec_set(temp2.x, nullvector);
	vec_set(temp.x, nullvector);
	vec_set(C_speed.x, nullvector);
	vec_set(IFOM.x, nullvector);
	vec_set(GGC.x, nullvector);
	my.skill92 = integer(random(2)) + 1;//camino o me quedo quieto?
	
	while (1)
	{
		while(my.health > 0)//no detecto nada
		{
			// si me hiero demasiado puedo morir
			if(my.health <= 0)
			{
				break;
			}
			//soy atraido por la gravedad, y me inclino de acuerdo al suelo
			temp2.z -= 100000;
			my.skill90 = c_trace(my.x, temp2.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | GLIDE | IGNORE_PASSENTS);
			c_move(my, nullvector, GGC.x, IGNORE_PASSABLE | GLIDE);
			if(my.skill90 < (my.skill89 -3))
			{
				GGC.z += 0.05 * time_step;
			}
			else
			{
				if(my.skill90 > (my.skill89 +3))
				{
					GGC.z -= 3 * time_step;
				}
				else
				{
					temp_ang.tilt = 0; // adjust the tilt and roll angles of the car according to the slopes
					temp_ang.roll = 0;
					temp_ang.pan = -my.pan;
					vec_rotate(normal, temp_ang);
					temp_ang.tilt = -asin(normal.x);
					temp_ang.roll = -asin(normal.y);
					my.tilt += 0.1 * ang(temp_ang.tilt - my.tilt); // play with 0.1
					my.roll += 0.1 * ang(temp_ang.roll - my.roll); // play with 0.1
				}
			} 
			
			//camino por ahi
			if(my.skill92 == 1)
			{
				vec_set(IFOM.x, vector(200,0,0));
				vec_add(IFOM.x, my.x);
				if(my.skill93 == 0)
				{
					vec_set(IFOM.x, vector(300,0,0));
					vec_rotate(IFOM.x, my.pan);
					vec_add(IFOM.x, my.x);
					
					my.skill91 = c_trace(my.x, IFOM.x, IGNORE_ME | IGNORE_PASSABLE);
					C_speed.x = 18 * time_step;
			  		my.skill22 += 18 * time_step; // 5 gives the "walk" animation speed
					c_move(my, C_speed.x, GGC.x, IGNORE_PASSABLE | GLIDE);
					ent_animate(my, "run", my.skill22, ANM_CYCLE);
					if(my.skill91 > 0)
					{
						my.skill93 = (random(360) * -1) + 180;
						while((my.skill93 < 70) && (my.skill93 > -70) && (my.skill93 < -140) && (my.skill93 > 140))
						{
							my.skill93 = (random(360) * -1) + 180;
							if(my.health <= 0)
							{
								break;
							}
							wait(1);
						}
						my.skill91 = 0;
					}
				}
				else
				{
		  			C_speed.x = 12 * time_step;
			  		my.skill22 += 17 * time_step; // 5 gives the "walk" animation speed
					c_move(my, C_speed.x, GGC.x, IGNORE_PASSABLE | GLIDE);
					ent_animate(my, "run", my.skill22, ANM_CYCLE);
					if((my.skill93 - ang(my.pan)) > 5)
					{
						my.pan += 7 * time_step;
					}
					else
					{
						if((my.skill93 - ang(my.pan)) < -5)
						{
							my.pan -= 7 * time_step;
						}
						else
						{
							my.skill92 = integer(random(2)) + 1;
							my.skill93 = 0;
						}
					}
				}
			}
			// me quedo quieto
			if(my.skill92 == 2)
			{
				c_move(my, nullvector, GGC.x, IGNORE_PASSABLE | GLIDE);
		  		my.skill22 += 2 * time_step; // 2 gives the "idle" animation speed
				ent_animate(my, "stand", my.skill22, ANM_CYCLE);
				if(my.skill22 > 150)
				{
					my.skill22 -= 150;
					CCD();
				}
			}
			if(my.skill92 == 3)
			{
				my.skill92 = 2;
			}
			//busco al jugador
				//¿lo oi?
					//enable_scan
				//¿lo veo?
			if (c_scan(my.x, my.pan, vector(120, 90, my.skill98), IGNORE_ME | IGNORE_PASSABLE | SCAN_ENTS) > 0) // detected the player?
			{
				if(you._id == _id_player)
				{
					if ((c_trace(my.x, you.x, IGNORE_ME | IGNORE_PASSABLE) > 0) && (you._id == _id_player))// and the spider can actually see the player?		
						my.skill94 = 1;
						break; // then get out of this loop!
				}	
			}
				//¿lo huelo?
			if (c_scan(my.x, my.pan, vector(120, 90, my.skill98), IGNORE_ME) > 0) // detected the player?
			{
				if(you._id == _id_player)
				{
					my.skill94 = 1;
					break; // then get out of this loop!
				}
			}
				//¿lo siento?
					//event_touch
			//
			wait (1);
		}
		while((my.health > 0) && (my.skill94 == 1))//detecto algo
		{
			c_scan(my.x, my.pan, vector(120, 90, (my.skill98 + 1000)), IGNORE_ME);// ver
			if(my.health <= 0)
			{
				break;
			}
			while(you != NULL)
			{
				if(my.health <= 0)
				{
					break;
				}
				if(you._id == _id_player)
				{
					c_scan(my.x, my.pan, vector(120, 90, (my.skill98 + 1000)), IGNORE_ME);// ver
					
					if(vec_dist(me.x, you.x) < my.skill98)
					{
						if(vec_dist(me.x, you.x) > my.skill97)
						{
							vec_set(temp, you.x);
							vec_sub(temp, my.x);
							vec_to_angle(my.pan, temp);
							
					  		C_speed.x = 24 * time_step;
					  		my.skill22 += 24 * time_step; // 5 gives the "walk" animation speed
							c_move(my, C_speed.x, GGC.x, IGNORE_PASSABLE | GLIDE);
							ent_animate(my, "run", my.skill22, ANM_CYCLE);
						}
						else
						{
							my.skill21 += 15 * time_step; // 5 gives the "walk" animation speed
							ent_animate(my, "attack", my.skill21, ANM_CYCLE);
						}
					}	
					else
					{
						my.skill92 = integer(random(2)) + 1;
						my.skill94 = 0;
						break;
					}
				}
				else
				{
					my.skill92 = integer(random(2)) + 1;
					my.skill94 = 0;
					break;
				}
				wait(1);
			}	
			wait(1);
		}
		ent_animate(me,NULL,0,0);	
		my.skill21 = 0;
		while((my.health <= 0))//he muerto
		{
			my.skill21 += 1 * time_step; // 5 gives the "walk" animation speed
			ent_animate(my, "death", my.skill21, NULL);
			wait (1);
			wait(-3);
			set(my,PASSABLE);
			set(my,INVISIBLE);
		}
		wait (1);
	}
}



Last edited by wdakfenixx; 02/14/12 03:18.

CAUTION :The content above could blow your mind
Re: 1000 ents? [Re: wdakfenixx] #394532
02/14/12 02:57
02/14/12 02:57
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
at a glance
a) use code tags
b) c_scan = slow

won't change the speed but
c) have a look at #define, it'll make your code readable

Page 1 of 2 1 2

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1