Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (707)
Games in Android Showcase (206)
games submitted by our members
Games in WIP (781)
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  
  Ot - 3D voxel engine  (Read 4982 times)
0 Members and 1 Guest are viewing this topic.
Offline buddyBro

Senior Devvie


Medals: 5
Projects: 3



« Posted 2016-12-31 19:39:51 »

Hello,

Back in 2013, I posted of a 3d engine I had been working on but had to stop due to schoolwork. Well, this Christmas, I began a total fresh remake of the engine; this time focusing on optimizations for extremely vast terrains (rather than dense environments like my previous engine had focused on). My plans are to eventually make it support some kind of pirates battles in the sky game where you create your ships with blocks (kind of like robocraft), though I'm still considering some other ideas as well - if anyone wants to make suggestions, please go ahead Smiley

For drawing, it uses Java.Graphics2D and BufferedImage.

Here's a quick demo 1 week in.

(if anyone can help if there's an easy way to shrink the embedded image, thank you)
zip: https://www.dropbox.com/s/k0ju5zp2ijka7wl/ot.jar
<a href="http://www.youtube.com/v/SDw4UxfbeQ0?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/SDw4UxfbeQ0?version=3&amp;hl=en_US&amp;start=</a>




Online kevglass

« JGO Spiffy Duke »


Medals: 314
Projects: 25
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1 - Posted 2016-12-31 19:41:50 »

This video is private Sad

Kev

Offline VaTTeRGeR
« Reply #2 - Posted 2017-01-01 11:51:57 »

1  
[img width=800]...[/img]


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline buddyBro

Senior Devvie


Medals: 5
Projects: 3



« Reply #3 - Posted 2017-01-01 21:20:38 »

Thank you both. The video should be public now.
Here's another demo showing it in a much larger map
<a href="http://www.youtube.com/v/v4VnHYtDSSM?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/v4VnHYtDSSM?version=3&amp;hl=en_US&amp;start=</a>
Offline Archive
« Reply #4 - Posted 2017-01-01 22:38:19 »

Nice job. I'm curious to see where this goes!

Offline ShadedVertex
« Reply #5 - Posted 2017-01-02 11:11:04 »

This looks really cool! It kinda reminds me of my ol' game, Indago (http://www.java-gaming.org/topics/indago-the-search/36948/view.html), haha  Grin
Offline TGStudiosDE

JGO Coder


Medals: 12
Projects: 3
Exp: 3 years


17 Years Old Developer from Germany :)


« Reply #6 - Posted 2017-01-02 11:36:02 »

Looks cool and I'm interested how it will change in the Future Smiley

Contact me about Bugs: TGStudiosDE@gmail.com
Offline orange451

JGO Kernel


Medals: 247
Projects: 5
Exp: 6 years


Your face. Your ass. What's the difference?


« Reply #7 - Posted 2017-01-03 18:57:23 »

i really like the fps on the video Smiley

Joking aside, looks like a cool project!

First Recon. A java made online first person shooter!
Offline buddyBro

Senior Devvie


Medals: 5
Projects: 3



« Reply #8 - Posted 2017-01-04 05:25:46 »

Thank you all very much for the encouragement! Yes, the fps is pretty low at the moment, but note that I had not finished implementing all the optimization strategies I'd planned, plus that's a lot more objects on screen than will actually be required. I'm finishing up the final optimization algorithms at the moment and I expect 10-15 fps with that density, map size, and draw distance. I'll upload another video once I've completed the optimizations, maybe with a more toned down density.
Offline J0
« Reply #9 - Posted 2017-01-09 21:40:11 »

I'm sorry but how can you be using Graphics2D for a 3D renderer? persecutioncomplex
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kingroka123

JGO Kernel


Medals: 114
Projects: 9
Exp: 4 years


Gamer's Helmet


« Reply #10 - Posted 2017-01-09 22:26:58 »

Hes doing 3D math on the cpu. It's much slower than using OpenGL or DirectX because those use the graphics card for their calculations.

Offline Archive
« Reply #11 - Posted 2017-01-09 23:51:52 »

I'm sorry but how can you be using Graphics2D for a 3D renderer? persecutioncomplex
He's doing what I'm doing but using java's polygon rasterization vs. making his own.

Offline buddyBro

Senior Devvie


Medals: 5
Projects: 3



« Reply #12 - Posted 2017-01-10 04:36:07 »

