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 - Kaiidyn

Pages: 1 2 [3] 4 5 ... 7
31
Support / Re: Out of memory
« on: February 25, 2011, 11:18:46 am »
If the preWarm() is only in the latest beta, then thats the one I'm using, as that does work..
I am in school right now, so cant check the polycount stuff yet, will do that when I get to my brother's place,
will be there around like.. I think that will be around 5pm..

32
Support / Re: Out of memory
« on: February 24, 2011, 11:23:57 pm »
Yea, I unzipped it renamed the file (back to) .ser, rezipped it to use in the same way as I did before...

Will try to get the poly count tomorrow..

33
Support / Re: Out of memory
« on: February 24, 2011, 10:08:05 pm »
Ok, Thanks for the object, really appreciate it.
About the polygon/vertex count.. how would I be able to get that? using the PolygonManager?

Edit: When loading your terrain object, it tells me it's an Unsupported version: 1347093252 and wont load.

34
Support / Re: Out of memory
« on: February 24, 2011, 09:51:23 pm »
I have been looking at that page before and well,
I really don't like blender, that just doesn't work for me at all.. (+ I cant design for shit =p even in 3dsmax7 back in the day)
Also, I am a Linux user, and those programs are for windows.

Maybe an unappropriated question but could I have the terrain that you used in An3DBenchXL? (at least for testing purposes)
Then I could focus more on the 'more important' stuff and add/change terrain, models etc later.

35
Support / Re: Out of memory
« on: February 24, 2011, 06:37:47 pm »
Yea, I was afraid of that....
I am using a 256x256 texture for heightmap and run it through Terragen, a Heightmap2Serialized object generator (based on wiki page Heightmap),
Maybe there are some modifications possible in the terrain generation there.
Then I scale the terrain object times 20 (terrain.setScale(20)).
Also when closing my game I run System.gc() in the Activity.onClose(), and it's required to wait for that to done before running game again without the error.

Maybe it is possible to 'stream' the terrain somehow?
Or only load x*x around the player into the memory, and as the player walks, unload the parts of the terrain that are not visible anyway..
Don't think that is easy to do, if at all possible.

36
Support / Re: Out of memory
« on: February 24, 2011, 04:45:00 pm »
The preWarm on the TextureManager fixed the first problem :)

Code: [Select]
public class Terrain {
private Object3D terrain = null;
private Texture terrainTexture = null;

public Terrain(World world){


if(terrainTexture == null){
terrainTexture = new Texture(Gameplay.resources.openRawResource(R.raw.terraintexture));
terrainTexture.enable4bpp(true);
}
if(!TextureManager.getInstance().containsTexture("terrainTexture"))
TextureManager.getInstance().addTexture("terrainTexture", terrainTexture);

TextureManager.getInstance().preWarm(Gameplay.render.frameBuffer);

ZipInputStream zis = new ZipInputStream(Gameplay.resources.openRawResource(R.raw.terrain));
try {
zis.getNextEntry();
} catch (IOException e) {
throw new RuntimeException(e);
}

if( (this.terrain == null) ){

this.terrain = Loader.loadSerializedObject(zis);
this.terrain.strip();
this.terrain.setScale(20);
this.terrain.setTexture("terrainTexture");
//F.tileTexture(terrain, 25);
this.terrain.forceGeometryIndices(true);
this.terrain.compile();
this.terrain.build();
world.addObject(this.terrain);

}else{
Log.e("Terrain already loaded..");
}

try {
zis.close();
zis = null;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void dispose(){
if(terrainTexture != null){ terrainTexture = null; }
if(terrain != null){ terrain = null; }
}
}
Do I still need to call terrain.compile() after terrain.forceGeometryIndices(true) ? (or before?)
And is this the proper way to use enable4bpp, as I assume the texture is already being loaded when initializing the terrainTexture variable, the enable4bpp will need to convert it to 4bpp which in turn will consume more memory (or cpu)

When I call onStop and dispose everything (or nullify) and restart the game, it is giving another out of memory error
Code: [Select]
ERROR/dalvikvm-heap(4283): 288000-byte external allocation too large for this process.
 FATAL EXCEPTION: GLThread 10
 java.lang.OutOfMemoryError
     at org.apache.harmony.luni.platform.OSMemory.malloc(Native Method)
     at org.apache.harmony.luni.platform.PlatformAddressFactory.alloc(PlatformAddressFactory.java:150)
     at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:66)
     at java.nio.ReadWriteDirectByteBuffer.<init>(ReadWriteDirectByteBuffer.java:51)
     at java.nio.BufferFactory.newDirectByteBuffer(BufferFactory.java:93)
     at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:68)
     at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:698)
     at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:136)
     at com.threed.jpct.World.compile(World.java:2037)
     at com.threed.jpct.World.renderScene(World.java:1087)
     at gp.itsolutions.Render.onDrawFrame(Render.java:86)
     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1332)
     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
Not sure what this means, or how to fix it.

Edit: It appears I start my game too fast after I shut it down, when I wait a couple of seconds it does work..  :D
edit2: It happens randomly now...  :-\

37
Support / Out of memory
« on: February 24, 2011, 02:41:09 pm »
I'm starting to get really frustrated with this error...

Code: [Select]
Out of memory on a 3527724-byte allocation.
 FATAL EXCEPTION: GLThread 9
 java.lang.OutOfMemoryError
     at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:93)
     at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:218)
     at com.threed.jpct.ZipHelper.unzip(ZipHelper.java:30)
     at com.threed.jpct.GLRenderer.convertTexture(GLRenderer.java:766)
     at com.threed.jpct.GLRenderer.setTextures(GLRenderer.java:2151)
     at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2064)
     at com.threed.jpct.World.draw(World.java:1341)
     at com.threed.jpct.World.draw(World.java:1122)
     at gp.itsolutions.Render.onDrawFrame(Render.java:87)
     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1332)
     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

I am rewriting and cleaning the code for what I have now in my mmo game (in a separate project)
and get this error when (I think) loading the terrain from zip file (as ZipHelper is mentioned in the error)
But the fact is, I did not change anything compared to my old code, except for the fact that I created a separate class for loading and disposing the terrain...

Terrain class:
Code: [Select]
public class Terrain {
private Object3D terrain = null;
private Texture terrainTexture = null;
private ZipInputStream zis = null;

public Terrain(World world){
try {

if(terrainTexture == null)
terrainTexture = new Texture(Gameplay.resources.openRawResource(R.raw.terraintexture));

if(!TextureManager.getInstance().containsTexture("terrainTexture"))
TextureManager.getInstance().addTexture("terrainTexture", terrainTexture);

if(zis == null){
zis = new ZipInputStream(Gameplay.resources.openRawResource(R.raw.terrain));
zis.getNextEntry();
}

if( (terrain == null) && (zis != null) ){

terrain = Loader.loadSerializedObject(zis);

terrain.setScale(20);
terrain.setTexture("terrainTexture");
//F.tileTexture(terrain, 25);
terrain.compile();
terrain.build();
world.addObject(terrain);

}

} catch (Exception e) {
e.printStackTrace();
}
}

public void dispose(){
if(terrainTexture != null){ terrainTexture = null; }
if(terrain != null){ terrain = null; }
if(zis != null){ try { zis.close(); } catch (IOException e) { } zis = null; }
}
}

I have tried several attempts to try and fix it, but I can't get the right one..
Figured a second pair of eyes might help..

38
Support / Re: Small Question
« on: February 24, 2011, 01:04:14 am »
Could you post some code ? Might help to show the problem better..

39
Support / Re: SkyBox missing feature?
« on: February 23, 2011, 01:43:04 pm »
I like shortcuts  ;D

Thanks anyway :)

Made myself a shortcut :)
Code: [Select]
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;

public class SkyBox {
private com.threed.jpct.util.SkyBox skyBox;
private TextureManager tm;
public SkyBox(float size){
TextureManager tm = TextureManager.getInstance();
tm.addTexture("front", new Texture(Gameplay.resources.openRawResource(R.raw.north)));
tm.addTexture("back", new Texture(Gameplay.resources.openRawResource(R.raw.south)));
tm.addTexture("left", new Texture(Gameplay.resources.openRawResource(R.raw.west)));
tm.addTexture("right", new Texture(Gameplay.resources.openRawResource(R.raw.east)));
tm.addTexture("up", new Texture(Gameplay.resources.openRawResource(R.raw.up)));
tm.addTexture("down", new Texture(Gameplay.resources.openRawResource(R.raw.down)));

skyBox = new com.threed.jpct.util.SkyBox("left","front","right","back","up","down", size);
}

public void render(World world, FrameBuffer fb){
skyBox.render(world, fb);
}

public void changeTextures(Texture front, Texture back, Texture left, Texture right, Texture up, Texture down){
tm.replaceTexture("front", front);
tm.replaceTexture("back", back);
tm.replaceTexture("left", left);
tm.replaceTexture("right", right);
tm.replaceTexture("up", up);
tm.replaceTexture("down", down);
}

}

40
Support / Re: SkyBox missing feature?
« on: February 23, 2011, 01:32:52 pm »
I see..
Isn't it more useful to use default texture when none is set, and be able to change them later (real-time)?
If it is at all possible..

41
Support / SkyBox missing feature?
« on: February 23, 2011, 11:36:53 am »
It is possible to initialize the skybox using
Code: [Select]
new SkyBox(1024);So without the textures,
However there is no way to set the textures at a later stadium.
At least, not that I could find.
Maybe add some functions like SkyBox.setNorth or SkyBox.setTextures(n, e, s, w) ?

42
Support / Re: Polygon picking?
« on: February 22, 2011, 11:30:23 am »
Finally figured it out.. Is is being done using Lerp

Code: [Select]
float speed = (0.5f * ticks);
float timeToGetThere = 1.0f / playerPos.distance(gotoPos) * speed;

playerPos = lerp(playerPos, gotoPos, timeToGetThere);
player.clearTranslation();
player.translate(playerPos);

Lerp function:
Code: [Select]
private SimpleVector lerp(SimpleVector start, SimpleVector end, double time){

float x = (float) (start.x + (end.x - start.x) * time);
float y = (float) (start.y + (end.y - start.y) * time);
float z = (float) (start.z + (end.z - start.z) * time);

return new SimpleVector(x, y, z);

}

What I still need though is to get the height based on terrain... at playerPos.x, playerPos.z

43
Support / Re: What does jPCT stand for?
« on: February 19, 2011, 10:46:53 pm »
Ahh, i see. Thats actually quite interesting... i stickied it for other people to read, hope you don't mind :)

44
Support / What does jPCT stand for?
« on: February 19, 2011, 07:23:39 pm »
Just wondering..

45
Support / Re: Polygon picking?
« on: February 19, 2011, 04:39:09 pm »
I still dont got this 'waling towards' a vector to work.
and have no clue on how to do this ..  :( would prefer an example ... :)

Pages: 1 2 [3] 4 5 ... 7