Engine Limitations?

Started by bgilb, January 17, 2005, 09:35:54 PM

Previous topic - Next topic

bgilb

Im wondering why the maxtriangles for a Object3D exists, because it leaves me second guessing and having to use the max amount of triangles possible ( its somethign like 33,000 ) this seems like alot but im trying to make maps 512x512 tiles big. Now im not stupid and each tile isn't its own object3d.. instead i made each texture a object3d. Now is there anyway around this to allow me to have Much larger maps? the current limit only allows me 128x128 maps ( and at still very good FPS and such )

EgonOlsen

Which limit? You are giving the maximum number of triangles for an Object3D in the constructor, that's true. But what prevents you from creating an Object3D with let's say 100000 triangles? Or am i not understanding your question correctly?

bgilb

i get the error "OutOfMemory" sorry if i didnt say

EgonOlsen

That's not an engine limitation, it's caused by the fact that the JVM defaults to 64mb max. To change this, start your application with the additional command line switch "-Xmx128m" or "-Xmx256m" or whatever you prefer. The VM won't grab all that memory from the beginning, so don't worry.

bgilb

yeah i have no idea how to use command line stuff :O

EgonOlsen

How are you starting your application? From inside an IDE? Which one? In JBuilder for example, you can add additional command line parameters to the project. You just have to add that -Xmx128m there and you are done. In Eclipse or Netbeans, it should be similar.

bgilb

im using JCreator and i added it under project settings where it says Command: and it says invalid heap size

bgilb

well i fixed it by doing -Xmx1024m and it works but now it takes forever to load the map and every time i change the texture the rebuilding takes forever... right now for each texture its its own Object, would it be bad to make each tile its own object? sounds risky since that would be ( for the biggest map ) 65,000 objects

EgonOlsen

Maybe 1024m is a bit too much.... :?: It may take some time to create a 512*512 map. How much depends on what you are doing exactly. If you want, you can post some code of your map's creation and/or the texture modification code to see what happens there.

EgonOlsen

Quote from: "bgilb"right now for each texture its its own Object, would it be bad to make each tile its own object? sounds risky since that would be ( for the biggest map ) 65,000 objects
Yes, that's a very bad idea. Performance will go down to the cellar and memory usage up through the roof. Just don't do it!

bgilb

then what could i do besides rebuilding the mesh? is there way to add and delete polys on runtime?

EgonOlsen

It's not clear to me what you are trying to do. You are creating a tile base map, right? When and why are you rebuilding your map? What exactly do you mean by "rebuilding"? Calling rebuild() on the Object3d that is the map or recreating the map itself?

bgilb

its a mapeditor :O so im trying to be able to place tiles and such on he map ( changing its texture etc )

basically im trying to make a mapeditor like wc3

EgonOlsen

oookkkk...in that case, it's getting more complex. Recreating the object for every added/removed tile will most likely (as you've noticed) be too slow. I can think of two options: Split the map into strips (i.e. for a 512*512 map, that would be 512 strips and each one consists of 1024 triangles) and rebuild those or, if all you want to do is to modify the texture, use one large Object3D and use the PolygonManager it set the textures. It could be bit tricky to figure out which PolygonIDs refers to which tile, but it shouldn't be too difficult either. If you want to modify terrain height and such things, have a look at the GenericVertexController and the IVertexController interface. With them, it's possible to manipulate the geometry of a mesh after building it.

bgilb

damnit i wish i woulda saw this polygonmanager earlier!!! thank you egon!