Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 1438 times)
0 Members and 1 Guest are viewing this topic.
Offline nhmllr

Senior Devvie

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?

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 Kernel

Medals: 143
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  

EgonOlsen (60 views)
2018-06-10 19:43:48

EgonOlsen (42 views)
2018-06-10 19:43:44

EgonOlsen (61 views)
2018-06-10 19:43:20

DesertCoockie (241 views)
2018-05-13 18:23:11

nelsongames (142 views)
2018-04-24 18:15:36

nelsongames (141 views)
2018-04-24 18:14:32

ivj94 (883 views)
2018-03-24 14:47:39

ivj94 (144 views)
2018-03-24 14:46:31

ivj94 (795 views)
2018-03-24 14:43:53

Solater (159 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!