Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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  
  Building a 3D Game Engine using LWJGL - in 3 months?  (Read 19829 times)
0 Members and 1 Guest are viewing this topic.
Offline Fid

Senior Newbie


Medals: 1



« Posted 2011-02-04 21:13:35 »

Hi guys,

I am just looking for opinions and experiences on this - my final year University project. Ideally, my project is to create a basic 3D game engine (i.e. FPS) in around 2.5 - 3 months. I say basic as it doesn't have to be amazing, it can be something simple, with basic collision detection and what not.

However - is this possible in the time given, which is around 2.5 - 3 months (spending around 25-30 hours a week on this)?

It was a throw up between a 3D and 2D engine and in the end I decided the 3D engine would get me the most marks due to being more technical and complicated compared to a 2D engine... however it is no good if it is honestly far too much work to complete in the time available, and this is what I am most worried about. I am fine for learning the required maths, but I just think that doing the graphics and building a small 3D world would take up several weeks and not leaving enough time for other game engine features such as lighting, shadows, collision detection, sounds, input etc.

I have numerous books, including one that has a walkthrough of building a basic 3D world in JOGL - I would probably try to convert that to using LWJGL and I have ordered a textbook on OpenGL (OpenGL Superbible) to be delivered tomorrow.

So yeah, a 3D engine is definitely a project that will get me the best grades from my tutor (and although I have had little graphics programming experience, I have four years Java experience) but I am just SO worried it will not be achievable!

All opinions and advice absolutely welcome!

Thanks everyone! Smiley
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2011-02-04 21:26:04 »

Just set boundaries. Work out a very simple game, something you feel you can implement in a rainy afternoon. It'll probably take a week or two. Work from there, incrementally: 'release' something that works every week, after two months you'll know where your project will end up.  Keep it simple though, very simply. Don't even try to add terrain, trees or grass to your world, making any of those three look good and fast can easily take 3 months.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Fid

Senior Newbie


Medals: 1



« Reply #2 - Posted 2011-02-04 21:57:28 »

That was actually very useful, I'm about to properly plan my project week by week so I'm going to make sure I keep everything really simple (despite wanting to show off, I suppose just the code required for something simple is still impressive).

Could you recommend any good resources/the best library to use? Obviously I'm looking at LWJGL, but I've also looked at Java3D (which I know is different), JOGL... they all seem relatively the same, are there any major differences/disadvantages to choosing one over the other to use?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DzzD
« Reply #3 - Posted 2011-02-04 22:01:26 »

IMO, avoid Java3D

the two others are both good choice, and your project success will be in both case more relative to how you build your game/project architecure than the API you use (ideally if you well prepare/built it you should be able to switch from one to another at low cost/time)

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 70
Projects: 15


★★★★★


« Reply #4 - Posted 2011-02-04 22:16:37 »

Yeh agreed, Java3D is pretty much dead and best avoided, but if you are looking for a java library or engine, the following snippet from the old JGO wiki has some useful links.

Quote
2D Engines and Libraries
Slick2D (Hardware Accelerated 2D Games Library)
PulpCore (2D Games Engine, especially good for Applets)
LibGDX (2D and 3D OpenGL library, both desktop and Android support, and more)
 
3D Engines and Libraries
Ardor3D (Java based 3D engine)
JMonkeyEngine (Java based 3D engine)
jPCT (Java based 3D engine)
LibGDX (2D and 3D OpenGL library, both desktop and Android support, and more)
Clyde (For creating action-oriented networked 3D games in Java.)
Xith3D (Java based 3D engine)
Ogre4J (Java binding to the popular C++ engine Ogre3D)
3DzzD (Java based 3D engine for webpages)
Offline Nate

JGO Kernel


Medals: 129
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #5 - Posted 2011-02-04 22:46:53 »

