I'm making a small adventure game where the player can walk through Dungeons and meet scary characters:

The whole thing is 20 java classes and I'm making this a standalone frame while it could very well be an applet I don't want to make another applet since I might want to recode this in C/C++ if the game or game engine turns out a success. The engine is the most interesting part of the game, it controls players and computer-controlled characters such as Zombies, Reptile Warriors, Trolls, Necromancers, and other Persons. These persons can sleep or walk around in the game and also pick up and move things. I didn't add many things so I suppose that is the next thing to do is to add things that can get used now that I already added many different types of walking persons.

What do you think I should add and do with things in the game? The things I have so far is:

package adventure;
/**
* The data type for things. Subclasses will be create that takes part of the story
*/
public class Thing {

/**
* The name of the Thing.
*/
public String name;

/**
* @param name The name of the Thing.
*/
Thing( String name ) {
this.name = name;
}

}

public class Scroll extends Thing
{
Scroll (String name)
{
super(name);
}
}

class Key extends Thing
{
Key (String name)
{
super(name);
}
}


The key is the way to win the game if you figure our that you should give it to a certain person and the scroll can protect you from necromancers and trolls. If I make this game more Dungeons and Dragons-inspired, do you think will be any good? Any other ideas that you think I could use here?

The Threadwhich steps time forward and wakes up persons is called simulation. Do you think I could do something more advanced with this class?

package adventure;
{

private PriorityQueue Eventqueue;

Simulation()
{
Eventqueue = new PriorityQueue();
start();
}

public void wakeMeAfter(Wakeable SleepingObject, double time)
{
Eventqueue.enqueue(SleepingObject, System.currentTimeMillis()+time);
}

public void run()
{
while(true)
{
try
{
sleep(5); //Sov i en halv sekund

if (Eventqueue.getFirstTime() <= System.currentTimeMillis())
{
((Wakeable)Eventqueue.getFirst()).wakeup();
Eventqueue.dequeue();
}

}
catch (InterruptedException e )
{

}

}
}

}


And here is the class that makes up the actual world:

package adventure;
import java.awt.*;
import java.net.URL;
/**
* Subklass to World that builds up the Dungeon World.
*/

public class DungeonWorld extends World {

/**
*
* @param a Reference to adventure game.
*
*/
super ( a );

// Create all places
createPlace( "Himlen" );
createPlace( "Stairs3" );
createPlace( "IPLab" );
createPlace( "Dungeon3" );
createPlace( "Stairs5" );
createPlace( "C2M2" );
createPlace( "SANS" );
createPlace( "Macsal" );
createPlace( "Stairs4" );
createPlace( "Dungeon2" );
createPlace( "Datorsalen" );
createPlace( "Dungeon");//, "Ljushallen.gif" );
createPlace( "Cola-automaten", "ColaAutomat.gif" );
createPlace( "Stairs2" );
createPlace( "Fable1" );
createPlace( "Dungeon1" );
createPlace( "Kulverten" );

// Create all connections between places
connect( "Stairs3", "Stairs5", "Down", "Up" );
connect( "Dungeon3", "SANS", "Down", "Up" );
connect( "Dungeon3", "IPLab", "West", "East" );
connect( "IPLab", "Stairs3", "West", "East" );
connect( "Stairs5", "Stairs4", "Down", "Up" );
connect( "Macsal", "Stairs5", "South", "Norr" );
connect( "C2M2", "Stairs5", "West", "East" );
connect( "SANS", "C2M2", "West", "East" );
connect( "Stairs4", "Dungeon", "Down", "Up" );
connect( "Datorsalen", "Stairs4", "South", "Noth" );
connect( "Dungeon2", "Stairs4", "West", "East" );
connect( "Dungeon", "Stairs2", "Down", "Up" );
connect( "Dungeon", "Cola-automaten", "South", "North" );
connect( "Stairs2", "Kulverten", "Down", "Up" );
connect( "Stairs2", "Fable1", "East", "West" );
connect( "Fable1", "Dungeon1", "South", "North" );

// --- Add new things here ---

Simulation sim = new Simulation();

// Load images to be used as appearance-parameter for persons
Image studAppearance = owner.loadPicture( "Person.gif" );
Image asseAppearance = owner.loadPicture( "Asse.gif" );
Image trollAppearance = owner.loadPicture( "Loke.gif" );
Image necromancerAppearance = owner.loadPicture( "Necromancer.gif" );
Image skeletonAppearance = owner.loadPicture( "Reptilewarrior.gif" );
Image reptileAppearance = owner.loadPicture( "Skeleton.gif" );
Image zombieAppearance = owner.loadPicture( "Zombie.gif" );
// --- Add new persons here ---
new WalkingPerson(sim, this, "Peter", studAppearance);
new WalkingPerson(sim, this, "Zombie", zombieAppearance );
new WalkingPerson(sim, this, "Zombie", zombieAppearance );
new WalkingPerson(sim, this, "Skeleton", skeletonAppearance );
new WalkingPerson(sim, this, "John", studAppearance );
new WalkingPerson(sim, this, "Skeleton", skeletonAppearance );
new WalkingPerson(sim, this, "Skeleton", skeletonAppearance );
new WalkingPerson(sim, this, "Skeleton", skeletonAppearance );
new WalkingPerson(sim, this, "Sean", studAppearance );
new WalkingPerson(sim, this, "Reptile", reptileAppearance );

new LabAssistant(sim, this, "Kate", asseAppearance);
new LabAssistant(sim, this, "Jenna", asseAppearance);

new Troll(sim, this, "Troll", trollAppearance);

new Necromancer(sim, this, "Necromancer", necromancerAppearance);

}

