Wednesday, May 04, 2016

LearnJavaByTurnBasedGame - chapter 1

Learn Java By a Turn-Based Game

By Andrea Valente – –

[CHAPTER 1] Programming is expressing myself

I want to (re)make something in on my computer, and because of that I NEED programming.
When I was 10 I used to watch super-robots on TV (Grendizer and Steel Jeeg being my favorites) and I constantly tried to remake them with LEGO ( ). In the 1980s there were no specific pieces for making humanoid robots in the basic LEGO sets, so I was progressing in 2 ways: randomly assembling LEGO to see if I could get some useful features like a moving joint or a detachable punch rockets; at the same time I was trying to reason on the overall shape of the robots and re-build them with the available LEGO bricks. The results were kind of comic (looking back now) but I felt real pride in the exercise, and one of the results of this thinking process was that I went browsing LEGO boxes in shops looking for the pieces that I needed, instead of looking at the actual cars or houses that you were supposed to build with the box. Within a few years I put together a collection of various LEGO bricks in a large drawer in my bedroom: they were my toolbox and raw materials for my reverse engineering projects.

Grendizer toy

Kotetsu Jeeg poster

A typical LEGO set (mid-80s)

My LEGO Jeeg (early 1980s) 

Later, when I had my first computer (a Commodore 64) I found that the same way of thinking worked in programming too: you can go bottom-up and play with the basic commands to see what they do and mean, but at the same time you can think of something complete you want to achieve and break it apart in a top-down fashion, until you can re-build it. 
In this case I want to remake Nitrome’s Rust Bucket ( or Turnament ( ) or a game that feels like that.

Turnament snapshot

Rust Bucket screenshot

Reverse engineer a game

I have to start simpler, to be able to grasp what the game is actually doing. Also I need to start playing the game with a different goal in mind: not to win, but to test it, to uncover what the programmers and game designers put in the game, its rules, the way enemies moves and the subtle balance between what my character can do and the way the level is designed to be difficult but winnable.
First of all: Rust Bucket is a turn-based game, which means that nothing happens while you think about your next move. It is very much like chess, where you move and then the opponent (here the rules of the game) move. Each enemy moves in a different way, and the timing is a very important part of the game.
My remake will be called something funny that is also a pun on the original name, for example: Oxidized Pot (or OP for short).

The language: Java

I want to use Java for this project, but it could also be any other object-oriented programming language. For a theoretical introduction to Java just google it. As for the reverse engineering of robots with LEGO, I think I will get deeper understanding of my tools as I need it to solve the problems that arise in the projects.
I still need the equivalent of my LEGO drawer, which in programming is an IDE (Integrated Development Environment) and for Java a classic, free one is NetBeans (see When I download NetBeans I get a program to edit, compile and run and debug my programs, but also a Java Virtual Machine, compiler and other Java tools that are needed to be able to run my programs. These are my digital construction blocks and the tools required to express myself and realize my reverse engineering dreams (and perhaps even create new original games and applications).

The first time that I worked with an IDE like NetBeans I found it a bit weird and even simple things like opening an existing project or running my code was not that easy. To familiarize myself with new tools I find it useful to walk through a tutorial or 2. So after installing NetBeans I would probably take a quick look at a tutorial like this one: .
It show how to create a new project, and how to run it. Another tutorial that covers more or less the same topics is:
from Java's official documentation (a good place to look for Java-related material).

No comments:

Post a Comment