Vermeer
|
 |
«
Reply #30 - Posted
2013-03-17 19:46:51 » |
|
 Im always forgetting to turn laptop on at the wall!
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #31 - Posted
2013-03-18 04:09:13 » |
|
NOOOOOO!!!
You put ALL the cubes in ONE VBO. (Per chunk)
|
|
|
|
Vermeer
|
 |
«
Reply #32 - Posted
2013-03-18 16:14:10 » |
|
NOOOOOO!!!
You put ALL the cubes in ONE VBO. (Per chunk)
Thank you, that does improve things a lot  Next step: to precauculate the drawing of only the needed faces (ie not faces of adjacent cubes). The tread has also been moved to a more suitable place, and Im going to have a good read at what everyone else is doing in this catagory - so thank you for all help.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Vermeer
|
 |
«
Reply #33 - Posted
2013-03-18 20:37:34 » |
|
Going to start working on making it work as a game again now... this is where im at:  I can now remove hidden faces and cubes to boost this more. Then get it to work with my existing game. Problems to solve: how to draw different chunks (in this picture its the same chunk copied 16 times). how to update a chunk. Also water will have to be drawn seperatly on another VBO. I have found all the threads in the cube world challanges helpful. Rendering the above with 100 chunks (16*16*16) I get 160 fps
|
|
|
|
steg90
|
 |
«
Reply #34 - Posted
2013-03-18 21:36:32 » |
|
Hi, I'm doing a voxel engine also. How do you calculate your fps? Mine is always a steady 60fps - I'm using display lists and only rendering chunks. Blocks in chunks are only drawn if not obscured by neighbouring blocks.
Looking at putting in view frustum culling but guess I'd need some sort of octree so not to have to check every chunk...
I've got 22 chunks on of 16*16*16 blocks, actual block count being rendered is 11604 and running at 60fps, I'm also drawing a skybox in immediate mode.
Cheers
|
|
|
|
Vermeer
|
 |
«
Reply #35 - Posted
2013-03-19 12:51:31 » |
|
Hi, I'm doing a voxel engine also. How do you calculate your fps? Mine is always a steady 60fps - I'm using display lists and only rendering chunks. Blocks in chunks are only drawn if not obscured by neighbouring blocks.
Looking at putting in view frustum culling but guess I'd need some sort of octree so not to have to check every chunk...
I've got 22 chunks on of 16*16*16 blocks, actual block count being rendered is 11604 and running at 60fps, I'm also drawing a skybox in immediate mode.
Cheers
Hi steg, yea I keep having a look how yours is going. I've not got all the features you have yet. I think ur FPS is 60 because you have vsync on. If you disable vsync it will then run as fast as it can. You can also the set the sync() to a specific frame rate. If you can't get that working ill post my loop code for you. Will keep looking in on your project.
|
|
|
|
Opiop
|
 |
«
Reply #36 - Posted
2013-03-19 20:03:47 » |
|
Just wondering, in your pictures I see you have text on the screen. Are you actually rendering that in the game? If so, could I ask where you learned how to do that? The best way I've heard to do it is to actually render quads on the screen with the letter as a texture. That seems very inefficient though!
|
|
|
|
Vermeer
|
 |
