www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: bgilb on January 17, 2005, 09:35:54 pm

Title: Engine Limitations?
Post by: bgilb on January 17, 2005, 09:35:54 pm
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 )
Title: Engine Limitations?
Post by: EgonOlsen on January 17, 2005, 10:11:17 pm
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?
Title: Engine Limitations?
Post by: bgilb on January 17, 2005, 11:08:52 pm
i get the error "OutOfMemory" sorry if i didnt say
Title: Engine Limitations?
Post by: EgonOlsen on January 17, 2005, 11:14:37 pm
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.
Title: Engine Limitations?
Post by: bgilb on January 17, 2005, 11:27:34 pm
yeah i have no idea how to use command line stuff :O
Title: Engine Limitations?
Post by: EgonOlsen on January 17, 2005, 11:29:51 pm
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.
Title: Engine Limitations?
Post by: bgilb on January 17, 2005, 11:32:57 pm
im using JCreator and i added it under project settings where it says Command: and it says invalid heap size
Title: Engine Limitations?
Post by: bgilb on January 17, 2005, 11:40:57 pm
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
Title: Engine Limitations?
Post by: EgonOlsen on January 17, 2005, 11:45:05 pm
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.
Title: Engine Limitations?
Post by: EgonOlsen on January 17, 2005, 11:46:39 pm
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!
Title: Engine Limitations?
Post by: bgilb on January 18, 2005, 12:15:51 am
then what could i do besides rebuilding the mesh? is there way to add and delete polys on runtime?
Title: Engine Limitations?
Post by: EgonOlsen on January 18, 2005, 12:19:45 am
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?
Title: Engine Limitations?
Post by: bgilb on January 18, 2005, 12:30:22 am
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
Title: Engine Limitations?
Post by: EgonOlsen on January 18, 2005, 12:50:20 am
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.
Title: Engine Limitations?
Post by: bgilb on January 18, 2005, 01:09:16 am
damnit i wish i woulda saw this polygonmanager earlier!!! thank you egon!
Title: Engine Limitations?
Post by: bgilb on January 18, 2005, 11:02:01 pm
quick question .. how do i enable Opengl properly? It seems the way im doing it isnt working because i dont get any fps gain at all, heres what i call:

Code: [Select]

buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE, IRenderer.MODE_OPENGL);
buffer.usesRenderer(IRenderer.RENDERER_OPENGL);
Title: Engine Limitations?
Post by: EgonOlsen on January 18, 2005, 11:36:54 pm
Try:
Code: [Select]
 
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);


But be sure that your current FrameBuffer size is supported by your hardware. That not  important in software, but it is in OpenGL.
Title: Engine Limitations?
Post by: Anonymous on January 19, 2005, 12:02:27 am
okay i tried that, it half worked but i get the runtime error "PixelFormat" and then i tried importing the lwjgl library but then it said "Unsatisfied link error"
Title: Engine Limitations?
Post by: EgonOlsen on January 19, 2005, 12:37:09 am
You have to set both, the jar and the dll (assuming that you are using Windows). The dll is set by setting the library.path (similar to the -Xmx stuff before) to the directory where the dll is stored. Have a look at the examples' batchfiles that come with jPCT to see how to set the library.path correctly.
Title: Engine Limitations?
Post by: bgilb on January 19, 2005, 09:54:04 pm
it almost works, it just creates 2 windows now ( one thats empty but still has action listiner for mouse ) and then the graphics are in the new window ..
Title: Engine Limitations?
Post by: EgonOlsen on January 20, 2005, 12:30:25 am
jPCT doesn't create a window for you in software mode, but it has to in hardware mode. Simply because the used OpenGL binding can render into its own window only. The second window must be opened by your application. Just don't do that and use the lwjgl window instead. You can't use mouse or keylisteners on this one though. You have to use the means that lwjgl provides for keyboard and mouse or use the KeyMapper from jpct.util.