Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 2496 times)
0 Members and 1 Guest are viewing this topic.
Offline Swami Rama

Senior Newbie

« Posted 2012-12-06 23: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.
Online theagentd
« Reply #1 - Posted 2012-12-07 00: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.

Offline Jimmt
« League of Dukes »

JGO Kernel

Medals: 136
Projects: 4
Exp: 3 years

« Reply #2 - Posted 2012-12-07 00: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 03: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 ?
Online theagentd
« Reply #4 - Posted 2012-12-07 03: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!

Offline Swami Rama

Senior Newbie

« Reply #5 - Posted 2012-12-07 03: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 04:37:09 »

Sometimes a skeleton could be mistaken as library.

Online theagentd
« Reply #7 - Posted 2012-12-07 05: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.

Offline Swami Rama

Senior Newbie

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

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

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

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-08 23:11:03 »

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


Offline Geemili

Senior Duke

Medals: 9
Projects: 1
Exp: 2 years

No Games Finished

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

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

Base of everything mincraft save file:
NBT format
Offline Swami Rama

Senior Newbie

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

Alright, thanks.

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.

Longarmx (37 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (27 views)
2014-10-15 16:18:58

TehJavaDev (52 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (77 views)
2014-10-11 22:30:10
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06 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‑
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!