Yep pretty much. I'm calculating the screen location, color/shade, order of all the shapes needed to be drawn and just telling some graphics2D instance to drawPolygon / drawString.

I've been working on all the optimization algorithms lately, so haven't had much to show. But I'm pretty much done for now with optimizations, and added support for rotated cubes just to have something new to show.

If anyone's interested, here's an generic overview of the optimization steps I take. Feel free to add suggestions.
1) determine max draw distance (the distance after which even the brightest 1x1x1 object would be too dark / small to be noticeable anyways)
2) determine the coordinates of the minimum-bounding-axis-aligned-rectangular-prism encompassing the camera field of view.
3) iterate through these coordinates (left -> center, then right -> center, then center, so we don't have to worry about draw-order or zbuffering)
4) for each non-empty coordinate, check if it is within the camera field of view via a simple dot product and distance check (since the minimum bounding rectangular prism is larger than the fov, and since this check is very low-cost)
5) get the surfaces of that coordinate that have normals facing the camera (again via dot product)
6) convert the surface coordinates to screen coordinates. As a final check, make sure at least one of the surface's screen x,y coordinates are within [-.5, .5] and if so, draw it

On top of this, in order to support vast areas, with potentially low-density, the world is divided into chunks, so that chunks aren't initialized unless they contain at least one surface, and they are skipped over in the drawing algorithm if empty.

The only additional major optimization plan I have, I plan not to update (remove & add) surfaces as they move, unless they are in view. Instead, I'll "expire" the surface's old location via some counter, and add "trigger-points" bounding clusters of surfaces which move together so that the actual surfaces are added to the world only if the trigger points are visible.

Here's a new 30-sec screen-capture.

<a href="http://www.youtube.com/v/Oes6N6I4pjs?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/Oes6N6I4pjs?version=3&amp;hl=en_US&amp;start=</a>
Offline J0
« Reply #13 - Posted 2017-01-10 08:36:07 »

Shouldn't it be painfully slower? I'm impressed that you can do that heheh
Offline buddyBro

Senior Devvie


Medals: 5
Projects: 3



« Reply #14 - Posted 2017-01-10 14:37:16 »

Shouldn't it be painfully slower? I'm impressed that you can do that heheh

For a  simple use case like this (i.e. no textures, hard shadows, gloss, reflections, etc) the most computationally heavy part with traditional rendering tends to be determining draw order (via z buffering for example). And one of the main trade offs of voxel rendering is that ordering becomes really computationally cheap at the cost of dramatically increasing the number of polygons you have to deal with. But that's where all these optimization algorithms come in, they all try to minimize the number of "qualified" polygons we have to consider. As for the actual drawing pixels on screen, I'm not sure whether graphics2d instructions still eventually get converted to graphics card instructions or whether they are completed by the CPU, but I do know for my previous rendering project, switching to jogl was only a 10 or so fps gain.
Offline buddyBro

Senior Devvie


Medals: 5
Projects: 3



« Reply #15 - Posted 2017-01-15 19:00:21 »

Added ships, i.e. moving cluster of blocks. There's graphical bug with some surfaces being drawn on top of other surfaces when they shouldn't be, but I hope to fix that soon.

<a href="http://www.youtube.com/v/fsdF4Uid7BM?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/fsdF4Uid7BM?version=3&amp;hl=en_US&amp;start=</a>
Offline Archive
« Reply #16 - Posted 2017-01-15 19:05:11 »

Added ships, i.e. moving cluster of blocks. There's graphical bug with some surfaces being drawn on top of other surfaces when they shouldn't be, but I hope to fix that soon.
You don't have a z-buffer?

Edit: just remembered that you use java2d

Pages: [1]
  ignore  |  Print  
 
 

 
Galdo (241 views)
2017-01-12 13:44:09

Archive (409 views)
2017-01-02 05:31:41

0AndrewShepherd0 (868 views)
2016-12-16 03:58:39

0AndrewShepherd0 (805 views)
2016-12-15 21:50:57

Lunch (942 views)
2016-12-06 16:01:40

ral0r2 (1173 views)
2016-11-23 16:08:26

ClaasJG (1274 views)
2016-11-10 17:36:32

CoffeeChemist (1307 views)
2016-11-05 00:46:53

jay4842 (1392 views)
2016-11-01 19:04:52

theagentd (1207 views)
2016-10-24 17:51:53
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
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!