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

Pages: 1 [2]
16
Bugs / Re: Fogging problems
« on: June 12, 2012, 09:31:32 am »
I'm using OpenGL 2.0

...it was REALLY hard to get the logs, lol. I had to remove the 80,000 limit and be quick on the pause button. Even still, they are pretty lengthy.

Loga: Starts as soon as I clicked the button to go to the game play and paused after the first image was visible.
Logb: (cleared the first log first). Touched the screen which re-enabled the fogging, then paused it after the image what changed.

I haven't tried anything besides using "world.setFogParameters(20, 60, 0, 0, 0);". I didn't feel a fog of other than black would look good.

[attachment deleted by admin]

17
Bugs / Fogging problems
« on: June 12, 2012, 08:10:54 am »
I think this is a bug because it happens without any apparent logic.
In the game play part of my game, I have the game objects rendered in one world and the hud objects rendered in another world (so they would stay static while the rest of the game move). The game objects have transparency, while the hud objects don't.

On the first render frame, it renders the scene for both worlds and then draws the worlds (game then hud), but it's not displaying the fog on the game play's world objects. When I disable the rendering/ drawing of the hud world, the first render has the fog enabled.
With the hud world enabled and the scene incorrectly displaying, after touching the screen, the fog re-enables.

I tried using the framebuffer's clearZBufferOnly() before the hud's render/ draw line, but that didn't do anything. Then I played with some code which would render/ draw the worlds twice on only the first render frame, but that also did nothing. I also tried to disable the fog in the HUD's world (not sure how that would be helped)....but it also didn't do anything. Lastly, I disabled all the lighting in the HUD's world, both ambient light and any other lights added to the world, but the only thing that did was make the hud objects black.

= Gameplay code
Code: [Select]
boolean firstR = true;
public void Render(FrameBuffer fb)
{
/*
if(firstR)
{// attempted fix, which does nothing
world.renderScene(fb);
world.draw(fb);
fb.clearZBufferOnly();

hud.Render(fb);
}
*/

if((Touching || resetting) || firstR)
world.renderScene(fb);
firstR = false;

world.draw(fb);
//fb.clearZBufferOnly();
hud.Render(fb);
}


= HUD render code
Code: [Select]
private boolean render = true;
void Render(FrameBuffer fb)
{
if(render)
world.renderScene(fb);
render = false;

world.draw(fb);
}



Note: the renderScenes are linked to bool requirements so the worlds won't be needlessly rendering every frame (it made my phone hot and the fps slow).


The HUD currently only has 1 thing, which is the bottom left

= Pre-touch


= Post-touch (ignore the half-lighted/half-darked block, the picture was taken between render frames)

18
Support / Re: Generating images from a template
« on: June 09, 2012, 01:26:16 am »
I used the adjusted code you recommended and it cut the loading time for each picture in half (50 - 60% increase in speed). And I didn't even touch the image sizes.

...You've amazed me again with your skills and knowledge. When I get to a presentable release, I'll add the game to the projects part of this forum  ;D.

19
Support / Re: Generating images from a template
« on: June 08, 2012, 11:35:48 pm »
Thanks, I'll try the updated code now (and I'll see if I can reduce the image to 128x128 without degrading the quality too much)

I had the Color.x() calls because I thought they were just straight calls to the needed functions. The javadoc in the descriptions said "This is the same as saying (color >> 16) & 0xFF", but I guess removing the middleman code wouldn't hurt. :-)

20
Support / Re: Generating images from a template
« on: June 08, 2012, 10:57:37 pm »
Currently it's happening at start-up time, but after all of the images are loaded up, it would take about 15 MBs. (2-5 Kb per picture * 6-120 permutations per image) * 40 images.

If it would be possible to change the colors during the render (on the gpu?) without slowing down the fps too much, I'd be willing to switch to that method.

21
Support / Re: Generating images from a template
« on: June 08, 2012, 10:40:10 pm »
The code you provided makes sense, but it's only applying the image, not changing it. Applying the int[] to a bitmap then the bitmap to the texture doesn't seem to take much time.
The code you mentioned would still be using majority of the code I provided except for 3 lines.

What I'm trying to do is use the data from the template to determine how to change the new picture.
In the attached images, the all green one would become the colored one (through the code I provided), then use that image in the game. So each template would produce about 20 different permutations of the colored image (using 6 different colors).

I thought about making an int[] for all the colors in the template which match each criteria (red 20 for example), mark each place with a 1, then when the part needs to be colored, multiply the array values by the ARGB int and add the results to a new array (along with the other sections which were previously added). But I suspect this would just add more memory overhead and not much performance increase.

