Been having some real issues with normal LoS; First prototype being delayed by some serious bughunting. If you wish to be amused by how much of an idiot I am
here's a video of the current state of it failing. [The first Octant is behaving as expected the others are having various levels of failure; I'm sure it's sign problems in the linedraw/raycast algorithm. [I'm calling it linedraw because it's not the built in Raycast that draws a Euclidean ray, but a Bresenham line instead.]
I did think about plans on this project while AFK for a bit; I don't want to go too far into it, in case it doesn't work completely (not I can't make the game work mechanically, but even the basics not being fun); but:
Races:- Merfolk - The game's "Human" average at everything. Two rings, amulet, armour, weapon, shield, helmet. Only weapons available will be polearms (for early).
- Octopode - High dex. Boosts to stealth, dodge and unarmed. Eight rings, can use weapons, but awkward with them. Magically talented.
Areas:- Swamp - Full of plants; relatively shallow. Contains attackers that can strike from land.
- Sunken Temples - Traditional roguelike 'room' generation used in some, also columns, hallways. Going to creates a temple first for ease.
- Open Ocean - Primary walls apart from the seabed are plants. Enemies get stronger at lower depths. (like the mainline crawl, only no transition between floors, being able to dive anywhere.)
- Reef - Tight winding tunnels, stationary enemies.
- Trench - Low light limits your LoS, but not that of enemies. (Will get the drop on you by about two tiles). Full of undead and creepy creatures.
Magic Schools:- Earth - Works as normal. Going to confirm LRD ahead of time.
- Water - Replaces air. Focus on flows and movement.
- Ice - Switches to a focus on creating things. Make a javelin of ice and throw it, place a block of ice to obstruct the view.
- Fire - Highly unstable and short lived. Explosions like Fireball only.
Gods: Plan on using them. Probably implement Fedhas Madash first if I'm doing Crawl gods. I'm probably -not- going to implement a lot of the simpler gods (Sif Muna, Makhleb) and may or may not have a temple-like area. Area transitions will be a little of a challenge as it is. This is last in priority of all key mechanics after inventory; enemies and level generation though.
Anyways:Arrhythmia: I'll put them in as a second default (probably with Shift/Ctrl for Up/Down) Only reasons I didn't use Shift/Ctrl for the main set was...on a lot of keyboards they make the numpad do other things. (Page Up/Page Down, etc.)
Pubby wrote:I don't really see why you need to do LOS this way in an already 3d game?
But anyway, most of the raytracing of permissive LoS can be precomputed at compile time and stored in bit arrays. You're going to need a big lookup table, but the speed will be very good.
Pubby: You mean pretest every possible combination and have the data for that combination available as a BitArray or do all of the LoS tests on level generation?
The latter I don't particularly being any more efficient than testing on move it just frontloads the calculations (still need to be done at playtime because level generation isn't ahead of time; the former is a lot of tests, it'd have to parse back through. Suppose it's still less tests than actually performing all the raycasts at playtime, but it's a lot of data; even as bit arrays LoS of 5 (what I'm sticking to for now) contains 1330 spaces (excluding the player) which leads to google calculator is saying infinity combinations; 2^1330, I can't say I disagree it's going to be too much to have in memory. Suppose if you did it by Octant that would reduce to 216 spaces or about 1e65 combinations, but still too much to consider precalculating every combination. 3D squares the amount of data needed for everything. O_O;
Suppose I could write a daemon to automatically do it in the background while playing so there's no visible lag on move; but that'll come relatively late, because I don't see it providing that much optimization, unless there is a usage case I'm missing. I can see storing all the correct orders to check (the rays) as lists of offsets ahead of time (Vector3[]; not BitArray) and that providing some optimization, by using some memory instead of calculations, but even that isn't optimizing that much and could be quite the memory cost.
I need LoS, because:
- For now I'm copying Crawl's core mechanics exactly; so enemies could only attack you if they are in your LoS; thus this calculation decides what you can see as well as what sees you.
- In general what the player can and can't target needs to be calculated; this is a turn-based game and not an action one, so 'what the player can actually see' isn't the deciding factor.
As to just using the 3D engine for what the player can actually see; maybe. I'll have to write some shaders for it though.
- The key feature that needs to be different is that the attenuation from point lights needs to be based on Chebyshev distance, instead of Euclidean.
- Also for external cameras the Opacity needs to vary with distance and a few other factors to make the outside views more reasonable.
The way I'm handling it now is just turning the graphics completely off when not in LoS. Later on, I know I'm going to need to make a larger map; and for that I'm going to need something more than cubes. I do think that just using cubes near the player is reasonable enough; but for a larger map using planes with submeshes makes a lot more sense to save on drawcalls and vertex counts. [Reason I'm saying cubes is fine for within LoS is that with the LoS changing the graphics need to change faster and so far there haven't been any issues with 4096 cubes (current count).]
There's a lot left to worry about before trying to optimize the topology to make it easier on the renderer. A nice looking LoS via shaders would also be a cool art feature; but it's not a priority compared to mechanics working.
Anyways. I'll upload a new alpha as a cameras test when the current iteration of LoS (and likely the only one for control purposes for awhile) works. Unsure which camera angles to use ultimately and I do want to allow mouse look in the main window, but am unsure how to do that without it screwing with which direction is which from the player's PoV).
I'm beginning to feel like a Cat God! Felid streaks: {FeVM^Sif Muna, FeWn^Dithmenos, FeAr^Pakellas}, {FeEE^Ashenzari, FeEn^Gozag, FeNe^Sif Muna, FeAE^Vehumet...(ongoing)}