Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,310 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ent_preload, entitiy skins, changing of those, and timing #449890
04/01/15 23:12
04/01/15 23:12
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline OP
Expert
Error014  Offline OP
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Wow, that's a mouthful of a topic subject!

Here's my problem. I'm changing the skin of an entity. To do so, I get it via bmap_for_entity. That's nice.

However, the thing is: as soon as the entity is visible, the changed skin is overwritten with the original skin's content. So it seems like the skin is loaded only when the entity becomes visible (meaning is in the camera's view frustum) - regardless of preload_mode and/or ent_preload.
Here's a quick code snippet to try it out. You need an image called "ent.bmp" to run it.

Run it, then press SPACE. A red square (skin AFTER change!) appears in the top left corner. Hit space again and the entity is made visible, and the original skin (your "ent.bmp") appears.

Now, comment the "camera.pan=180;" - line. Now the entity was visible shortly in the view's frustum and it works as expected - the red square changes (the changes are not overwritten). Good.

Now, comment the "wait(2);"-line. Now the entity is created in the view-frustum, but immediatly set invisible. And you have the old behaviour again. You also get that behaviour if its a "wait(1)" instead of a "wait(2)".

Am I misunderstanding ent_preload? I thought the entity skin would then be loaded regardless of the engine's take on its visibility and usefulness of that, but it seems that this is not the case.


Code:
void main() {
	ENTITY* testent;
	level_load(NULL);
	preload_mode = 3;	
	
	camera.pan=180; //Hello! Comment me out to 
	testent = ent_create("ent.bmp",vector(100,0,0),NULL);
	ent_preload(testent);
	wait(2);
	set(testent,INVISIBLE);

	while(!key_space)wait(1);
	while(key_space)wait(1);
	
	bmap_fill(bmap_for_entity(testent,0),COLOR_RED,100);
	
	camera.pan=0;
	while(1) {
		DEBUG_BMAP(bmap_for_entity(testent,0),1,4);
		if(key_space) reset(testent,INVISIBLE); else set(testent,INVISIBLE);
		wait(1);
	}
}




Last edited by Error014; 04/01/15 23:13. Reason: removed a unnecessary line

Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: ent_preload, entitiy skins, changing of those, and timing [Re: Error014] #449892
04/01/15 23:20
04/01/15 23:20

M
Malice
Unregistered
Malice
Unregistered
M



Did you see this in ent_preload?

Quote:
For preloading an entity that you dynamically create at runtime, temporarily create, preload, and remove it already after level loading. This puts the entity model in the internal texture and mesh cache.


However, I did not run the test you asked.

Last edited by Malice; 04/01/15 23:22.
Re: ent_preload, entitiy skins, changing of those, and timing [Re: ] #449893
04/01/15 23:44
04/01/15 23:44
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline OP
Expert
Error014  Offline OP
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Yeah, I saw that. But see the test - there's a created, preloaded entity (granted, not removed, but I want to keep it around). It still "overwrites its own skin". Placing ent_preload before the wait also didn't change things.


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: ent_preload, entitiy skins, changing of those, and timing [Re: Error014] #449894
04/02/15 01:39
04/02/15 01:39

M
Malice
Unregistered
Malice
Unregistered
M



I ran the test and it is always red for me. I never saw white(My original skin color).

This would point to a hardware issue, correct??

I'm am running Intel hd 4000
I believe my demo is now in free mode. not sure

Last edited by Malice; 04/02/15 01:55.
Re: ent_preload, entitiy skins, changing of those, and timing [Re: ] #449897
04/02/15 05:44
04/02/15 05:44
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
it can be a mipmap related thingie. bmap_to_mipmap is our friend (I sucked a lot with it in my terrain skin editor, but now works fine)


Free world editor for 3D Gamestudio: MapBuilder Editor

Moderated by  HeelX, Spirit 

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