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 (AndrewAMD), 14,661 guests, and 5 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
video memory issue ... maybe you can have a short look #248803
01/29/09 07:52
01/29/09 07:52
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi jcl,

maybe if you have a second you could have a short look at this:

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=248752#Post248752

Thanks.

Regards,
Pegamode.

Re: video memory issue ... maybe you can have a short look [Re: pegamode] #248826
01/29/09 12:20
01/29/09 12:20
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Changing the level only frees the memory used by the level. It does not free any other video memory.

So when you're allocating more and more memory in some function that's unrelated to the level, you'll eventually run out of memory. Video memory is not freed by level changing when it's allocated for view entities, bitmaps, materials or the like.

Re: video memory issue ... maybe you can have a short look [Re: jcl] #248833
01/29/09 12:50
01/29/09 12:50
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Thanks for your answer.

Am I right that this means, that I have to use ent_purge to free the video memory for all entities that I have created by ent_create before changing the level?

Regards,
Pegamode

Re: video memory issue ... maybe you can have a short look [Re: pegamode] #248861
01/29/09 16:58
01/29/09 16:58
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
ent_createlayer, not ent_create.

Re: video memory issue ... maybe you can have a short look [Re: jcl] #248921
01/30/09 05:45
01/30/09 05:45
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hmmm ... that's strange.

Since I use ent_purge before changing the level for all entities created by ent_create all video memory is set free.

When I delete those lines the video memory gets less everytime I change the level.

I'll try to dig a little deeper into that ...

Re: video memory issue ... maybe you can have a short look [Re: pegamode] #248925
01/30/09 06:49
01/30/09 06:49
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Is there something special with those particular entities? For instance, do they use the same models as view entities, or have you cloned them or something like that?

Re: video memory issue ... maybe you can have a short look [Re: jcl] #248940
01/30/09 08:01
01/30/09 08:01
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Those entities are the playable characters of the game.

At every level change I check (after loading the level) which of those characters are located in the current level and get their position.

Then I use ent_create to put those characters at the saved position inside this level.

That's the code I use:

Code:
function check_character(CHARACTER* c_player, ENTITY* ent_player) {				
	if (ent_player != NULL) {				
		return; // returning from check_character. player was already set.
	}
	if (str_cmp(c_player.isInRoom,level_wmb) == 1)  {								
		c_player.isInCurrentRoom = 1;
		c_player.head = NULL;
		c_player.entity = NULL;
		ent_player = ent_create (c_player.mdl, c_player.position, player_movement);		
		ent_player.CHARACTER_POINTER = c_player;		
		ent_player.emask |= ENABLE_IMPACT;
  	ent_player.event = push_event;  	  	  	  	  	
		VECTOR tmp;
		vec_for_vertex(tmp, ent_player, c_player.headVertex);		
		c_player.head = ent_create (c_player.headMdl, tmp, NULL);		
		ent_player.HEAD_POINTER = c_player.head;				
		ent_player.pan = c_player->rotation.pan;
		ent_player.tilt = c_player->rotation.tilt;
		ent_player.roll = c_player->rotation.roll;
		ent_player.link.name = c_player.displayName;
		ent_player.string1 = _chr(c_player.displayName);		
		ent_player.scale_x = c_player->scale.x;
		ent_player.scale_y = c_player->scale.y;
		ent_player.scale_z = c_player->scale.z;
		c_player->head.pan = c_player->rotation.pan;
		c_player->head.tilt = c_player->rotation.tilt;
		c_player->head.roll = c_player->rotation.roll;		
		c_player->head.scale_x = c_player->scale.x;
		c_player->head.scale_y = c_player->scale.y;
		c_player->head.scale_z = c_player->scale.z;		
		c_player.entity = ent_player;				
		wait(1);
		ent_player.flags = NARROW | FAT | FLAG2 | FLAG7 | FLAG8 | POLYGON | SHADOW | CAST;
		c_player.head.flags = PASSABLE | SHADOW | CAST;		
		c_setminmax(ent_player);	
		c_updatehull(ent_player,2);			
	}	else {				
		c_player.entity = NULL;
		c_player.isInCurrentRoom = 0;
	}	
}


Re: video memory issue ... maybe you can have a short look [Re: pegamode] #248947
01/30/09 10:18
01/30/09 10:18
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
I don't see an effect on entity purging at a first glance, but there's a potentially dangerous mistake in 2 lines:

...flags = ....

Flags are set with |=, not =. With '=' you're deleting all internal flags, with possibly bad consequences. For being on the safe side, always use the "set" macro that we provide.

Re: video memory issue ... maybe you can have a short look [Re: jcl] #248949
01/30/09 10:33
01/30/09 10:33
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Ok. I'll change the flag settings.

I didn't know that there are internal flags, so I used '=' to be sure that only these flags are set.


Moderated by  old_bill, Tobias 

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