22
Support / Generating images from a template
« on: June 08, 2012, 11:27:25 am »
I tried looking through the forum and Javadoc for something which would do this, but I haven't came back with much luck. What I'm trying to do is generate new pictures from a template image, which would reduce the need to package the game with multiple images.

Each template image is a 256x256 nodpi png in an 8-bit format. Currently what I'm doing is converting the template image into int[] "done once per game start", create a new int[] of the same size, test each pixel if it matches a list of values, then change that pixel to another pixel color (in the new int[]). Then when the new int[] is finished, its made into a ARGB_8888 bitmap which it loaded into the TextureManager.

Example: change all the pixels which have a red channel of 20 into a ARGB of 200:128:0:128 (purple with a transparency of 200, change all the pixels with an red channel of 40 into an ARGB of 200:255:0:0. Every other pixel is copied as is.

The method I have now works, but it takes about 3-4 second per image (good thing they are all done in threads). The problem is that the whole bulk of them are created each time the game starts (and oddly when the phone resumes from standby). I was thinking about using the ITextureEffect, but I'm still not sure how to use it.

Is there another method of doing this or a tutorial of how ITextureEffect works? Majority of the new images won't change, but I would want to have some of the images animated eventually (using the same color scheme).


= Current code to generate the images =
Code: [Select]
private void MakeImage(Panel data, int[] pcolors)
{
if(tm.containsTexture(data.Name))
return;

if(!rawBmp.containsKey(data.ImageAttribute.Location))
return;// if the template image was not able to be added, then skip making this image

Bitmap nBit = Bitmap.createBitmap(adjust(data.ImageAttribute.Location, pcolors), 256, 256, Config.ARGB_8888);
tm.addTexture(data.Name, new Texture(nBit, true));
nBit.recycle();
       
data.TexHandle = tm.getTextureID(data.Name);
data.Colors = pcolors;
panels.put(data.Name, data);
}

private int[] adjust(String d, int[] pcolors)
{   
if(pcolors == null)
return rawBmp.get(d);

    int cID = -1;
    int toColor = 0;
    int nPixel = 0;
   
    int[] nPanel = new int[256*256];
   
    for(int p = 0; p < rawBmp.get(d).length; p++)
    {
        nPixel = rawBmp.get(d)[p];
        nPanel[p] = nPixel;
       
        cID = match(nPixel);
       
        if(cID > -1 && cID < pcolors.length)
        {
        toColor = Color.argb(Color.green(nPixel), Color.red(Colors[pcolors[cID]]), Color.green(Colors[pcolors[cID]]), Color.blue(Colors[pcolors[cID]]));
        nPanel[p] = toColor;
        }
       
        if(cID == -2)
        {
        toColor = Color.argb(Color.green(nPixel), 100, 100, 100);
        nPanel[p] = toColor;
        }
    }
   
    return nPanel;
}

private int match(int pixel)
{
switch(Color.red(pixel))
{
case 0:
return -2;
case 20:
return 0;
case 40:
return 1;
case 60:
return 2;
case 80:
return 3;
case 100:
return 4;
}

return -1;
}

23
Support / Re: Faster Render by using the same object?
« on: June 01, 2012, 07:21:24 am »
Sorry about the delay, I had class today and other things on the todo list. I just tried the beta version you recommended and it made a dramatic improvement. The game is now running at 16 fps :-D.

Btw, why is that version still in beta if it's running so smoothly? And would it be stable enough for me to release the game with it? (It's still in the alpha phase right now).

24
Support / Re: Faster Render by using the same object?
« on: May 31, 2012, 08:21:47 pm »
2.3.6, kernel 2.6.36.3.

I haven't done anything with it (modding wise) yet, been too busy programming, lol.

25
Support / Re: Faster Render by using the same object?
« on: May 31, 2012, 07:47:19 pm »
I'm using the 1.24 version, but I'll try the beta after this reply.

The reason I can't merge the objects is because the blocks which are on the wheels change during game play. The most I could merge the objects is by attaching the block bottoms to the side of the blocks. But the transparency parts of the blocks must stay as their own objects because of how often it'll be changed and how many different ways it can be changed.

I'll also try merging the bottoms to the sides and see if that fixes anything.

26
Support / Re: Faster Render by using the same object?
« on: May 31, 2012, 09:20:51 am »
I'm running the game on the Samsung Captivate Glide, which has a "1Ghz Dual-core Nvidia Tegra 2 AP20H Processor". It's a non-rooted phone (in case that matters).

I'll try the suggestion now and see what happens.


