3000 moving objects? No problem!

Posted By: Superku

3000 moving objects? No problem! - 02/24/11 01:42

I've made a quick test with 3000 moving objects (primitives without skin, I know), they don't use collision detection but adopt nicely and smoothly to the terrain:



Download source code with example here!

Instead of c_trace I interpolate between the 4 surrounding terrain vertices. The manual suggests you could use ent_getvertex and ent_nextvertex but that alone results in choppy movement.
The download includes two examples, 'level.c' and 'level_optimized.c' (all entity movement in one loop). With the latter file I only have 2.3ms script execution time on my 4-year-old notebook which I think is a pretty nice result.
Have fun experimenting with it (if you like to)! If you don't know how to use the height interpolation in your code, a game with a smaller scale is probably the better choice for you.

(Can be moved to User Contributions.)
Posted By: Widi

Re: 3000 moving objects? No problem! - 02/24/11 02:51

Jede Woche was neues von dir. Glaube du hast einfach zu viel Zeit wink

Have 56 fps on my laptop, nice. (2.0ms for functions)
Good idea with the interpolation, thanks.
Posted By: JibbSmart

Re: 3000 moving objects? No problem! - 02/24/11 02:52

Brilliant! That's efficiency right there. Now please remake Age of Empires II in 3D with a higher unit cap laugh

kthxbye

Jibb

EDIT: PS: I played with the numbers a bit and got about 7500 entities before the frame rate started to slip below 60 (Core i7 950 CPU)
Posted By: Anonymous

Re: 3000 moving objects? No problem! - 02/24/11 05:01

Ohne Collision und bei geringer Polygonzahl ist das kein Wunder.
Dachte, dass währe bekannt...
Posted By: gri

Re: 3000 moving objects? No problem! - 02/24/11 08:52



funny stuff......arggggg threre are thousands of ants grin

1.3ms & 60fps on 2 year old lappy
Posted By: 3run

Re: 3000 moving objects? No problem! - 02/24/11 09:04

This is incredible laugh
Posted By: SchokoKeks

Re: 3000 moving objects? No problem! - 02/24/11 11:27

Its a very useful contribution! Until now, I've always used trace for such movement. Now I can just take a look at your sourcecode and don't have to experiment with getvertex etc.

Thanks a lot!
Posted By: Superku

Re: 3000 moving objects? No problem! - 02/24/11 14:26

Thanks!

Quote:
Ohne Collision und bei geringer Polygonzahl ist das kein Wunder.
Dachte, dass währe bekannt...

Versuch es und benutze c_trace, um die Höhe über dem Terrain zu bekommen. Dann verbrauchen 100 Entities sicherlich die gleichen CPU-Ressourcen.
Und was hat die Polygonzahl überhaupt damit zu tun? Ich glaube, du hast überhaupt nicht verstanden, worum es hierbei geht.
Posted By: xxxxxxx

Re: 3000 moving objects? No problem! - 02/24/11 14:29

when i was looking on the objekts(ca. 9000) i got 37 fps when not i dad 75-70 fps! i dont know why the simple objekts slow down the grafiks(even with 4 poly models)!
xxxxxxx
Posted By: JibbSmart

Re: 3000 moving objects? No problem! - 02/24/11 14:32

9000 draw calls.

Jibb
Posted By: Tobias

Re: 3000 moving objects? No problem! - 02/24/11 14:42

This is a cool demo!

I found that I can use more complex models without much frame rate loss. Only when the models get a bigger size, the frame rate gets down, probably because more pixels are drawn.
Posted By: Inestical

Re: 3000 moving objects? No problem! - 02/24/11 15:01

I get steady 50fps and 2.1ms with 4000 entities on my PC laugh
Posted By: FBL

Re: 3000 moving objects? No problem! - 02/24/11 16:36

17k entities with multiple skins but simple meshes, dynamic flag REset, no movement attached.... 4 fps. That's awfully slow.
Posted By: Hummel

Re: 3000 moving objects? No problem! - 02/24/11 16:57

no instancing is the simple reason
Posted By: FBL

Re: 3000 moving objects? No problem! - 02/24/11 17:02

17k entities where around 16k are unique.
Posted By: JibbSmart

Re: 3000 moving objects? No problem! - 02/24/11 17:08

I'm curious as to what kind of situation you'd need 16k unique entities on-screen.

Jibb
Posted By: FBL

Re: 3000 moving objects? No problem! - 02/24/11 17:43

Mesh generation algorithms.
Posted By: JibbSmart

Re: 3000 moving objects? No problem! - 02/24/11 17:49

If most of them are unique and they're generated by code, couldn't you put a lot of them into a single mesh?

And mesh generation is kinda vague... why do you need so many unique meshes on-screen?

I would've assumed it was related to A3, but I wouldn't have thought any A3 projects would be that complex.

Jibb
Posted By: FBL

Re: 3000 moving objects? No problem! - 02/24/11 17:53

It is related to A3 and complex is relative.

They region concept of a raycaster just is not as simple to handle. If you remove lighting completely, then meshes can be merged, otherwise it gets really tricky and you'd have to fix that via some complex mechanism to split material definitions into many other materials in order to get the lighting effect.

And you lose the feature to modify single regions as it was possible in A3.

But... different topic.
Posted By: JibbSmart

Re: 3000 moving objects? No problem! - 02/24/11 18:05

I'll take your word for it.

(sorry Superku for going offtopic)

Jibb
Posted By: bart_the_13th

Re: 3000 moving objects? No problem! - 03/07/11 01:48

Cool, running 30fps with 5000 objects in my PC. I dont know if I will put 5000 objects on my terrain but, the idea is just really good.
© 2024 lite-C Forums