ondras / rot.js

ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, interactive manual, documentation, tests!
https://ondras.github.io/rot.js/hp/
BSD 3-Clause "New" or "Revised" License
2.33k stars 254 forks source link

3D field of view / lighting? #118

Open eranimo opened 7 years ago

eranimo commented 7 years ago

How difficult would it be to modify / fork rot.js to support 3D field of view and lighting? I realize 3D isn't the focus of this library. I want to implement a dwarf fortress style game and I would like lighting to have a z component. (this is what I'm talking about). Do the algorithms implemented here work as a base / starting off point for simple (as in grid-based) 3D games?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/47176062-3d-field-of-view-lighting?utm_campaign=plugin&utm_content=tracker%2F297828&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F297828&utm_medium=issues&utm_source=github).
ondras commented 7 years ago

Hi @eranimo,

all light-related algorithms in rot.js (LoS, FoV, Lighting) are topology-based. This means they heavily utilize the concept of "neighboring cells". So as far as you are able to extend those typical 2d topologies (4-, 8- and 6-neighbors) to a 3d space, we can probably make some effort in extending these algorithms as well.

I have never thought about a cell-based 3d game. Perhaps a vector-based approach would be more viable? But than these algos from rot.js are not really applicable (for reasons described above).