Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2] 3 4 ... 7
  ignore  |  Print  
  LWJGL BlockWorld  (Read 33652 times)
0 Members and 1 Guest are viewing this topic.
Offline Vermeer

JGO Coder


Medals: 16



« Reply #30 - Posted 2013-03-17 19:46:51 »



Im always forgetting to turn laptop on at the wall!
Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #31 - Posted 2013-03-18 04:09:13 »

NOOOOOO!!!

You put ALL the cubes in ONE VBO. (Per chunk)

Offline Vermeer

JGO Coder


Medals: 16



« 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!
Legends of Yore - The Casual Retro Roguelike
Offline Vermeer

JGO Coder


Medals: 16



« 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
Offline steg90

Senior Devvie


Medals: 1



« 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
Offline Vermeer

JGO Coder


Medals: 16



« 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.
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« 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!

Offline Vermeer

JGO Coder


Medals: 16



« 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.
Offline steg90

Senior Devvie


Medals: 1



« 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
Offline loom_weaver

JGO Coder


Medals: 17



« 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!
Legends of Yore - The Casual Retro Roguelike
Offline Vermeer

JGO Coder


Medals: 16



« 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.
Offline Vermeer

JGO Coder


Medals: 16



« Reply #41 - Posted 2013-03-22 19:38:25 »

Update:

<a href="http://www.youtube.com/v/5ivKUtMhJtI?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/5ivKUtMhJtI?version=3&amp;hl=en_US&amp;start=</a>

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.

Offline steg90

Senior Devvie


Medals: 1



« Reply #42 - Posted 2013-03-22 19:53:25 »

That is looking great :-)
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« 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!

Offline steg90

Senior Devvie


Medals: 1



« 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!
Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #45 - Posted 2013-03-22 20:08:44 »

Soon it may be four... persecutioncomplex

Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #46 - Posted 2013-03-22 20:10:03 »

Soon it may be four... persecutioncomplex
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!

Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« 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.

Offline steg90

Senior Devvie


Medals: 1



« 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
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« 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!

Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #50 - Posted 2013-03-22 20:26:56 »

Could I ask what exactly is wrong with your camera?

Offline Vermeer

JGO Coder


Medals: 16



« Reply #51 - Posted 2013-03-22 20:39:17 »

Soon it may be four... persecutioncomplex
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...
Offline steg90

Senior Devvie


Medals: 1



« 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
Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #53 - Posted 2013-03-22 20:54:04 »

Guardian IIID?

See what I did there? persecutioncomplex

That would be a possibility. But it would have different gameplay. I'll see what happens. I'm currently fixing my 'infinite' world code.

Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« 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 Sad

Offline Vermeer

JGO Coder


Medals: 16



« 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;
     
      //front face
      //quad 1 bottom
     
      vHandle.put(-0.5f + xOset).put(-0.5f + yOset).put(+0.5f + zOset); // vertex bottom left
      vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
      vHandle.put(h).put(s); // texture
      //vHandle.put(tint).put(tint).put(tint);
      vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(+0.5f + zOset); // v  bottom right
      vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
      vHandle.put(h+s).put(s); //    t
      //vHandle.put(tint).put(tint).put(tint);
      vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // v top right
      vHandle.put(tint-side).put(tint-side).put(tint-side);
      vHandle.put(h+s).put(0); // t
      //vHandle.put(tint).put(tint).put(tint);
      vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // v top left
      vHandle.put(tint-side).put(tint-side).put(tint-side);
      vHandle.put(h).put(0); //t
     



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...
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« 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
1  
glBindBuffer()

And do you just call
1  
glBindTexture(GL_TETXURE_2D, id)
or do you do it a different way?

Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #57 - Posted 2013-03-23 19:46:21 »

VBOs:
1  
glBindBuffer(GL_ARRAY_BUFFER, bufferID);


Textures:
1  
glBindTexture(GL_TEXTURE_2D, textureID);

Offline Vermeer

JGO Coder


Medals: 16



« Reply #58 - Posted 2013-03-23 20:48:58 »

VBOs:
1  
glBindBuffer(GL_ARRAY_BUFFER, bufferID);


Textures:
1  
glBindTexture(GL_TEXTURE_2D, textureID);


Yep just like that.
I used this code
http://www.lwjgl.org/wiki/index.php?title=Using_Vertex_Buffer_Objects_(VBO)
Offline Vermeer

JGO Coder


Medals: 16



« 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!)

<a href="http://www.youtube.com/v/IhsfYbcrfXw?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/IhsfYbcrfXw?version=3&amp;hl=en_US&amp;start=</a>


Pages: 1 [2] 3 4 ... 7
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (35 views)
2014-12-15 09:26:44

Mr.CodeIt (26 views)
2014-12-14 19:50:38

BurntPizza (53 views)
2014-12-09 22:41:13

BurntPizza (86 views)
2014-12-08 04:46:31

JscottyBieshaar (48 views)
2014-12-05 12:39:02

SHC (63 views)
2014-12-03 16:27:13

CopyableCougar4 (66 views)
2014-11-29 21:32:03

toopeicgaming1999 (126 views)
2014-11-26 15:22:04

toopeicgaming1999 (117 views)
2014-11-26 15:20:36

toopeicgaming1999 (34 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!