Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (howardR), 663 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
probably not deleted memory #462457
10/02/16 04:16
10/02/16 04:16
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
Hi all,
I have a problem with my ent_create function.
the "ms/frame" "fnc" in the [F11] menue ist kritical.
---please try to understand me, my englisch is not good, but its trick to explane these problem---

the code:
Code:
#include <acknex.h>
#include <default.c> 
VECTOR temp_old;
function placelevelobj(){
	VECTOR temp;
	var i;
	result=c_trace(temp.x,vector(temp.x,temp.y,temp.z-1000),IGNORE_ME);
	if(result<=0)
	{
		for(i=800;i>0;i--)
		ent_create("plane.mdl",temp_old,NULL);	//under the player model
	}
}
function player_ent(){
	player=my;
	vec_set(temp_old,player.x);
	while(1)
	{
		if(key_space)player.x+=time_step;
		camera.x=-25+player.x;camera.y=-25+player.y;
		if(player.x>temp_old.x+3)
		{
			temp_old.x+=3;
			placelevelobj();
		}
		wait(1);
	}
}
function main()
{
	video_mode=9;
	max_entities = 100000;
	level_load(NULL);
	vec_set(camera.x,vector(-40,0,40));
	vec_set(camera.pan,vector(45,-45,0));
	ent_create("cube.mdl",vector(0,0,0),player_ent);
}



the code create a cube as a player entity. with [space] you can move the player, if no plane under the player, placelevelobj() will start and create 600 planes, because with 600 planes you can see the problem.

how to see the problem:<-----------!
press [F11] to see ms/frame fnc value.
at start fnc is at 1 or 2 or betwen...
if you hold on, on [space] fnc will get higher value(thats ok)
if you hold on space still fnc is higher, you can see the problem.
for example, at first start i have to hold on space key for 5secunds to get fnc over 50, if I relase the space key, fnc go to 1 or 2
BUT is i press space key again, fnc is over 50 in 1 sec.

thanks for reading
if you hold on [space]

Re: probably not deleted memory [Re: CocaCola] #462458
10/02/16 05:48
10/02/16 05:48
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
I think that is the normal behaviour of the engine. Entities are arranged into an internal list. When you create an entity the list becomes a bit longer. When you perform a c_trace the engine takes that list and checks if their bounding boxes intersect with the trace ray one by one. So the longer the entity list is the slower the c_trace will be.

Salud!

Re: probably not deleted memory [Re: txesmi] #462459
10/02/16 05:54
10/02/16 05:54
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
wow, you are right, i have to think aout ist, but for my game i will use a arry, with positins to locate the planes, i have only the same z valve

Re: probably not deleted memory [Re: CocaCola] #462460
10/02/16 08:30
10/02/16 08:30
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
i have sloved the problem, with scanning only for a group in 25 steps Distance


Gamestudio download | chip programmers | 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