Edit:
I have no clue how/ why this happened, but after I added in some code to test how long it would take for the first frame to be rendered...my fps dropped to 7.3 fps.
As for the advice you gave, it dropped the time needed to render the first frame from 5.3026 seconds to 3.5209 seconds. The fps was unaffected.

27
Support / Faster Render by using the same object?
« on: May 31, 2012, 03:57:43 am »
Currently my scene has 222 visible objects (1,296 faces). 37 of the objects (216 faces out of the 1,296) are unique, the rest are copies from the original, but translated 10 points to the left. In each group of 37 objects, 24 of the faces are using transparent textures.

The world has 2 lights (ambient + 1 light with low intensity) right now, and I don't yet see a need to add any more lights

= Object breakdown
- 12 objects (2 faces each), transparency enabled
- 12 objects (12 faces each), no transparency
- 12 objects (2 faces each), no transparency
- 1 object (24 faces), no transparency


When running the game, I get an average of 10 fps. The sections of the program which use the most cpu are:
World.renderScene (@ 57.1%)
- Object3D.transformVerticies (@ 46.8%)
- Object3D.render (@ 41.3%)
- VisList.sort (@ 10.1%)

World.draw (@40.5%)
- GLRender.drawVertexArray (@ 100%)

note: All of those classes are from the engine


My question is, instead of creating all 222 objects, I just create the 37 objects. Then each time the scene needs to be rendered, it's moved to the leftmost visible object spot, textures are applied, render to framebuffer, move 10 to the right, re-texture, render again, and repeat till the object is out of the camera view. Or would this just lower the memory requirement and keep the cpu still at a high (or higher) amount?

I can not merge the objects into 1 whole object, because I would lose the object names (assumed). The names are needed so the 3 groups of 12 objects can have their textures changed dynamically during game play.


Attached is an image of what the objects look like. All of the per-object details have been stripped for the example image, the framerate is still the same though.

28
Support / Re: Obj name change
« on: May 28, 2012, 11:09:38 pm »
The file was saved in 3DS max 2012 with the "None" preset, and it still caused problems. I'm going to try the 3ds format instead and see if that makes anything better. Here is the obj file which I'm using.


Edit: the 3ds file works better, in that the names are preserved, but it still tacks on the "_jPCT-#" thing at the end :-/.
Also, in the obj file (and it seems in the 3ds file too), that normals are saved along with the object. Is there a way to not calculate the normals for each object while it's being built? It seems like a waste of time.

[attachment deleted by admin]

29
Support / Re: Obj name change
« on: May 28, 2012, 01:37:43 am »
That would return a string containing nothing.
Quote
rather than returning the name "Block_4", it would return "_jPCT17". Only the first loaded object in the Obj has a correctish name, it return the object's name plus "_jPCT-2", so it reads "HubSides_jPCT-2".

