Where to start? That's a good question. I wanted to write my own game
from scratch but didn't really know where and how to start. I had been
studying Thomas' Qhack and decided to start making changes to it to get
a handle on what needed to be done.
I started out by changing the opening screen, simple enough. Then I
start playing with the player structure, adding stuff and changing this
and that, until it was more like what I wanted to use. Next came the
character generation code. I added things like race selection, class
selection, and a character information screen. I was thinking at this
point that this was going to be easier than I had first thought.
Now I wanted to change the RLG (Random Level Generation) code. Thomas
uses a sectional approach to creating his levels. The Levels that were
generated I liked, what I wanted to change was how the level was
represented on the screen. The way he had it set up each tile had to be
different. In other words one tile for an open door, closed door, locked
door, floor, wall, etc. etc. When the map was created the character for
each tile was used. It was also used to detect the different types of
doors therefore they had to be different. What I wanted was like
traditional roguelike in that a locked door looked like a closed door
and you didn't know it was locked until you tried to open it. What I
wanted to do was create a tile structure that would contain the symbol
for that tile, the color information, and string name which could
possible used later in a lookup type function.
Now I was feeling pretty good about the changes that I had made in the
character generation section so I wasn't expecting any major problems
with the changes I was about to make. After making the changes I hit
Compile, there are some errors but nothing major. Fix those and it
compiles with no errors. Now I make the executable. No errors. So far,
so good. Run the program, well it sort of worked. Instead of the
characters that were supposed to be on the screen I get smiley faces,
hearts, clubs, etc. Hmmm, what went wrong, that should have worked.
Okay, let's try this. Compile, make, run, nothing, no characters are
drawn on the screen. Try this, no good. Try that, no good. Okay so maybe
this won't be as easy as I thought.
So, now what do I do. Start over from scratch. I feel comfortable
enough that I should be able to start from scratch using my ideas and
some of Thomas' code to make it work. I create my opening screen. Next
step, character creation. I create a player structure similar to what
Thomas originally had but to the specifications that I needed. I create
the tables that will be needed during generation. I write the code to
generate the stats and then adjust for any bonuses or penalties. Create
a character information screen.
For the level generation I decide use the code that Thomas wrote to
generate the levels but to use mostly my own code to build the map and
display it. I create the dungeon structures using the same code that is
in Qhack with some changes to make it work with my own ideas. I create
the tile structures and then add the dungeon generation code one
function at a time, compiling and making until it compiles and makes
without any errors. After doing this I understand more about what is
going on. I can now change the map building code and the display code so
that it will work with my tile structure. Now there can be different
tile with the same symbols.
Things are starting to look better now. I have placed the PC on the map
and changed the movement code form the I, J, K, L keys to the 2, 4, 6, 8 keys.
Added the code to open closed doors. Now you can walk the character
around on the map and open closed doors.
Back to Introduction.
On to Entry 2 - Monsters.
|