«
Reply #37 - Posted
2013-03-19 20:51:17 » |
|
Just wondering, in your pictures I see you have text on the screen. Are you actually rendering that in the game? If so, could I ask where you learned how to do that? The best way I've heard to do it is to actually render quads on the screen with the letter as a texture. That seems very inefficient though!
In my videos I was rendering to the screen, I may be wrong but I belive bitmap font rendering is more efficiant then actually rendering true fonts. here is my font class. I can supply the graphic if you need it 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| public class BitmapFont {
private static String chars = "" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ " + "0123456789.,!?'\"-+=/\\%()<>:; ";
public BitmapFont() { }
public void drawString( String msg, int x, int y, int size) { // bind the font text so we can render quads with the characters // on // GL11.glEnable(GL11.GL_TEXTURE_2D); //texture.bind(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 2); // turn blending on so characters are displayed above the // scene GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL11.GL_TEXTURE_MAG_FILTER,GL11.GL_NEAREST); // cycle through each character drawing a quad to the screen // mapped to the right part of the texture GL11.glBegin(GL11.GL_QUADS); msg.toUpperCase(); float Hoffsett = 0.0f; float Voffsett = 0.0f; float squaresize = 0.03125f; for (int i=0;i<msg.length();i++) { int ix = chars.indexOf(msg.charAt(i)); if (ix >= 0) { Hoffsett = squaresize*ix; Voffsett = ((int)(ix/32))*squaresize; //start drawing GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0+Hoffsett,squaresize + Voffsett); GL11.glVertex2f(x+(i*size),y+size); GL11.glTexCoord2f(squaresize+Hoffsett,squaresize+Voffsett); GL11.glVertex2f(x+size+(i*size),y+size); GL11.glTexCoord2f(squaresize+Hoffsett,0+Voffsett); GL11.glVertex2f(x+size+(i*size),y); GL11.glTexCoord2f(0+Hoffsett,0+Voffsett); GL11.glVertex2f(x+(i*size),y); } } GL11.glEnd(); // reset the blending GL11.glDisable(GL11.GL_BLEND); } } |
the render with somthing like Gamefont.drawString( "X:" + playerX , 10,10,16); // to render at 10,10 with 16 pixel size you will need to switch to orthagrphic mode while rendering the bitmap font. but if ur making a GUI you may do that anyway.
|
|
|
|
steg90
|
 |
«
Reply #38 - Posted
2013-03-19 21:35:29 » |
|
Hi,
Removed the vsyncon but still showing 60fps?
PS - this is on my macbook pro which has intel HD 3000 video card, maybe this is the issue?
Cheers, Steve
|
|
|
|
loom_weaver
|
 |
«
Reply #39 - Posted
2013-03-20 11:50:21 » |
|
In your images the glyph spacing is proportional (e.g. the 'l's takes less horizontal space than capital letters). How are you doing that? It's not apparent in the code.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Vermeer
|
 |
«
Reply #40 - Posted
2013-03-20 17:31:05 » |
|
In your images the glyph spacing is proportional (e.g. the 'l's takes less horizontal space than capital letters). How are you doing that? It's not apparent in the code.
Yea, all the bitmap letters are just 8x8 pixels. They are all uppercase too. So the font is pixilated looking, just like on a spectrum 48k! The reason for doing this s actually just so I could get some player position data etc to aid programming. But some popular pixilated style games use this anyway. I guess it could be refined to account for letter sizes and make it look nicer.
|
|
|
|
Vermeer
|
 |
«
Reply #41 - Posted
2013-03-22 19:38:25 » |
|
Update:http://www.youtube.com/v/5ivKUtMhJtI?version=3&hl=en_US&start=Converted to VBO, Static Draw. Running at 1300 FPS now. Added Vertex shading to create various tints of colour, and shading on the side of blocks. VBO can be updated to add/remove blocks, however am re-writing the whole chunk. Will look into subData, or stream write. Map can be loaded from datafile(block position and id), or png file(only hightmapdata) Lots still to do! bigger map, and special objects like chest and furnace! Have 1/2 implimented grass and tilled soil, and water.
|
|
|
|
steg90
|
 |
«
Reply #42 - Posted
2013-03-22 19:53:25 » |
|
That is looking great :-)
|
|
|
|
Opiop
|
 |
«
Reply #43 - Posted
2013-03-22 20:02:43 » |
|
You people are making me jealous, I haven't been able to work on my voxel engine in like a week! Everyday you two add new features into your engines and I just wish I was coding too! Keep up the great work guys, I'm sure us three can inspire each other to keep going!
|
|
|
|
steg90
|
 |
«
Reply #44 - Posted
2013-03-22 20:07:15 » |
|
I'm struggling to tell you the truth to add more to mine, been working all day...
Also struggling with trying to get my camera right, that is positioning properly!
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #45 - Posted
2013-03-22 20:08:44 » |
|
Soon it may be four... 
|
|
|
|
Opiop
|
 |
«
Reply #46 - Posted
2013-03-22 20:10:03 » |
|
Soon it may be four...  I saw your engine too! You should keep working on it, it definitely looked unique! And as for your camera problems, steg90, whats wrong? I would be glad to help you out!
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #47 - Posted
2013-03-22 20:14:48 » |
|
You mean the Hex Prism one? I gave up on that. The math of coordinate skewing was constantly bugging me. (And it was more of a learning project)
But, if I can put the performance of that into a voxel engine (with some new optimisations too)...
@Vermeer and steg90: You should request to move your topics to WIP now that you've sorted out the performance problems.
|
|
|
|
steg90
|
 |
«
Reply #48 - Posted
2013-03-22 20:21:50 » |
|
Hi, I'm not sure if anything wrong with camera? I will zip the code up and you could have a mess about and let me know - no collision in yet, you can just move about with wads, space bar to go up and down key to go down. You can download from here, please see what you think :-) https://sites.google.com/site/voxbygame/home/downloads
PS - @HeroesGraveDev - what is WIP? Cheers Thanks
|
|
|
|
Opiop
|
 |
«
Reply #49 - Posted
2013-03-22 20:23:22 » |
|
Ah I see. I think a 3D version of Guardian might be fun. Maybe, if you actually do go ahead with making your voxel engine, you could add a gamemode for Guardian. Would be very cool to see what you could come up with!
|
|
|
|
Opiop
|
 |
«
Reply #50 - Posted
2013-03-22 20:26:56 » |
|
Could I ask what exactly is wrong with your camera?
|
|
|
|
Vermeer
|
 |
«
Reply #51 - Posted
2013-03-22 20:39:17 » |
|
Soon it may be four...  That would be cool, I have looked at your hexagonal voxels. Very nice idea. @Vermeer and steg90: You should request to move your topics to WIP now that you've sorted out the performance problems.
Thank you , yes may do that. I am aslo finding it very helpful to be in a forum with others doing the same thing. @steg is it ok for me to look at your project too...Im very interested...
|
|
|
|
steg90
|
 |
«
Reply #52 - Posted
2013-03-22 20:48:07 » |
|
Hey guys,
All are welcome to look at my project :-)
Camera - maybe nothing wrong, just I guess need to position it one unit above the floor (first block layer)? Don't want to be able to look 'through' the floor looking down, and it seems to far zoomed in, but this should be just my start z when I create the camera. I want to start the camera say in the middle of the chunks - there are 12 in the version I've uploaded, so say around chunk 3,3.
Having to use the camera x, y, z position to convert to voxel space for collision, this still needs doing...
Thanks
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #53 - Posted
2013-03-22 20:54:04 » |
|
Guardian IIID? See what I did there?  That would be a possibility. But it would have different gameplay. I'll see what happens. I'm currently fixing my 'infinite' world code.
|
|
|
|
Opiop
|
 |