You could use libgdx. It provides access to OpenGL through an abstraction layer over LWJGL, JOGL, Android, and others. There is no problem developing a desktop only game with it though. It provides more than either LWJGL or JOGL, which mostly just provide access to OpenGL, input, etc. libgdx has texture loading, sprite batching, VA/VBO helpers, font rendering, texture atlases, particles, etc.

Offline Fid

Senior Newbie


Medals: 1



« Reply #6 - Posted 2011-02-04 22:58:42 »

Could a 3D engine be developed using libgdx?

My idea of a game engine is really something that is a very very simple generic game... and that has an API to supply methods to a developer to use this generic game and extend it through the features available (i.e. load in their own textures, content, choose whether or not there should be a timer, leaderboard, which features a game should have etc).

Is my idea roughly right? (It's less focused on graphics and more on the coding of creating a basic game, the ability to create a basic game and add whatever features the developers choose and to provide a very simple way to do that)

With graphics, I didn't really want to "reinvent the wheel" (I am not a graphics student nor have that experience, my tutor didn't actually recommend me learning all of the mathematics required as he thought there would be something available to do that - not that I have a problem learning if required) but focus more on building a "generic" game that can continuously be extended and be simple for a developer to take and develop their own game.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #7 - Posted 2011-02-04 23:12:08 »

I'd advise you to use a pure OpenGL binding like LWJGL... the major advantage is that you can read endless amounts of tutorials on OpenGL (like NeHe) and basically copy and paste code, messing around, until it works.

