jump to navigation

Crafting a Vintage CRPG: Part 4 March 21, 2015

Posted by sandyclaus in Academic Technology.
trackback

What I discovered was, there was no mapping scheme. Just a lot of grinding and processing going on. Every individual square on the screen is individually calculated, a task beyond anything you could ever do in TI BASIC, or even Extended BASIC.

The algorithm is, in fact, very simple:

First, it buffers the window seen on the screen out of the main map, which is 11×11 tiles, or 121 bytes. This is the master, with all tiles visible. Moving objects, like monsters, are placed on it.

Second, it creates a second buffer of identical size, with tiles starting out dark, except the center, where the player is. This is the view buffer, what the player will actually see on the screen.

Third, starting at the first byte in the buffer, representing a tile, a path is traced towards the center.

The path tracing does not use any complex mathematics, like the Pythagorean theorem. Instead, it uses two data arrays to determine in which direction a path must take, based on its position on the screen.

If while traversing the path it runs into a tile that blocks line-of-sight, the process ends and it moves to the next tile in the buffer.

If it reaches the center, the start point tile is uncovered by copying the byte from the master to the view buffer in that same position. Then it moves on to the next tile in the buffer and the process starts over.

via Crafting a Vintage CRPG: Part 4.

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: