Author Topic: My FOV Algorithm for Atari 2600 Game  (Read 9027 times)

KarlG

  • Newcomer
  • Posts: 1
  • Karma: +0/-0
    • View Profile
    • Email
My FOV Algorithm for Atari 2600 Game
« on: February 17, 2020, 04:33:07 PM »
Hello, I am not actually making a roguelike at the moment, but I would like to take a stab at it eventually. What I am making is an 2D tiled Ultima-style game on the Atari 2600, so I have had to implement a FOV algorithm on there. I have extremely limited RAM (256 bytes) and CPU time to work with, so I needed to come up with something that would work on that platform. The result seems to be the same as what I've seen of the output of Permissive FOV algorithms.

Anyway, what I am wondering is if there are any existing algorithms that use a similar approach to what I did with my Atari game. Here's what I do to determine tile visibility:

  • The hero and all adjacent tiles are always visible.
  • For each tile in an orthogonal or perfect diagonal line from the hero, the tile remains visible if its adjacent "parent" tile one step closer to the hero is visible and not solid.
  • All other tiles have two "parent" tiles, which are the two adjacent tiles closest to the hero. If either of these parent tiles is visible and not solid, then the tile remains visible.

Obviously, the order in which tiles are checked matters, since the visibility of the parent tile/tiles needs to be known. In my case, I pre-computed the parent tiles for each tile and store those in the ROM of my game to save precious CPU time. How I'd implement it on a more modern system is doubtless different, but I'm curious if there are any existing algorithms that use a similar approach.

« Last Edit: February 17, 2020, 04:35:08 PM by KarlG »

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: My FOV Algorithm for Atari 2600 Game
« Reply #1 on: February 18, 2020, 11:11:50 AM »
That explanation is kind of vague, but if it works then it's quite clever! I have a faint recollection that this kind of routine has been discovered earlier.