简体   繁体   中英

Java 3D object management design

LS

For a small project I am creating a mincraft like 3D environment with a little more details. But one thing I noticed is that dynamic object creation has a heavy impact on the performance. So I was wondering, how does other games of 3D apps do this?

I was thinking about create all the objects before the app starts, but I soon discovered that this has a huge memory impact. Are there other technics, like deep cloning or should I build an object warehouse to reuse? Or are the other ways I did think about?

I'm curious how this is done.

Re-use the objects as much as possible. Render only the parts that are necessary and don't store any objects that you think might be used for future rendering.

Use images where ever you can to replace custom shape objects/models. Images and axes transformations are your best buddies. Serialize the objects if you think is necessary but it will affect the performance. Scene Graph branches must be reused if the relative position remains unchanged. You can always trade off load time for a good game play performance.

For reference see, performance guide on Java 3D . Some tips from there you can apply in general and are not just specific to Java 3D.

I followed the advice. And build a kind of object storage to reuse graphical objects. That seems to give it a better performance. To increase the perfomance I build some logic to limit the collision objects to objects nearby. Using images however is stil a little difficult in a minecraft like world.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM