Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - say-V

Pages: [1]
Support / Re: JPCT works int Android 3.x??
« on: October 28, 2011, 11:45:29 pm »
But, the real interessting question "Will it work with 4.0?"  --> just kidding, i'm sorry  ;)
I'm looking already forward to try it on my future new Galaxy Nexus (or Nexus Prime which is a thousand times better name) ...

Support / How does a 'good' architecture for a jPCT-AE project look like?
« on: October 27, 2011, 11:47:01 am »

I develop kind of a realtime game for Android with jPCT-AE and after my project gets bigger and bigger I am very concerned about how I should partition my code. I know this is kind of a big question, but maybe there is somebody around that already did some big jPCT-AE projects and is willing to post some advices how to engineer the code/classes best. I think a lot of people would be gracefull for that.

Some words on my situation. I use a class that implements the android.opengl.GLSurfaceView.Renderer interface. In the onSurfaceCreated() method I create all my objects and world and stuff. This are already around 300 lines and it is very unclear. First I also had navigation code in this class. But after it gots soo big, I created a new class that implements Thread where I put all navigation things. But now I have a lot of cross-references and I have problems to synchronize both threads. In short, it's all a mess. No way to even think about putting something open source in this state.

I'm exited for your tipps, and thanks in advance!

Bugs / Re: Config.maxTextures doesn't work as assumed
« on: October 27, 2011, 11:29:07 am »
Exactly, I do it in another thread. I think that also causes the flickering I have sometimes. It sounds similar like this topic. Maybe this is also a multi-threading realted problem.
My player consists of more objects and when I move him around in navigation thread, it happens that one object is already further than the others. (My workaround was that I found the mergeObjects() method  ;) )

I read a lot in the board now, and I you mentioned sometimes that jPCT-AE is not thread safe. What does this exactly mean? I saw a video from Google IO, they mentioned that it is wise isolate navigation and game logic in different threads than rendering. After my classes got bigger and bigger I tried this approach also. It works quite well beside the problems I have already mentioned. Next I tried to synchronize the move() method of navigation thread with the onDrawFrame() method of rendering thread. I thought this should help, but it didn't work, the navigation thread was blocked forever. Beside I think I get much overhead through syncronizing all this stuff in the end. Now I'm thinking of merging all in one thread/class again.

I know this doesn't fit to this thread-topic anymore, but could you (or someone professional else) give an advice how a good architecture could look like for a (big) jPCT-AE realtime project? This would be simply awesome  :) !

Edit: I started a new topic on that one.

Bugs / Re: Config.maxTextures doesn't work as assumed
« on: October 26, 2011, 02:12:52 pm »
No, I'm sorry, I can't. I don't know what happend, I can not verify the problem myself either today. But I was conscious yesterday and I'm sure the Exception happened. I used Config.getVersion() to verify the version and it was 1.24 after updating the .jar file.

Now I set Config.maxTextures = 20; and I tried to add up to 200 textures with no problem at all, sick. The value of Config.maxTextures never changes during this process.

I will come back to that in case I find out anything. Thanks!

Bugs / Re: Config.maxTextures doesn't work as assumed
« on: October 25, 2011, 06:29:44 pm »
A side note: in the meantime I tried to use Config.maxTextures = Integer.maxValue; but this approach failed already on launching because it seems that an array with length Config.maxTextures is allocated by TextureManager. So using big values for this variable is really not a good idea.

I'm using 1.24 now and it works almost perfect. But when I set eg. Config.maxTextures = 10; and I add more than 10 textures I don't get a error from the texture manager anymore, but instead an ArrayIndexOutOfBoundsException from runtime directly. Maybe you want to fix that.

replaceTexture() -> thanks for the tipp!

Bugs / Config.maxTextures doesn't work as assumed
« on: October 25, 2011, 04:19:42 pm »
By default Conf.maxTextures = 64 that's clear. But I assumed this means that there can not be more textures than 64 at a time, but sure can be more in the whole lifecycle of the app. In my case I use a lot of textures, but not at a time, I also unload and remove old textures that I don't need anymore. I have never more than ~30 textures in use at a time, but nevertheless after some time I get an error.
ERROR: Too many textures added to the TextureManager. Adjust Config.maxTextures!

Pseudo-Code for testing:
Code: [Select]
for i = 0 ... 100
   textureName = "label" + i
   textureManager.addTexture(textureName, createTextureFromString(textureName)
   testPlane.setTexture(textureName)  // so it gets uploaded to GPU
   if (i >= 30) {
      textureManager.removeAndUnload("label" + (i - 30), fb)  // should remove and unload from GPU and TextureManager
end for

Of course I could increase Conf.maxTextures. But that doesn't change the root problem, so I thought I post it.

The manager wil increase the value if needed
there is a spelling mistake (and I think the manager doesn't increase the value, otherwise there would be no error I assume).

I'm already looking forward to finish my project and post it here on the board  :D
jPCT-AE is a great engine!!!

Pages: [1]