Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
ent_create bug? #315743
03/18/10 17:58
03/18/10 17:58
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline OP
Expert
Slin  Offline OP
Expert

Joined: May 2005
Posts: 2,713
Lübeck
ent_create seems to allocate new memory for the vertices each time it is called for the same model file.

Have a look at this thread for a few more details: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=315738#Post315738

Oh and while I am already posting a "bug" I also want to mention that the terrain from image importer crashes for about >300x300 vertices.
Another problem I found is when using ent_mtlset entSkin1 will always(?) be the first skin and not the one used by the subset.

Last edited by Slin; 03/18/10 18:47.
Re: ent_create bug? [Re: Slin] #316197
03/22/10 10:28
03/22/10 10:28
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
No, it does not allocate new memory for the vertices. For the engine, memory is very, very precious. Not a byte is wasted.

ent_mtlset is for setting a material to a skin. It has nothing to do with subsets.

http://manual.3dgamestudio.net/aent_mtlset.htm

Re: ent_create bug? [Re: jcl] #316207
03/22/10 12:35
03/22/10 12:35
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline OP
Expert
Slin  Offline OP
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Then please tell me what I am doing wrong that this code takes so long to be executed and finally even crashes: www.slindev.com/files/other/ent_create_crash.zip
I actually can´t see a reason for it to crash if it isn´t too little RAM, which also shouldn´t be the case as in my understanding it shouldn´t allocate more than 20mb (actually quite a bit less, but I can´t remember the number I calculated a few days ago).

About ent_mtlset, shouldn´t it still make the texture the shader is assigned to accessible as entSkin1? If you want, I can prepare a simple project for this as well.

Last edited by Slin; 03/22/10 12:35.
Re: ent_create bug? [Re: Slin] #316210
03/22/10 13:12
03/22/10 13:12
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Thanks - well I've downloaded your "code". But I'll certainly not start it. What do you think of me? I'm a poor developer and have no supercluster in my backyard.

Your program will crash already the physics engine in the first frame. DirectX won't like a giga-polygon level either. Have a look at the infinite_terrain level how to create a huge number of entities. Especially, do not use collision detection with grass. Set PASSABLE, and set strict LOD conditions.

Re: ent_create bug? [Re: jcl] #316212
03/22/10 13:44
03/22/10 13:44
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I did not spend much time on this issue but somehow I can confirm this "bug":

Originally Posted By: thread posted above
You're right, I removed the skin and multiplied the vertices and faces (to 55k). The model is now 3,6mb (mesh only, no skin) and the allocated memory in the task manager increases per new created entity by 3,6mb.


What should we expect from a new created entity? Is that behaviour correct?


"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: ent_create bug? [Re: jcl] #316213
03/22/10 13:53
03/22/10 13:53
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline OP
Expert
Slin  Offline OP
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Is the second paragraph meant serious?
I mean there are just about 2500 models created and in a "real world scenario" I would of course switch them all passable and hope that the engines LOD with an empty LOD step could handle the visibility and number of rendered polygons for me. Alternatively I could of course use fewer models and just place them dynamically in front of the camera, but hoped that the engine is able to handle this number of entities, without dynamic flag set, btw at a decent framerate if anyways only 4 of those meshes are rendered at once. My ground is a terrain and I plan to adjust the polygons positions to the terrains height in a shader using the heightmap I´ve got anyways, as tracing down would take forever and cause the need to use ent_clone, which makes the current problem even worse of course...

Re: ent_create bug? [Re: Slin] #316214
03/22/10 14:02
03/22/10 14:02
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
The A7 engine limit is about 500,000 entities.

Of course DirectX, the 3D hardware, and the physics engine have much lower limits for the number of collision bodies and the number of visible polygons.

Every entity requires 4 kB memory. More memory is needed only when necessary, f.i. for the bones tree when it uses bones animation, or for the physics model when it uses collision detection, and for the mesh when you clone it.

Just apply some common sense when working with extremely big levels. You can not put a level together from thousands of gigantic grass models. Modern engines have a terrain renderer for such purposes.

Re: ent_create bug? [Re: jcl] #316215
03/22/10 14:21
03/22/10 14:21
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline OP
Expert
Slin  Offline OP
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Ich erstelle aber ja weder 500000 noch 10000 Entities sondern lediglich 2500. Ich nutze kein ent_clone und setze sie auf PASSABLE nach dem ent_create (vorher geht schließlich schlecht). Bei den 2500*4kB plus die Größe von einmal dem Mesh und dem Skin sollte es dann doch keine Probleme geben. Mag ja sein, dass das alles so nicht sonderlich schnell ist, aber es sollte auch nicht unbedingt crashen... Und laut Taskmanager wächst der "Speicherverbrauch" mit jedem erstellten Mesh um ziemlich genau den Betrag, den die Modelldatei groß ist.

Dies crasht übrigens auch noch:
Code:
#include <acknex.h>
#include <default.c>

void main()
{
	level_load("");
	
	diag("\nlevel geladen");

	int x;
	for(x = 0; x < 1000; x++)
	{
		you = ent_create("grass.mdl", vector(0, 0, 0), NULL);
		set(you, PASSABLE);
	}

	diag("\nentities erstellt");
}



Und dies sagt die Acklog dazu:
Code:
Mouse found
Lautsprecher (High Definition Audio-Gerät) opened
NVIDIA GeForce 8800 GTS pure T&L device 1ff9 detected
D3D device NVIDIA GeForce 8800 GTS 1ff9 selected.
ent_blendframe: function not found
pan_setcolor: function not found
Running MAIN.EXE.
Main started at 0.072
D3D_Init Window: 720x480 -> Window: 1x720x480x32
Video memory found: 2398 MB
LevelInit at 0.118 0 lmaps 0 textures
Physics restarted...ok
LevelReady at 0.121
level geladen



Es crasht also noch bevor alle Entities erstellt sind.

Last edited by Slin; 03/22/10 14:40.
Re: ent_create bug? [Re: Slin] #316219
03/22/10 14:47
03/22/10 14:47
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Das ist natürlich ein berechtigter Einwand, aber in Ihrem Testprojekt war gar kein PASSABLE gesetzt. Wenn das Modell bereits erstellt wurde, ist es zu spät. Setzen Sie einfach enable_polycollision = 0 vor Erstellen der Modelle, danach wieder auf 1 setzen.
Code:
void main()
{
	max_entities = 10000;
	level_load("");
	enable_polycollision = 0;	
	int x;
	int y;
	for(x = -30000; x < 30000; x += 1431)
	{
		for(y = -30000; y < 30000; y += 1378)
		{
			ent_create("grass.mdl", vector(x, y, 60000), NULL);
		}
	}
	enable_polycollision = 1;
}



Re: ent_create bug? [Re: jcl] #316221
03/22/10 14:55
03/22/10 14:55
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline OP
Expert
Slin  Offline OP
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Vielen Dank, mehr wollte ich doch garnicht laugh

Page 1 of 2 1 2

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