«
Reply #54 - Posted
2013-03-23 18:42:29 » |
|
Is there any chance you could show me your texture code? I can't seem to figure it out 
|
|
|
|
Vermeer
|
 |
«
Reply #55 - Posted
2013-03-23 19:10:32 » |
|
Hi opi im not sure which part you can get working - but this may or maynot help: its only one face, but you get the idea.... if you want the other faces I can post them.... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| float tint =((float)(getLightData(xOset, yOset, zOset))/120f); float side = 0.15f; float side2 = 0.3f; vHandle.put(-0.5f + xOset).put(-0.5f + yOset).put(+0.5f + zOset); vHandle.put(tint-side2).put(tint-side2).put(tint-side2); vHandle.put(h).put(s); vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(+0.5f + zOset); vHandle.put(tint-side2).put(tint-side2).put(tint-side2); vHandle.put(h+s).put(s); vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); vHandle.put(tint-side).put(tint-side).put(tint-side); vHandle.put(h+s).put(0); vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); vHandle.put(tint-side).put(tint-side).put(tint-side); vHandle.put(h).put(0); |
Its interleaved, 3 vertex. 3 colour, 2 texture h is the horizontal offset of my texture atlas (spritesheet) and s = size. on this particular cube there is no vertical offset. tint is the light level of the cube side and side 2 are used for some shading on the cube sides to differentiate them from the top. if you have only 1 texture file per block, h = 0, and s=1 hope that helps...
|
|
|
|
Opiop
|
 |
«
Reply #56 - Posted
2013-03-23 19:24:29 » |
|
Sorry, I was wondering if you could actually show me how you bind and render out the texture. So since you use VBOs, what parameters do you use for And do you just call 1
| glBindTexture(GL_TETXURE_2D, id) |
or do you do it a different way?
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #57 - Posted
2013-03-23 19:46:21 » |
|
VBOs: 1
| glBindBuffer(GL_ARRAY_BUFFER, bufferID); |
Textures: 1
| glBindTexture(GL_TEXTURE_2D, textureID); |
|
|
|
|
|
Vermeer
|
 |
«
Reply #59 - Posted
2013-03-24 20:42:32 » |
|
Update:I have added: Block braking animation and timer. Also had a go a water (translucent and animated) Water has a volume, and when it flows into a new block it distibutes the volume over the new blocks. SO the water level lowers, untill its so low, its just absorbed! (im going to have to work on the 3d picker now, the temp fix is anoying!) http://www.youtube.com/v/IhsfYbcrfXw?version=3&hl=en_US&start=
|
|
|
|
|