Dungeon Fodder Update #6
This week I added level transitions and automatic saves! :)
Dungeon Fodder Update #5
Not too much time this week: I added a second (simultaneous) character and some more rudimentary UI.
Dungeon Fodder Update #4: Dungeon generation
This week I added some rudimentary dungeon generation code to DungeonFodder. You can see what it looks like on YouTube.
EDIT: Eventually I expect to have a certain chance that a level will be a “special” level that’s been made by hand instead of randomly generated. Same for rooms - some of them will be “special” rooms.
There’re a lot of improvements that can be made to this approach - and so far it doesn’t add much content to the rooms, just the infrastructure. Here’s a quick explanation of how it currently works!
Rooms are created as regular 3D Unity GameObjects, complete with scripts and all. Then, the dungeon generation script takes each of these objects, converts their dimensions to a 2D tile-based system and determines where the room has openings for corridors.
Rooms are split into “large” and “small” rooms, so that the engine can produce many small rooms and a couple of large ones, depending on what feel the level should have.
The script then chooses a random number of rooms of each size, based on a range for the level. For each room it wants to place, it picks a random rotation (n * 90°), and places it at a random location in the world. If the location is taken by another room, it starts searching for a free spot outwards from the initial random location.
Large rooms are placed before small rooms, to prevent the fragmentation from getting out of hand. A random “large” room is picked to be the “spawn” room.
Monsters & loot
Each level has a configured range of “monsters per tile”, like [0.1, 0.4]. For each room, it picks a random number in that range, and multiplies that number with the “square tileage” of the room. It skips the “spawn” room.
Currently, the spawn algorithm is very naïve. There’s also no loot being spawned.
Then, each “opening” in a room is connected by the shortest path to a neighboring room (using an implementation of the A* algorithm), but if a room has more than one “opening” then they are connected to different rooms. We tell our A* to count unpathed tiles as a bit more expensive than pathed tiles, so that paths will get reused.
Finally, each room is connected to the spawn room to ensure that we don’t have any disjoint “sub-dungeons” that aren’t connected to the rest of them. This time we configure our A* to count unpathed tiles as much more (currently 20x) expensive than pathed tiles, to encourage it to not create unneccessary paths.
Feel free to contact me on firstname.lastname@example.org or twitter
This week I’ve been deep in non-visible changes, working on a dungeon generator. While there’s not any good visible output yet, here’s the other stuff I had time to do this week:
Basic inventory, supports drag, still missing drop (and on-hover descriptions) ^_^
Initial minimap - should probably not render lighting etc, but it works!
Dungeon Fodder Update #3
Not too much time this Sunday, but I added some very rudimentary loot support: Boots of speed +50%!
Dungeon Fodder Update #2
Path finding, HUD, health, and player death.
Livecasting your desktop in OS X
EDIT: Found a way to get audio using Soundflower & sox.
EDIT 2: RTP+SDP was somehow garbling the output, new and improved script now uses FIFOs!
Turns out that livecasting your desktop in OS X is surprisingly hard. I found two ways online, none of which satisfied me, so I hunted for my own.
Adobe Flash Media Live Encoder, CamTwist & Soundflower
This method, described by Mike Chambers, relied on three separate GUI tools (one of which was required the Adobe Flash Media Live Encoder), consumed all my CPU, and refused to support my 16:10 aspect ratio. Yikes.
One simple app to do everything, but sadly it only supports streaming to Ucast, downscales to somewhere near the resolution of a feature-phone from 2000, and still constantly complains that I don’t have enough bandwidth. You can get the “Pro” version for $200 which gives you “HD Broadcasting” - but no thanks.
So, based on Tyler’s Linux approach, I tried getting something similar working on OS X. It only used ffmpeg, and seemed to work pretty well.
Surprisingly, my researched ended up with the following results:
ffmpeg doesn’t support screen grabbing on OS X
ffmpeg doesn’t have a single audio input that can read an audio device on OS X (see OpenAL section below)
ffmpeg can’t record a web cam on OS X (this would allow me to use CamTwist as an input source)
1. VLC doesn’t support streaming to an RTMP server
1. VLC can’t record from an audio device
1. The only other app that’d stream audio live from an audio device to a fifo or pipe was
Any of these statements might be wrong, so please tell me if you know a way :)
So, the best I could do was have VLC stream the screen over a FIFO to
ffmpeg, redirect audio through Soundflower, then use
sox to pipe audio to
ffmpeg recodes all that data and sends it to the justin.tv RTMP server. Not very simple, but at least it works.
Turns out that this works best if you do no work in VLC other than spew to a FIFO: no encoding or encapsulating. Even using MPEG-TS had issues in this context. Raw video in a dummy mux is passed over the FIFO to
ffmpeg is allowed to do all the encoding.
In any case, I figured I should share this with the rest of you.
Here’s a modified version of Tyler’s script:
ffmpeg can theoretically record input devices on OS X using OpenAL - which ships with OS X by default. I spent some time trying to get homebrew to build it (patch here), but when I finally got it building I realized it was completely broken. Yay!
I’ve started sharing some of the generally applicable code I’ve developed for Dungeon Fodder on GitHub. So far: PathMoveable, a path walker (using Unity’s CharacterController) that uses AngryAnt’s Path for pathfinding.
Dungeon Fodder Update #1
First video of gameplay from my alpha game, Dungeon Fodder.
So far: Very rudimentary AI, health, gibs, zombies and magic missile.
About a week ago I started playing around with Unity3D, trying to learn the ropes of the engine so that I could start making a game with it. This is that game: Dungeon Fodder.
Dungeon Fodder will be a dungeon crawler, inspired by great games like Nethack, Gauntlet) and Cannon Fodder) (!). While it’ll be a learning project, I’ll also focus on having my mechanics playable and fun as soon and often as possible.
It’ll be in the third person, hopefully feature a small group of adventurers (like Cannon Fodder), fast paced and action-oriented.
First up: Simple dungeon rendering, camera & control. :-)