| MAIN | NEWS | FAQS | LINKS | ARTICLES | WORKSHOP |
Send Mail To:Steve Register
AOR Work In Progress: Entry 3 - Map Arrays [Steve Register].
	Well it's time for an update. Since this is suppose to be my view of
the problems that arise and my solutions, let me tell you about one of the
biggest problems that you will probably face. Finding time to do programming. 
I was off the week of April 6th. I was thinking this would be great and that
I would be able to get a lot done to my game. Wrong! What I thought I should 
do during my time off and what my wife thought I should do was completely 
different. Needless to say I didn't get as near as much time to program as 
I had thought I would.

	Since I wrote the first installment, I changed my map structure so 
that I would have a layered map. At this point the bottom layer is the 
dungeon layout, the next layer will be the misc. objects, the top layer 
will be the monsters. The way this will work is that each cell will be 
checked. If a monster is found at the x,y coordinates then the monster 
tile will be printed. If no monster is found then check the object layer. 
If an object is found print it if not then print the dungeon tile. 

	I started by changing the existing map array from a 2 dimensional 
array to a 3 dimensional array. Then I changed the dungeon code to reflect 
this. Once I had this working. I started working on the monster code. I 
looked at the code again. Going through the code one function at a time I 
found where Thomas was saving the x,y coordinates for the monsters. I 
changed the code at that point so that instead of saving the x,y coords. 
to the monster structure, I saved the monster index to the monster layer 
at the x,y coordinates. 

	Now I had to change the display function to work with the new set 
up. My first couple of tries didn't work. I finally figured out that I 
was not getting the information in the right sequence. The character 
tile and color is stored in a monster default array. The monster 
structure for a particular level has a structure variable called mindx. 
This ties back to the monster default structure to tell what type of 
monster it is. The monster map contains the number of the particular 
monster in the monster structure. 

	Once I got this working, I wanted to see what would happen when 
the map scrolled to a different section of the screen. Monsters that 
were in a room still disappeared when the room moved to a different 
part of the screen. I must have worked on this for about 2 hours 
trying different things with no success. I was looking at the code 
when somebody finally turned the lights on. There staring at me in the
face was a call to the line of sight function. This was in the section
where the monster tiles were being printed. It was and' with a check 
of the monster map. So if there was a monster at a particular x,y 
coordinate and it was in the line of sight of the PC then the tile was 
printed. Since the PC was out in a hallway some where when the map 
scrolled the monsters in the rooms were no longer in its line of 
sight and was not printed, Duuuhh. 

	After I commented out the line of sight call everything 
worked like I thought it should work. I'm thinking of adding another 
layer to the map and maybe call it the memory layer. This way any 
part of the dungeon that is not in the players line of sight will 
be printed from the memory layer and what is in the line of sight 
will print what is actually there. This way things can change and 
the player won't know until it comes within it's line of sight.

	So now I have the monster array working now it's time to 
start working on some combat routines. In my system when the player 
first engages the monster there will be a check to see who gets the 
first attack. This check will only be done on the first attack. If 
the player changes targets or moves and comes back then the check 
will be performed again.

	This is where I'm at, at this point. I want to create an 
object structure so that I can place a weapon in the players hand 
to do combat with. I will also have unarmed combat.

Until next time....

Steve Register
Saregist@nlamerica.com

Back to Entry 2 - Monsters.
On to Entry 4 - Combat.

© Copyright 2001 Steve Register.