Representing a Gameworld that is Irregularly shaped
Posted
by Aaron M
on Stack Overflow
See other posts from Stack Overflow
or by Aaron M
Published on 2010-06-03T18:35:30Z
Indexed on
2010/06/03
18:44 UTC
Read the original article
Hit count: 201
c#
|game-development
I am working on a project where the game world is irregularly shaped (Think of the shape of a lake). this shape has a grid with coordinates placed over it. The game world is only on the inside of the shape. (Once again, think Lake)
How can I efficiently represent the game world? I know that many worlds are basically square, and work well in a 2 or 3 dimension array. I feel like if I use an array that is square, then I am basically wasting space, and increasing the amount of time that I need to iterate through the array. However, I am not sure how a jagged array would work here either.
Example shape of gameworld
X
XX
XX X XX
XXX XXX
XXXXXXX
XXXXXXXX
XXXXX XX
XX X
X
Edit: The game world will most likely need each valid location stepped through. So I would a method that makes it easy to do so.
© Stack Overflow or respective owner