Author Topic: Engine Limitations?  (Read 13469 times)

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« 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 )

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Engine Limitations?
« Reply #1 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?

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« Reply #2 on: January 17, 2005, 11:08:52 pm »
i get the error "OutOfMemory" sorry if i didnt say

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Engine Limitations?
« Reply #3 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.

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« Reply #4 on: January 17, 2005, 11:27:34 pm »
yeah i have no idea how to use command line stuff :O

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Engine Limitations?
« Reply #5 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.

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« Reply #6 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

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« Reply #7 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Engine Limitations?
« Reply #8 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Engine Limitations?
« Reply #9 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!

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« Reply #10 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Engine Limitations?
« Reply #11 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?

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« Reply #12 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Engine Limitations?
« Reply #13 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.

Offline bgilb

  • byte
  • *
  • Posts: 21
    • View Profile
Engine Limitations?
« Reply #14 on: January 18, 2005, 01:09:16 am »
damnit i wish i woulda saw this polygonmanager earlier!!! thank you egon!