When you work with some existing engine (I thought your goal was to create a game engine...? for a tech demo, not a game?) is that you'll never learn the basics. Any time you run into trouble you have to ask the (community of the) maker, bad thing. Stick with pure OpenGL and you'll have vast amounts of resources to dig through. (and irc.freenode.net #lwjgl for instant help on OpenGL and LWJGL)

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2011-02-04 23:29:30 »

If you want to make a 3D world engine thing, think about the basics of how Minecraft is implemented.

Cas Smiley

Offline Fid

Senior Newbie


Medals: 1



« Reply #9 - Posted 2011-02-04 23:46:37 »

Riven: Well that is where I could be a bit confused... or possibly worded my idea a bit wrongly. If I was to create some simple 3d game engine with collision detection (and again basic, to stop say the camera/something walking into an object in the 3d world), to demonstrate it I would have to create a simple game to use it/go along with it, no? (Unless this is what you meant by tech demo).

To give the origins of how this project started about... I was going to do a game however my tutor thought this would not flex my skills enough and for that good grade I should go more "general"... instead of having character X with ability Y in world Z... to be non specific and allow character X to be any character... ability Y to be any ability and to provide that in the form of some sort of engine that a developer could use to implement characters, abilities, worlds of their choosing. And that's how the 3D engine idea came about! (2D was discussed but we decided it would too simple - or so my tutor thinks it would be rather too simple for me - but I think the extra capabilities that I could add with the extra time available would negate that but eh).

Will definitely take a look at Minecraft...!! Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2011-02-05 00:13:45 »

The whole idea of 2D being easy is ridiculous. Mona Lisa is 2D too, not to mention TV and the web.

You can make 2D as easy or complex as you make it. You'd expect a teacher to grasp that. Same goes for 3D by the way, it can be absolutely less impressive than a nicely designed, polished and thought through 2D engine.

The only difference is that you are dealing with another spatial dimension, which often means you have to use more geometry, which affects performance, hence you lose yourself in mundane world of frustum culling and level-of-detail. All these things have absolutely nothing to do with the design of a playable, fun game. If you want to have a bit of depth (story wise) in your game, allowing for non-linear gameplay, your game-code will be hard enough, and those 3 months will feel pretty tight.

f you however solely want to impress your teacher (which makes sense, if you're doing it for the grade), make it 3D, add lots of particle-engines and fancy physics that have no purpose, and put a beat under it. It will surely make up for the lack of complexity in the game-code...

Tough choice. Lips Sealed

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Fid

Senior Newbie


Medals: 1



« Reply #11 - Posted 2011-02-05 00:44:26 »

Yeah I definitely see your point.

I think my project right now is definitely not to create a game (I'm not designing a game, not designing any story, or characters, or anything like that) but something to demonstrate my programming skills and that could possibly be extended in the future I guess (so definitely a 3D engine... with as you say particle engines, physics and a "tech demo" to go along with it merely to show off what I have achieved from my engine). Again, whether or not that is possible in 3 months I'm not sure!

I think I've been getting slightly confused with exactly what a game engine is... and my project is in no way supposed to create any playable game I don't think. (I think even creating some sort of basic 3d environment with camera etc would look impressive and still require quite a bit of work on my side, i.e. mathematics, opengl wise).

Are NeHe's tutorials quite good and relevant today?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #12 - Posted 2011-02-05 00:51:38 »

A game engine is basically the code that handles the rendering, the networking (if any -- please dont...) and the physics (if any). It's like a technical foundation, on which you build the game code.

In a game engine you'd find code that loads textures, does frustum culling, pushes data to the GPU, plays sound effects and streams background music, possible a finite state machine for the AI. It's basically everything in your game that nothing to do with the game.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Fid

Senior Newbie


Medals: 1



« Reply #13 - Posted 2011-02-05 01:02:08 »

Ah ok. That definitely makes more sense and was basically along the lines of what I was thinking.

As for something such as collision detection - again I'm assuming this would be implemented by the game engine - just how difficult is it to implement this would you say?

(Sorry if some of my questions sound as if I'm trying to find the easiest way to do things - I'm not, I'm just trying to prioritise what things to do when based on how difficult they could be etc!).

Thanks so much for your help Riven, I really appreciate it!
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #14 - Posted 2011-02-05 01:08:38 »

Collision detection is reasonably easy. Collision response is not.

It often helps to start off with a 2D version of your physics API.

Make Circle<->Rectangle work first, then write the Sphere<->Cube version. In the end you probably want Sphere<->Plane, Sphere<->Triangle and Triangle<->Triangle.

Don't try to focus on realistic collision response: it's really, really hard to get right, and you won't get it done in three months along with the rest of your game. Instead, once you noticed you collided with something, either destroy the object, or move back to the last known valid position.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Fid

Senior Newbie


Medals: 1



« Reply #15 - Posted 2011-02-05 01:22:02 »

Oh ok.

I definitely think one problem I am having is thinking too big for the time available and need to just go a bit more simpler.

I'll no doubt have more questions as well! Tongue Again, thanks for all your answers so far, they are really helpful.
Offline Nate

JGO Kernel


Medals: 129
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #16 - Posted 2011-02-05 02:38:48 »

Could a 3D engine be developed using libgdx?

Yes, of course.

There is some truth in what Riven is saying, that using a "pure OpenGL binding" will expose you to the low level details so that you are sure to understand how it works. When you choose a higher level technology, you should have a reasonable understanding of how it works, else you will be unable to help yourself when you get into trouble. The reason not to choose a lower level technology is to save time by not writing boilerplate/common code and to allow you to focus on what you are trying to accomplish.

libgdx provides access to OpenGL, so many of the tutorials and sample code can be made to work with little effort. It also has some higher level features you may choose to use that allow you to develop your game more rapidly, such as text rendering, easier management for VA/VBOs, etc.

FWIW, I prefer writing 2D games.

Offline indexunknown

Junior Member





« Reply #17 - Posted 2011-02-05 09:45:39 »

based on how much basic questions you have, I would in your place try to get an easier task from the teacher. If you start learning now how to handle objects in 3D and how to load them in, do rendering, handle the transformations, set up all kinds of parameters for rendering, maybe how to use shaders, how to do collision detection in 3D and on top of that have the code be extendable. Then in this amount of time you will at most write a basic spaghetti code that can achieve some of these things but it will be very far from the goal which is a game engine and if you then show the spaghetti to the teacher then what is he supposed to do.
Offline dishmoth
« Reply #18 - Posted 2011-02-05 12:02:01 »

For what it's worth, my guess as to the sort of thing you could get done in three months would be:

A world made up of rectangular (in 3D, so cuboid) rooms connected by doorways (portals).  If you keep the room geometry simple then you save yourself a lot of problems, not least of which would be how to create the room data.  You don't have time to build your own world editor, and writing the code to import data from an existing editor would be a hassle.

To simplify things even further, the player/camera always stays at the same height (no stairs, no sloping floors, no jumping, no falling).  That way the engine's logic is all 2D.  For collision detection, you just treat the player/camera as a circle in a 2D world.  (Tip: Implement a 'map mode' that displays the game world, including the player, from above using an orthographic projection.  Very useful for debugging.)

You could probably get the above done in a month or less.  Then you can spend the rest of your time adding cool stuff.  If the walls (and floors and ceilings) of the rooms start as just plain colours, then the next step would be to texture map them, and then to add other interesting effects as time allows (e.g., bump maps).

And then you can start populating the world with objects, and creatures, and weapons upgrades, and so on, and so on.

Just a suggestion.
Simon

Offline Fid

Senior Newbie


Medals: 1



« Reply #19 - Posted 2011-02-05 13:08:46 »

dishmoth: That sounds an interesting/fantastic idea! And one I am definitely considering when planning my project this weekend.

I think it is clear that in the time given with my abilities in 3D graphics (and my tutor is aware that I have no experience really of 3D graphics as they don't do it on the course anymore!) that I am going to have to go with something slightly basic as a target, and merely extend - and I doubt I would get anywhere near a full game engine, however the 3D graphics stuff should show off my skills and ability to research/learn etc.

indexunknown: Understand your point totally... I have literally no experience with Java gaming but the whole point of this project is to learn new things and use whatever skills I have learn't so far in Java and apply them to new things now. I am a first degree student, hence the big project suggestion, and this does mean more research is required in my project (and certainly would be done if I was learning 3D graphics).

However as I said I think I will take what I have learn't from everyone's suggestions here - I know what a game engine should do... I know what is basically possible in the 3 months available when using 3D graphics and starting from scratch and I know that a full game engine in 3D will not be completed in 3 months... but more a "sub-section". (Infact though, my tutor said aiming for a "subsection" of a "prototype" would be fine really!).

I'll make my plans on what I think is possible, and I'll give them to my tutor on Wednesday and basically say... "OK, if you want me to demonstrate a really basic partial 3D engine... I can do this and this and it will require a lot of research..." or "If you want a full engine with just as much research, but in other areas i.e. fluid movement, collision detection... then I should drop the 3D and move to 2D". Either way the work is complicated and still lots to learn... but I think within the time possible one project would achieve more (visually and in a game engine way) more than the other.

Am I now thinking along the right lines?
Offline Mike

JGO Wizard


Medals: 69
Projects: 2
Exp: 5 years


Java guru wanabee


« Reply #20 - Posted 2011-02-05 14:05:49 »

Yes, it sounds about right from a time/expectations point of view.

Mike

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #21 - Posted 2011-02-05 18:02:57 »

but focus more on building a "generic" game that can continuously be extended and be simple for a developer to take and develop their own game.

Sounds nice in theory, but is generally a waste of time. Writing reusable code is almost impossible. Every time you 'finish' a project you'll already know what bunch of design flaws are in your current engine, and how you'd do better in your next project. Making code very abstract is one way to lose control and never get anything done.

During prototyping you really have to write code that works. It doesn't matter whether it's a mess, or how you're using stuff that's considered 'not done' to make it all work. Once it works, clean it up, refactor your code into a better structure (an IDE like Eclipse and NetBeans is required here!) and add some new features, again, making a big mess, use dirty hacks, until it works. Rinse and repeat.

Once the 3 months are over, you probably will never use that code again, because with all that you've learnt it would simply be stupid not to start from scratch.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Fid

Senior Newbie


Medals: 1



« Reply #22 - Posted 2011-02-05 19:04:32 »

but focus more on building a "generic" game that can continuously be extended and be simple for a developer to take and develop their own game.

Sounds nice in theory, but is generally a waste of time. Writing reusable code is almost impossible. Every time you 'finish' a project you'll already know what bunch of design flaws are in your current engine, and how you'd do better in your next project. Making code very abstract is one way to lose control and never get anything done.

During prototyping you really have to write code that works. It doesn't matter whether it's a mess, or how you're using stuff that's considered 'not done' to make it all work. Once it works, clean it up, refactor your code into a better structure (an IDE like Eclipse and NetBeans is required here!) and add some new features, again, making a big mess, use dirty hacks, until it works. Rinse and repeat.

Once the 3 months are over, you probably will never use that code again, because with all that you've learnt it would simply be stupid not to start from scratch.

Yeah that is what I definitely plan to do (and funnily enough always what I seem to do with every project at the moment... implement it in such a way that it really is a big mess just to get it to work... then tidy it all up after).

I just need to remember really that whatever code I do eventually hand in, to make sure it is moderately tidy by the end of it!
Offline DrZoidberg

Senior Member


Medals: 10



« Reply #23 - Posted 2011-02-12 04:54:46 »

I was also playing around with 3d in Java a while ago.
I wrote an extremely simple 3d engine that can display simple geometric shapes like cubes or pyramids and make them move around and rotate.
However it doesn't use opengl. It just draws the stuff with Graphics2D.fill, so it's kinda slow.
But since it's so small and simple it is very easy to understand. So it might give you some inspiration.
If you want to take a look at the source code, i put it on megauploadcom/?d=TN2TJSS5
You can compile it with javac game3d/*.java and run it with java -cp . game3d/Game3D.
You can control the camera with w,a,s,d,q,e,space,c,shift and by clicking and dragging the mouse.
Offline pitbuller
« Reply #24 - Posted 2011-05-18 11:36:38 »

Can we see what you managed to do?
Offline gouessej

« In padded room »



TUER


« Reply #25 - Posted 2011-05-27 14:17:08 »

I have numerous books, including one that has a walkthrough of building a basic 3D world in JOGL - I would probably try to convert that to using LWJGL
Why not using JOGL? It works Sad

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #26 - Posted 2011-05-27 16:07:58 »

Why not using JOGL? It works Sad

Thanks gouessej! Smiley

From now on we are officially allowed to advise LWJGL in a JOGL thread!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline gouessej

« In padded room »



TUER


« Reply #27 - Posted 2011-05-27 16:15:16 »

Why not using JOGL? It works Sad

Thanks gouessej! Smiley

From now on we are officially allowed to advise LWJGL in a JOGL thread!
No, he mentioned JOGL in his first post (otherwise I would not have mentioned it), I don't see what is wrong:
I have numerous books, including one that has a walkthrough of building a basic 3D world in [size=20pt]JOGL[/size] - I would probably try to convert that to using LWJGL

Please read more carefully my posts and my quotes.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #28 - Posted 2011-05-27 16:22:46 »

Sorry, it's official now.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline gouessej

« In padded room »



TUER


« Reply #29 - Posted 2011-05-27 22:56:28 »

Sorry, it's official now.
You will need an official moderator who is not in the LWJGL side for the JOGL section in this case.

Pages: [1]
  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.

xsi3rr4x (57 views)
2014-04-15 18:08:23

BurntPizza (55 views)
2014-04-15 03:46:01

UprightPath (68 views)
2014-04-14 17:39:50

UprightPath (51 views)
2014-04-14 17:35:47

Porlus (68 views)
2014-04-14 15:48:38

tom_mai78101 (93 views)
2014-04-10 04:04:31

BurntPizza (153 views)
2014-04-08 23:06:04

tom_mai78101 (249 views)
2014-04-05 13:34:39

trollwarrior1 (205 views)
2014-04-04 12:06:45

CJLetsGame (213 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!