Edit: Log from loading the object
Quote
05-27 15:25:14.329: I/jPCT-AE(22470): Loading file from InputStream
05-27 15:25:14.339: I/jPCT-AE(22470): Text file from InputStream loaded...34718 bytes
05-27 15:25:14.369: I/jPCT-AE(22470): Processing object from OBJ-file: HubSides
05-27 15:25:14.389: I/jPCT-AE(22470): Object 'HubSides_jPCT-2' created using 24 polygons and 26 vertices.
05-27 15:25:14.389: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.399: I/jPCT-AE(22470): Object '_jPCT-1' created using 2 polygons and 4 vertices.
05-27 15:25:14.399: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.409: I/jPCT-AE(22470): Object '_jPCT0' created using 12 polygons and 16 vertices.
05-27 15:25:14.409: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.409: I/jPCT-AE(22470): Object '_jPCT1' created using 2 polygons and 4 vertices.
05-27 15:25:14.409: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.429: I/jPCT-AE(22470): Object '_jPCT2' created using 2 polygons and 4 vertices.
05-27 15:25:14.429: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.439: I/jPCT-AE(22470): Object '_jPCT3' created using 12 polygons and 14 vertices.
05-27 15:25:14.439: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.439: I/jPCT-AE(22470): Object '_jPCT4' created using 2 polygons and 4 vertices.
05-27 15:25:14.439: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.449: I/jPCT-AE(22470): Object '_jPCT5' created using 2 polygons and 4 vertices.
05-27 15:25:14.449: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.459: I/jPCT-AE(22470): Object '_jPCT6' created using 12 polygons and 11 vertices.
05-27 15:25:14.459: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.459: I/jPCT-AE(22470): Object '_jPCT7' created using 2 polygons and 4 vertices.
05-27 15:25:14.459: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.469: I/jPCT-AE(22470): Object '_jPCT8' created using 2 polygons and 4 vertices.
05-27 15:25:14.469: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.479: I/jPCT-AE(22470): Object '_jPCT9' created using 12 polygons and 16 vertices.
05-27 15:25:14.479: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.479: I/jPCT-AE(22470): Object '_jPCT10' created using 2 polygons and 4 vertices.
05-27 15:25:14.479: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.489: I/jPCT-AE(22470): Object '_jPCT11' created using 2 polygons and 4 vertices.
05-27 15:25:14.489: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.499: I/jPCT-AE(22470): Object '_jPCT12' created using 12 polygons and 14 vertices.
05-27 15:25:14.499: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.499: I/jPCT-AE(22470): Object '_jPCT13' created using 2 polygons and 4 vertices.
05-27 15:25:14.499: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.509: I/jPCT-AE(22470): Object '_jPCT14' created using 2 polygons and 4 vertices.
05-27 15:25:14.509: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.509: I/jPCT-AE(22470): Object '_jPCT15' created using 12 polygons and 13 vertices.
05-27 15:25:14.509: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.519: I/jPCT-AE(22470): Object '_jPCT16' created using 2 polygons and 4 vertices.
05-27 15:25:14.519: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.519: I/jPCT-AE(22470): Object '_jPCT17' created using 2 polygons and 4 vertices.
05-27 15:25:14.519: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.519: I/jPCT-AE(22470): Object '_jPCT18' created using 12 polygons and 12 vertices.
05-27 15:25:14.519: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.529: I/jPCT-AE(22470): Object '_jPCT19' created using 2 polygons and 4 vertices.
05-27 15:25:14.529: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.529: I/jPCT-AE(22470): Object '_jPCT20' created using 2 polygons and 4 vertices.
05-27 15:25:14.529: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.539: I/jPCT-AE(22470): Object '_jPCT21' created using 12 polygons and 14 vertices.
05-27 15:25:14.539: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.539: I/jPCT-AE(22470): Object '_jPCT22' created using 12 polygons and 14 vertices.
05-27 15:25:14.539: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.539: I/jPCT-AE(22470): Object '_jPCT23' created using 2 polygons and 4 vertices.
05-27 15:25:14.539: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.549: I/jPCT-AE(22470): Object '_jPCT24' created using 12 polygons and 13 vertices.
05-27 15:25:14.549: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.549: I/jPCT-AE(22470): Object '_jPCT25' created using 2 polygons and 4 vertices.
05-27 15:25:14.549: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.549: I/jPCT-AE(22470): Object '_jPCT26' created using 2 polygons and 4 vertices.
05-27 15:25:14.549: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.549: I/jPCT-AE(22470): Object '_jPCT27' created using 12 polygons and 12 vertices.
05-27 15:25:14.549: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.549: I/jPCT-AE(22470): Object '_jPCT28' created using 2 polygons and 4 vertices.
05-27 15:25:14.559: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.559: I/jPCT-AE(22470): Object '_jPCT29' created using 2 polygons and 4 vertices.
05-27 15:25:14.559: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.559: I/jPCT-AE(22470): Object '_jPCT30' created using 12 polygons and 14 vertices.
05-27 15:25:14.559: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.559: I/jPCT-AE(22470): Object '_jPCT31' created using 2 polygons and 4 vertices.
05-27 15:25:14.559: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.569: I/jPCT-AE(22470): Object '_jPCT32' created using 2 polygons and 4 vertices.
05-27 15:25:14.569: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.569: I/jPCT-AE(22470): Object '_jPCT33' created using 12 polygons and 11 vertices.
05-27 15:25:14.569: I/jPCT-AE(22470): Processing object from OBJ-file:
05-27 15:25:14.569: I/jPCT-AE(22470): Object '_jPCT34' created using 2 polygons and 4 vertices.

30
Support / Obj name change
« on: May 27, 2012, 11:02:35 am »
Previously I was loading each model as it's own obj file, attaching that model to a parent Object3D, then access each needed object3D through though a series of class calls. The sub-object was in it's own class, and the parent had an array of the child classes....it was taking up too much space and the subclass was easily able to be knocked out since the parent always contains the same number of children.

So, I made a new object with the children already attached. Each object has it's own name and is numbered incrementally. To access the 4th block element, I would use hub[10].getName() and it would be "Block_4".

...here is where my problem comes in, rather than returning the name "Block_4", it would return "_jPCT17". Only the first loaded object in the Obj has a correctish name, it return the object's name plus "_jPCT-2", so it reads "HubSides_jPCT-2".

Is there a way to load the obj file and keep each object's name? The objects are labeled: "HubSides", "Front_" + (1 - 12), "Sides_" + (1 - 12), and "Back_" + (1 - 12).

Pages: 1 [2]