You actually might want something other than 1 for something unique like that...

by RpgFan (Login rpgfan3233)

 
Okay, well, you don't really need something other than a 1, but it makes it a lot easier. For example, you could use something like -1 instead of 1. A negative number could denote a starting point. Use the ABS function on the value to determine what the actual colour, sprite, etc. will be. If 1 represented a house for example, you could start from that house using -1.

Example:
####
DIM map(3, 6) AS INTEGER
DIM x AS INTEGER, y AS INTEGER

x = 0
y = 1

DO
FOR x = 1 TO 6
READ map(y, x)
IF map(y, x) < 0 THEN EXIT DO
NEXT x
y = y + 1
LOOP WHILE y <= 3

PRINT USING "Starting point: (# #)"; x; y
END

DATA 0,0,0,0,0,0
DATA 0,-1,1,1,1,0
DATA 0,0,0,0,0,0
####

The two alternatives to the above method that I had in mind were:

1. Add map coordinates after the end of the map to determine where the starting point is. You would READ the map data and after loading the map, you would READ two more numbers that sets where you start in your town.

2. Use a separate map with a single point for a starting point.

I like the method I detailed the most, but I also find alternative 1 to be a good idea as well. Alternative 2 could be a very poor idea. The general idea is that you have something like this:

Town Map:
0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0
0,1,1,1,0,1,1,0,1,1,0
0,0,0,0,0,0,0,0,0,0,0
0,0,0,1,0,0,0,0,1,0,0
0,0,0,0,1,0,1,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0

Character Map (your starting point AND where townspeople start off):
0,0,0,0,0,0,0,0,0,0,0
0,0,0,2,0,0,0,0,5,0,0
0,1,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,3,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,6,0,0
0,0,0,0,0,0,0,0,0,0,0

Notice how the 1 in both maps match? That would work as your starting point. It's a good idea in some respects, but it could easily get confusing, right? It's all a matter of your preference.

I hope I gave you some ideas. I honestly haven't done much game development, but in terms of being able to edit the data so easily, it's a start, right? Then when your maps are more permanent, you might find a different way to store them such as a single value from 0 to 15 (or maybe -8 to 7 depending on what method you choose) in 4 bits. That way you could actually fit two different values in a single byte, which is 8 bits. That might even be something like compressing the example character map and the example town map above into a single byte. That's all binary and hexadecimal though. For now, I would just worry about getting the maps done in a way that you can understand. ^_^



    
This message has been edited by rpgfan3233 on Mar 10, 2010 8:43 PM

Posted on Mar 10, 2010, 8:38 PM

Respond to this message   

Return to Index

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement