Dark Streets Tech Demo 1
Hi all! Dark Streets is a first-person shooter, mechanically most similar to Wolfenstein 3D or Blake Stone, but also inspired by Doom, Blood, and Ion Fury. I have been slowly developing this game in my free time over the last year and a half. I referenced LoDev and a paper by Amanatides and Woo for some of the raycasting steps, but the rest of the code and graphics are mine. Enjoy a small preview!
Raycasting renderer
Since the setting of the game is a city, I specifically wanted to write a renderer that could draw tall buildings, short objects, doors, and interiors. I think I am pretty close.
- Pretty performant: Everything below takes up only 50-60% of CPU, unless you go crazy with geometry and distances.
- Fixed camera height: This makes walls look better. Originally, I had variable camera height and headbob, but that made textures a bit too jagged.Might reconsider based on performance later.
- Variable brightness: Based on distance, using draw palettes.
- Floor textures: Pretty basic, using horizontal TLINE
- Multiple floors! Normally, I see raycasters render just one floor (Caped Feline Arena and Anarch are notable exceptions), so this is a bit unusual, and it allows more interesting designs.
- Ceilings. Although texture-less, ceilings are rendered separately from the sky, and allow for features such as archways, underpasses, and building interiors.
- Animated doors: They are also rendered halfway on the tile to stand out from the walls.
- Z-buffer and clipped sprites: This piece is not very efficient yet, but works pretty well.
Gameplay
You can walk around, open doors, pick up and fire weapons (but can't defeat the enemies yet).
- Variety of objects: Solid obstacles, ceiling decor (can be walked under), floor decor (cannot be walked through, but can be shot over)
- Five weapons: Infinite pistol, shotgun, Gatling gun, flamethrower, and a rocket launcher (unfinished).
- One large level, hoping to keep it like that for final game. Might not be possible with number of objects per level.
- Health and weapon pickups.
- Weapon switching: When picking up a new weapon and when running out of ammo.
- Enemies: Basic move-aim-fire behavior, in beginning stages.
Known issues
- Looking through open doors is slow. This is due to calculations on which vertical slice must be rendered for the door on each ray.
- Adding many objects will slow the game down a lot, due to many visibility and collision calculations.
Thanks
Big thanks to other PICO-8 first-person games for motivation:
- Trial of the Sorcerer
- Caped Feline Arena
- Star Beast
- Whiplash Taxi Co
This is a truly fantastic "open world" tech demo... Would stairs (or other such magic) be possible in this? It looks like you're occluding rendering anything above a certain height, so I imagine you could do the opposite (e.g. find stairs, go up, set new minimum z-height)
> This is a truly fantastic "open world" tech demo...
Thank you!
> Would stairs (or other such magic) be possible in this?
I believe so, in a way. What I envision is this:
- When player walks up the stairs, head position gets higher
- When player head position is right above the first floor, player is teleported to an identical-looking "second floor" (somewhere else on the map)
- Now player is on the "second" floor, so move the head position to the bottom, as if player is still coming up the stairs
- When player walks all the way up the stairs, their head position is back at mid-height.
(I hope this made sense)
The biggest issue with multiple floors (or having the view above the first floor) is that it becomes difficult to calculate occlusions for sprites - I'd have to use a 2D z-buffer, and clip the sprites using that, which would probably be slow... Or there might be a clever way to do that using upper memory? I would need to think about it.
@yaky - this is looking good! Really interested to see if you can keep it a single map.
If you decide to investigate multi-floors, I would highly recommend https://www.lexaloffle.com/bbs/?tid=46713 by paloblancogames for an example of a 2D z-buffer (I have adapted this for my current project), as well as Zep's cast.p8 demo (for an example of the most stripped down multi-level raycaster). You won't be able to use your tline floors (I think), but with textured walls it might not be that noticeable anyway.
Thanks for the CFA shout-out too :)
> If you decide to investigate multi-floors, I would highly recommend https://www.lexaloffle.com/bbs/?tid=46713 by paloblancogames for an example of a 2D z-buffer
Thanks! That's one 3D game I remember seeing a while ago, but couldn't recall the name of.
> Thanks for the CFA shout-out too :)
I see you also made Cab Ride, which was one of the first games I played on PICO-8, it's super chill.
[Please log in to post a comment]