Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Voxel game bad-ish fps on gaming computer and high fps on laptop!?!  (Read 356 times)
0 Members and 1 Guest are viewing this topic.
Offline ABOODYFJ

Junior Newbie





« Posted 2014-08-18 10:25:08 »

Hello, So I have been working on a voxel engine for the past couple of weeks, Got too lazy and stopped working on it, So in the past few hours I fixed everything and now have a working jar of it, The game generates the world in chunks of 96*64/89*96 and then it merges all the chunks together to bring you the final result, When you walk a block it renders an extra block to the direction you're going and stops rendering one block behind, I am pretty happy with the result, But feel like I can do much more. I am still new to lwjgl though, And yes I am using the old deprecate methods, Don't even mention modern openGL, I don't want to learn it yet.

The engine currently only draws faces pointed towards you ( or so ), Also faces that are hidden by air are not rendered, Uses height-maps ( can make your on maps as well with photoshop. ), renders only around you ( so that it doesn't keep excess information in the memory ), The world is NOT procedurally generated, It is actually when you start the game, And then only renders it around you, Currently has a limit for the world, But planning to make a simple level saving system so that I can get the block info from, Currently only using immediate mode to render, I find it to be the easiest. Very simple ( and bad ) collision detection, Very simple ( and REALLY bad ) block selection system ( uses your rotation ), And no frustum culling.

Right now I am getting around 90 - 20 fps on a desktop gaming computer ( which renders minecraft at 100+ fps ), When I ported the game to my old mac book pro laptop I was astonished to see that it renders at around 240 - 100 fps, Although it used to render minecraft at 60 - 50 fps..

So why is that ? Is there any way for me to check ? Because right now I really don't understand what's going on, And any tips on improving the engine overall ?
Thanks!
Offline Phased
« Reply #1 - Posted 2014-08-18 10:39:04 »

if you are using immediate mode rendering, then that is your problem, and if you want to make a 3D sandbox game, you should probably look into VBO's.

Though, there's still a small chance you could improve performance.

make sure you only start one draw call ( GL11.glBegin() and GL11.glEnd() ). you want as little as those calls as possible, and have all your textures in a one texture, so you don't have to keep rebinding different textures.

if you have already done that, then either make your world render less blocks, or exactly what you should do, learn a more modern OpenGL approach.
Offline ABOODYFJ

Junior Newbie





« Reply #2 - Posted 2014-08-18 10:49:02 »

if you are using immediate mode rendering, then that is your problem, and if you want to make a 3D sandbox game, you should probably look into VBO's.

Though, there's still a small chance you could improve performance.

make sure you only start one draw call ( GL11.glBegin() and GL11.glEnd() ). you want as little as those calls as possible, and have all your textures in a one texture, so you don't have to keep rebinding different textures.

if you have already done that, then either make your world render less blocks, or exactly what you should do, learn a more modern OpenGL approach.

Hello, Thanks for the reply, I have actually never understood how to use one draw call, The way I render right now is check the type of block at the x, y, z coordinates and render a block accordingly ( with one draw call it draws the specified faces ), But that is a draw call/per block. I actually tried making a draw call /per chunk, which worked out pretty well except that it wouldn't bind any texture, It would just use the texture for the mob that I had in the game, And the reason for that ( I think ) is that it would try to use one texture per/chunk which would be bad, So if there is anything than i'm missing then please point me to the right direction Tongue

Thanks for your reply!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Phased
« Reply #3 - Posted 2014-08-18 10:54:03 »

bind your block textures before you start your chunk rendering.

once its bound, the texture coordinates you pass in have to be a value between 0 and 1.

coordinate (0, 0), being the top left, and (1, 1) being the bottom right. so you need to find out the coordinates of where each block is on your texture.

chances are you could probably even combine your enemy textures into the same file, even if they are different sizes to your blocks, some extra code for the texture coordinates for mobs (if required), and you could do it all in one texture bind.
Pages: [1]
  ignore  |  Print  
 
 

 

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

The first screenshot will be displayed as a thumbnail.

BurntPizza (13 views)
2014-09-19 03:14:18

Dwinin (31 views)
2014-09-12 09:08:26

Norakomi (57 views)
2014-09-10 13:57:51

TehJavaDev (79 views)
2014-09-10 06:39:09

Tekkerue (40 views)
2014-09-09 02:24:56

mitcheeb (62 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (30 views)
2014-09-07 01:12:14

Longarmx (36 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!