3d sokoban

Hi, I am a beginner, I am planning to develop a 3D sokoban game, I don’t know how to build a map for sokoban. Can anyone share some experience to me. Thank you!

I’ve not created a sokoban, but I do have some general advice about developing games with jMonkeyEngine:

  1. If you don’t have any Java programming experience, get some before installing JMonkeyEngine.
  2. Work through the jMonkeyEngine tutorials before trying to create anything.
  3. Implement an abstract version of the game (boxes, walls, goals, and avatar) before creating any textures, scene-graph controls, 3-D models, or other visualization. You might start with ASCII graphics and console input, for instance. This discipline will help you keep your game objects separate from your visualization and user-interface code.

And if you have no programming experience at all, you may want to start in the shallower end of the pool. I follow this guy on twitter and it seems like a nice approach:


Hi, how to determine that the box has been pushed to the specified position? When I am building the ground, should I represent each grid with a model(box) and then put them together?

There are multiple approaches and it depends on how you implement the game logic. If you want it to be 3d realtime with physics, you’ll use collision listeners. If you want the movement locked to a grid you’ll wind up implementing your own “turn” based approach where you check positions at the end of each “turn”.
I suggest the “turn” based approach for newbies as you will learn more about how to handle game logic instead of learning how jme handles bullet physics, on top of still learning game logic. You can make either approach 3d in the end, but as sgold says keep everything abstract for as long as possible.

1 Like

I would set the backend data first. So you move the box left, and the data states it’s new position immediately if the move is possible. The scene animates from the old position to the new position and probably sets an isMoving bool while it’s animating so it can’t be moved in the tween state until the animation has finished.

Try not to use the scene as data. It’s a representation of data. Separate them.


Thanks for your reply, how can I let the program know that a 3D model has arrived in an area? And how to set this area in JmonkeyEngine?

Hello, can you tell me how to build the stage, should I represent each grid with a model(box) ? Quite urgent… just need more details please…

“Building the stage” means two different things, depending on whether you’re talking about the scene (visuals) or the data (abstract game state). You should build the stage twice: first create the data (abstract game state) for the stage, using classes you design yourself, then translate that data into jMonkeyEngine scene-graph nodes, meshes, and materials (visuals).

To a newbie this doubtless sounds like double effort, but separating abstract game state from visuals will result in software that’s less buggy and easier to maintain. In the long run, it may even make you a better software developer.

1 Like

For example, with a properly separated view from game objects, you could write the visual part in Java Swing, libgdx, etc. (mostly) without changes to your game objects.

…and if you are struggling to figure out how you’d write the logic for the game objects of a sokoban game then you are going to get stuck no matter what. That’s fundamental and doesn’t happen by accident just because you’ve loaded some models into a scene and are trying to do stuff with them.

My advice from before still stands.

Is this for a class assignment? Maybe you should have picked an easier assignment.


Thank you guys, I understand what you mean, I will do the abstract part now.

1 Like

I agree. :+1: Very good point. I didn’t follow with my project ==> have to do rework.

1 Like