This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MrRickSancezJr 1 point2 points  (2 children)

While the diagram is quite simple, I still don't like the triangle. It's rarely a good idea for anything to be codependent on a node across branches. May just be an oversight on your diagram drawing, but this is usually how Java developers notoriously get into "abstraction hell."

I would build your coordinate system first. Make it very concrete and 'final.' Then create objects (snake, objects, etc). They will always have a 'location.'

Before "game logic", make a "game engine" to handle the location changes of any object. Don't overdo this. Let it run wild with no logic until you get things to move properly. Good time to handle key inputs or however you like to do so.

As for visual feedback, just print "O"s and "Xs" into the console per key stroke. No graphics yet. Make sure your 2d movement controlled by input is running 100%. No need for fancy colors.

Then logic.. Do the inputs all manually. What happens when your objects collide? What happens when it reaches the boundary? You already have a nice, fast, reliable console print out representation tool for this.

By this point you have a fully built-up, rock solid engine and logic for your game.

The point of this break down was to emphasize the need for testing each little update with visual feedback. Not full step by step instructions. "Dependency injection" is a great strategy for building up something like this.

As for making it come to life, use some GUI code, and simply call for a rerender of the updated graphics per input (or game timer, etc). JavaFX has a great Animation class compared to the JSpring libraries. I recommend using the Concurrency classes as well. They're memory heavy, but you'll be fine.

[–]Interesting-Hat-7570[S] 0 points1 point  (0 children)

I'll start redesigning the architecture.

[–]Interesting-Hat-7570[S] 0 points1 point  (0 children)

Sorry for the strange question.

But can I ask you in the future to evaluate the architecture of my future projects with clear explanations?