/**
*
* The place where persons are placed by default
*
*@return The default place.
*
*/
public Place defaultPlace() {
return getPlace( "Datorsalen" );
}

private void connect( String p1, String p2, String door1, String door2) {
Place place1 = getPlace( p1 );
Place place2 = getPlace( p2 );

}

}


Thanks

• "I didn't add many things so I suppose that is the next thing to do is to add things that can get used now that I already added many different types of walking persons. What do you think I should add and do with things in the game?" This is inviting a discussion - it isn't a question and can't reasonably be answered. I'm voting to close. Have you tried asking chat or GameDev.net? – doppelgreener Jun 19 '12 at 10:35
• GDSE is not a place to poll for ideas. See the FAQ about what types of questions to ask here. – MichaelHouse Jun 19 '12 at 13:49
• You're wrong, there a perfectly reasonable answer right here and my question was reasonbly answered. We should be allowed to ask for improvement proposals. – Niklas R. Jun 20 '12 at 11:09
• Your lines that look like this new WalkingPerson(sim, this, "Peter", studAppearance); looks like very bad code design. I assume you pass sim, and inside the constructor, it adds the WalkingPerson to the simulation, like to a list or something? – William Mariager Aug 6 '12 at 15:57

I noticed that English isn't your first language. That's okay, it's my second language too. ;)

1. It's easier to port English to Danish than in reverse.
2. Somebody else can extend your code if she knows English.
3. You can outsource translations and resource creation to somebody else (who may or may not speak Danish)
4. It helps when you're asking questions on StackExchange if you don't have to mix native terms with English terms.

You've said that you might want to rebuild it in C++ later. What I think is stopping you from doing that right now is that your data is coupled with your code.

• Your map that connects the rooms.

Take a look at data-driven programming. This is a way to define your data outside of your code, so you can write any number of implementations for it.

connect( "Stairs3", "Stairs5", "Down", "Up" );
connect( "Dungeon3", "SANS", "Down", "Up" );
connect( "Dungeon3", "IPLab", "West", "East" );


Why not have a datafile that looks sort of like this:

[Stairs3] VERTICAL [Stairs5]
[Dungeon3] VERTICAL [SANS]
[Dungeon3] HORIZONTAL [IPLab]


<Dispenser name="Cola-automaten">
<Item type="Cola">Avslagen Cola</Item>
<Item type="Cola">Iskall Cola</Item>
<Item type="Cola">Cola Light</Item>
<Item type="Cola">Cuba Cola</Item>
</Dispenser>


Now you can parse this XML and turn it into the Java code you have right now. With a distinct advantage: you can add a new type of cola without changing a single line of code!

Ultimately, your game is nothing more than a state machine for your data. And if your data is decoupled from your game code, then you can write any number of implementations in any number of languages you want.

Finally, let me close with a practical example: Angry Birds is available for iPhone, Android, BlackBerry and Google Chrome. How do they do that? Well, they take their datafiles (sprites, physics settings, level design) and write a game implementation for each platform. This is expensive in terms of time and money, but it works quite well for them.