Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
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  
  Game Engine library development  (Read 2172 times)
0 Members and 1 Guest are viewing this topic.
Offline Swami Rama

Senior Newbie





« Posted 2012-12-07 00:19:22 »

Alright so I was wondering how would you begin to develop a library around a game. I understand what a library is, but I've never attempted to make one. So how would you start off with making the window in the library so you can easily call it in your game without all the lines necessary to make a JFrame or what ever you needed. Hopefully that makes sense and maybe you clarify how simple it maybe, I usually over think things.
Offline theagentd
« Reply #1 - Posted 2012-12-07 01:19:09 »

A library is more or less a set of tools meant to help you make games quicker. For example
 - reading XML files
 - getting access to OpenGL (LWJGL, JOGL)
 - handling game objects
 - handling game menus and UI
 - a full game engine

With a game engine you don't have to code so much since the engine handles most of it. You pretty much only have to code things like game logic. The real work is filling the engine with content (images, menus, textures, 3D models, game logic, game content (items, skills, etc)). A game engine often comes with things like level editors and other editors for creating resources usable by the engine. Usually, the easier an engine is to use the more limitations there are. For example, a 2D game engine can't handle 3D graphics but is obviously simpler to use. Sometimes an engine allows you to work outside it or extend it, for example like how it's possible to do normal OpenGL calls while using Slick2D to do any kind of rendering (3D or 2D) you want.

Making your own complete game engine is a pretty bad idea in my opinion. It's a lot more work than most people think, especially the surrounding tools and deciding which features to implement, and in the end you might realize that it's not exactly what you wanted. You'll also not end up with a complete game, just an engine so the "reward" for your work is pretty much just the ability to make a game (hopefully) quicker than before. The chance that someone else is going to base their game on your engine is also pretty much 0 since not many people are willing to bet on a new unproven game engine.

I'd instead encourage you to write much smaller "libraries" for personal use. In other words write reusable code. I have a voxel renderer which I could easily use/modify to render a Minecraft world file (if I knew how to read a Minecraft save file that is Wink). I have a threading library I can use to multithread my games. I have a few classes abstracting things like OpenGL textures, tiled images, shaders, 3D cameras, etc. I have a frustum culler that can be used to check if objects actually will end up on the screen. I have a few pathfinding algorithms implemented, a fog-of-war renderer and some GUI stuff using TWL.

Many things can be shared between games that seem to be very different. A 2D strategy game needs pathfinding for the units, but so does a 3D first person shooter for AI controlled players. The same pathfinding "library" can be used in them if they're written correctly or with just slight modifications. Building up a bag of tools will help you make games quicker, but of course don't just make tools all day.  Wink Make them as you make games. Again, just write reusable code.

Myomyomyo.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 114
Projects: 4
Exp: 3 years



« Reply #2 - Posted 2012-12-07 01:51:24 »

In short.
Generalize everything.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Swami Rama

Senior Newbie





« Reply #3 - Posted 2012-12-07 04:24:08 »

Thanks for the replys, I understand that theagentd. Could you give me an example of a library that just holds making a JFrame ?
Offline theagentd
« Reply #4 - Posted 2012-12-07 04:33:44 »

JFrames usually aren't used for games since they actually pop up in a new window, which won't work in fullscreen and looks kind of lame for a game. Usually people implement some kind of GUI over the graphics library they use (usually either Java2D or LWJGL). Swing is based on Java2D so it is possible to implement a GUI with Swing components if you change some settings to it to use active rendering. LWJGL is trickier but there exists a powerful GUI library called TWL that I've been using for a while. It's pretty difficult to use due to the lack of documentation, but still easier than writing your own GUI. It's a very powerful library, supporting custom XML theme files and all which makes it a bit hard to use. There's a good subforum for it in the Slick2D forum though where the creator answers your questions within hours, which I have to give him credit for!

Myomyomyo.
Offline Swami Rama

Senior Newbie





« Reply #5 - Posted 2012-12-07 04:36:40 »

You say JFrames aren't usually used for games? What do you recommend then? An Applet?
Offline ReBirth
« Reply #6 - Posted 2012-12-07 05:37:09 »

Sometimes a skeleton could be mistaken as library.

Offline theagentd
« Reply #7 - Posted 2012-12-07 06:06:12 »

You say JFrames aren't usually used for games? What do you recommend then? An Applet?
No, listen... How many games pop up a real Windows window that appears on the task bar and can be minimized and maximized? It'd be so weird. The window could end up behind the game window!

Instead you could add for example a custom JPanel which overrides the paint() method to draw your inventory in it. You could also add a MouseMotionListener to it to implement the ability to drag it around manually. That way your inventory "window" is always on top and can be transparent and everything, since it's actually not a "real" window, just something drawn on top of the game.

Myomyomyo.
Offline Swami Rama

Senior Newbie





« Reply #8 - Posted 2012-12-08 06:32:00 »

Ok, you confused me. I am using all that, this is not my issue. Stated in the first post. Thanks.
Offline theagentd
« Reply #9 - Posted 2012-12-08 13:52:18 »

Oh, right, sorry. I meant that they don't use Swing JFrames for in-game windows. Sorry about that.

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

Senior Newbie





« Reply #10 - Posted 2012-12-09 00:11:03 »

Yes, you mean like adding a JPanel to it and painting to that component, right? If not please explain, thank you.
Offline theagentd
« Reply #11 - Posted 2012-12-09 02:18:50 »

Exactly.

Myomyomyo.
Offline Geemili

Senior Member


Medals: 9
Projects: 1
Exp: 2 years


No Games Finished


« Reply #12 - Posted 2012-12-09 04:51:41 »

(if I knew how to read a Minecraft save file that is Wink)

Base of everything mincraft save file:
NBT format
 persecutioncomplex
[/offtopic]
Offline Swami Rama

Senior Newbie





« Reply #13 - Posted 2012-12-09 17:05:07 »

@Theagentd
Alright, thanks.

@Geemili
Nice find, thank you.
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 (51 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (209 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!