Hey guys, i was hoping to get some advice on a project i am about to start. basically I have just started learning J2ME, using Netbeans. i have went through few tutorials from Hello World to Pong and completed them working fully. Now my project is something not too difficult I hope what i wanted to do was create a dungeons and dragons type game.

Basically I see my game as a start screen, the user presses start and then the player enters a castle and then there are either 1-4 doors available to walk into one on each side of the screen, the bottom door will always be to take the player to the previous screen.
I have just started the project, but before I even enter any code i was hoping I could get some advice form you guys first. IN each room I hope to have things for teh player to interact with, wether it is a treasure chest, dragon, another human or traps, I have not decided yet.

I was thinking of having a class one for each screen, but many screens means many classes. I am not even sure how to start with the titlescreen as i am completely new to J2ME.

any help would greatly appreciated!

Thanks!

Dani AI

Generated

Good direction so far from and useful input from . A few practical, J2ME-specific pointers that fill some gaps and help get a working prototype quickly.

Start small and data-driven rather than one class per room. Represent a room as a compact resource (tile map + object list + door positions). At runtime load that descriptor and instantiate a few generic entity types (treasure, NPC, trap, chest). That keeps the codebase small, makes changes easy, and prevents a class explosion as the number of rooms grows.

Use the MIDP game classes and a single game loop thread. Render into an off-screen Image (double buffer) and blit to the screen in Canvas.paint to avoid flicker. Prefer polling keys with the Game API (key states) rather than relying solely on keyPressed/keyReleased events—device key mappings vary a lot. Leverage javax.microedition.lcdui.game.Sprite and TiledLayer for animation and tile collision; they are optimized for MIDP devices.

Memory and performance tips: pack artwork into sprite sheets, share images across rooms, lazy-load room resources, and reuse objects (object pools) to reduce GC churn. Keep images small and the JAR compact—OutOfMemoryError is the most common blocker on real phones. For saving progress, use RecordStore (RMS) rather than files.

Concrete first steps: implement a tiny prototype with one title screen, one room, a single door transition and one interactable. Make that solid, then add room descriptors, a simple entity system (update/render/handleCollision), and persistence. Test early on a low-end handset as well as the emulator; behaviors that look fine in the emulator often fail on older hardware.

Minimal loop sketch (pseudocode):

Image off = Image.createImage(w,h);
Graphics offG = off.getGraphics();
while (running) {
  int dt = now - last;
  int keys = pollKeys();    // GameCanvas.getKeyStates()
  update(dt, keys);
  render(offG);
  repaint();                // paint draws 'off' to screen
  sleep(16);
}

These choices keep iteration fast and make refactoring easier once mechanics are proven.

You better get your facts straight...

I am not even sure how to start with the titlescreen as i am completely new to J2ME.

basically I have just started learning J2ME, using Netbeans. i have went through few tutorials from Hello World to Pong and completed them working fully.

YES you do need different rooms, but NO for everything. Obvious you need some sort of AbstractRoom, that can be extended by simple ConnectionRoom with doors to different directions, TreasureRoom, TrapRoom and FightRoom. Well that is at least what I would at least try for start, latter on there is always time for refactoring and abstraction.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.