Friday, June 10, 2011

Minificus

(I like that name, by the way, but it's not the final title - just a WIP name!)

So, there are three major parts to Minificus that need to be coded:

1) Battles
2) Exploration
3) Menus

I think they're pretty self-explanatory. Anyways, both battles and exploration depend on menus, so that would probably be a good place to start. HOWEVER~ this is also not necessarily the *best* place to start. Getting a quick exploration demo would be easier and probably better! So, that's where I'll start - a guy walking around a small dungeon.

So... first-person is what I've decided on. That is, first-person in the style of Myst or really old computer games (like Bard's Tale or Wizardry). There's no actual 3D being employed - just a series of walls that get reconfigured based on your surroundings. Let's see...

A map consists of a 2D matrix of 0's and 1's (to begin with, but other numbers will be employed later, as well as letters, to represent other things). A 0 means an empty floor, while a 1 means a wall. The game keeps track of the PC's location on the map as a pair of (X, Y) coordinates, as well as the direction the PC is facing.

So, if we have:

11011
11011
00000
11011
11011

Then the PC could be represented visually as such:

11011
11011
00^00
11011
11011

The PC's coords would be (2, 2), and would be facing "North". The sections of the map that would matter visually then (that is, the parts that would need to be rendered) would be a cone in front of the player. If a section blocks sight, then there's no need to check sections that it blocks. To draw it visually:

_***
*****
_***
__^

Would be the approximate sight-cone for the PC if he's facing North. Everything in that pattern needs to be checked, but in a particular order:

_98A
64357
_102
__^

So, if 0 (the first one to be checked) is a floor, then we need to draw a floor on-screen and keep checking the rest - if it's a wall though, then we draw a wall and ignore 3, 4, 5, 8, 9, and A - 1, 2, 6, and 7 are still visible though, so we need to check these. Of course, this means that there are myriad special cases that need to be considered... or I could just write an algorithm that does it! But I've talked enough already. Time to do other things.

No comments: