Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
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  
  Write my own personal library?  (Read 535 times)
0 Members and 1 Guest are viewing this topic.
Offline nhmllr

Senior Member


Medals: 1
Projects: 3


slow and steady...


« Posted 2013-02-15 04:52:51 »

I'm starting to plan out my next major gaming project in my head.

One of the things I know the game will need is pretty involved level design. I'm going to be using dozens and dozens of different entities with different initial settings and such.

What this means is that MS Paint won't cut it anymore. I want to make my own level editor to easily create and "export" levels.

I'm thinking that I want both my level editor application and my actual game to read from some of the same classes, so I don't have to copy and paste code every time I change a line of code, which I just know will end in some frustrating bugs.

Does anybody else have experience with something like this? What's the best way to go about it?

Thanks
Offline ctomni231

JGO Wizard


Medals: 99
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #1 - Posted 2013-02-15 05:26:17 »

Well, to put it as simply as possible.

You want to write one class that holds your game. Make sure your map and objects is made of something you can modify, (like an array of numbers each representing a tile). The editor's job would be just to  fill in those numbers. You should be able to accomplish this in 2 classes minimum, depending on how complex your game is.

Just keep the editor logic and the game logic separate.
Leave the map and object data able to be modified.

Offline Grunnt

JGO Wizard


Medals: 68
Projects: 8
Exp: 5 years


Complex != complicated


« Reply #2 - Posted 2013-02-15 11:54:27 »

Does anybody else have experience with something like this? What's the best way to go about it?

One approach that I used is to create 3 separate projects (e.g. in Eclipse):
- Game
- Editor
- Library (with common code, i.e. for loading levels / some graphics code etc)

In theory you would then also be able to use this library for other games you make. I say "in theory", because in practice I noticed that maintaining one generic library that stays compatible with different projects is extremely hard since my libraries tend to evolve very rapidly, requiring me to rewrite earlier projects to maintain compatibility. So instead of this I currently just keep the "library" code inside the main game project, but in a separate package. For each new project I copy the best-fitting library code to the new project and start working with this copy (which will then evolve further along with the new project).

Anyway, it's quite easy and helpful to put shared code in a library, just be careful to do this in a way that helps you and does not become an obstacle.

Edit: you can add a library project to your project's build path in Eclipse using the build path settings.

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.

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

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

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

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

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

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

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

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

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

Longarmx (38 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!