| MAIN | NEWS | FAQS | LINKS | ARTICLES | WORKSHOP |
Send Mail To:Steve Register
AOR Work In Progress: Entry 5 - Objects and Inventory [Steve Register].
Hi Guys and Gals,

   Well it's about time I did another article. It's funny how people act
sometimes when you're trying to work on a roguelike. For example, the 
people I work for actually expect me to be productive and my family thinks 
I should spend time with them instead of working on my game. I did find 
some time to work on it so this is what I'll write about.

   When I made my last post I had a problem with the program failing while 
it was drawing the map. After some troubleshooting I found that I had a 
bounds problem. I placed some bounds checking and the problem went away. 
The way that I understand what was happening is Thomas' original code 
initialized the map array to -1. When I changed it I was initializing it 
to 0. The map was 105 characters wide. If the right side of the map was 
scroll left, the edge would end up anywhere up to about 10 characters into 
the screen. The left edge may be at 80 on the X axis. When the routine to 
draw the map ran it would not stop at the end of the array, which was 105, 
but would go to the end of the screen. This was fine most of the time, 
but every once in a while there would be something that could not be 
printed at the memory location that was out of bounds. Now I check to see 
if the upper limit of the loop is within the array or not. If it's out of 
bounds then I change it to the upper limit of the array.

   I also started working on adding objects and PC inventory routines. 
Basically what I did was take the monster code and changed it to create 
objects. Now the dungeon is stocked with objects on the levels. At the 
moment I only have four objects so that I can start working on the routines 
to handle the objects. I have a shield, sword, armor, and a potion. I 
have the code in place so that when the PC walks over the object it 
generates a message saying what the object is that the player is standing 
on. I have the code in place so that while the player is standing on the 
object, they can pick it up and it places it into the inventory.

   I have been working on the inventory system and trying to figure out how 
I wanted to do it. I have decided on the player having 26 slots. When I 
implement the weight system, as long as the player stays under their weight 
limit all 26 slots will be available. If the player goes over their weight 
limit even if a slot is empty they won't be able to carry more. Also once 
an object is placed in a slot it will stay in that slot. New objects will 
go into the first empty slot in the list. The system to manipulate the 
inventory will be similar to ADOM's. When you press 'i' to call up the 
inventory you will get a screen that will display the personal equipment. 
You will then be able to select what you want to equip or remove as in ADOM. 

   That's about as far as I have gotten. I still need to write the code to 
move an object from the inventory to the personal list. Once I have this I 
can start adding the code so that the player can make use of the object.

   The next big step is to start with the monster movement and have the 
monsters start fighting back. I also need to start thinking about how I will 
implement Magic. I only have the fighter class now. Once I get this work 
fairly well I'll start adding the other Fighter type classes. The Magic 
classes (wizards, priest etc.) will be the last classes I'll add.

   Let me take this time to thank Darren again for letting me do this 
article and to the people who have visited my humble web site. At the time 
of this writing there had been 358 visitors. This is more than I thought I 
would have had.

   Thank You All

Back to Entry 4 - Combat.

© Copyright 2001 Steve Register.