First some news: Provided I don’t fail either of the classes I’m in right now (highly, highly unlikely) I will be finishing my undergraduate degree within the next 2 weeks. Also, I should be getting an acceptance letter to go to graduate school shortly, based on what the professor who has hired me tells me. However, due to my brother being sick I’ve asked to delay officially starting graduate school until May, the start of the summer semester, so that I can be here if he needs me. This leaves me with a lot of spare time, as it isn’t quite long enough to get a job, and if my brother gets better I’ll see about moving up my start date. I’m going to try to fill my time with some colloquium, possibly auditing a class or two, and reviewing older classes before starting grad school, but I’m thinking I might want to start a project to fill my time.
On that note, I’ve been listening to the Roguelike Radio podcast as of late, and it is bringing an idea I’ve had a while back to mind. I’ve wanted to work on my programming skills for a while, and I’ve wanted to write an RPG system for a while. I am thinking that I might want to code a simple Roguelike to teach myself Object Oriented programming, or at least improve the programming I do know. My background in programming is a bit weak; I learned QBASIC in high school, took a class on C in first year, and a class on C++ last year. I’ve also taken a bunch of theoretical classes on algorithms and such, and used simple programming and scripting at a few of my jobs. However, I’ve never gotten into the more advanced features of any language, and only touched Object Oriented code once. I’d like to learn it, because it seems powerful, but I get turned off reading about it, as it is always held up as the “One true way of programming” and tells you to do things without any explanation, or draws all the reasons why it is better from working with a large team, whereas I would never be working with a large team. Anyway, I was writing up my emails to send to a friend, and thought I might as well post them here and see what people thought of them.
Theme: I’m thinking of a Doom-like theme. The player is on a mining colony and descends into an odd dungeon world made of the mishmashed bits of other worlds, filled with demons and monsters. Sort of like the DungeonWorld posts on my blog. This lets me add all sorts of things like in Nethack without worrying about continuity too much. Also I can play with different dungeon generation algorithms to represent different phases of the dungeon. As a result I’ll have to use a DoomRL or Crawl like targeting system, where you can shoot along non-8 axis angles, which is extra work, but I think it would be interesting. I’d start with some basic Doom monsters (Undead humans and the demons that throw fireballs), then I could add in things from all my D&D manuals as I go.
Environment: I’m going to use Unicode, so I can access a lot of characters for how the dungeon looks. ASCII is somewhat limiting, and I could draw a lot of cool things using Greek letters and whatnot. My temptation is to use pure-console code, ncurses, but that is a bit more challenging on Windows, due to the lack of a decent console. Also, I somewhat short-sightedly uninstalled VisualStudio when I was done with it. I should be able to redownload the free student version it as long as I still have my university email address. Otherwise I have to code it using Cygwin with gcc, which is a pain as it isn’t linux, but it isn’t windows either, which makes everything really strange. Or code it all in a VM or install linux on my laptop. On the other side, using something like libtcod would be a lot easier, would make its own console, and would be easy to work with on linux, windows, etc. I think I lose something in purity though if you aren’t running it through the console of your choice.
Map: I think I’m going to go with the ‘whole map on screen’ style of Nethack, rather than a scrolling map. It is easier, a bit more strategic as you can see the whole dungeons layout, and I like Nethack. I’m going to start out with a rooms design similar to nethack, then add in more caves (Gnomish mines and such) once I’ve got that working. I’ll change the dungeon generation algorithm every so often to represent the player passing through different styles of region in the DungeonWorld. I would of course have persistent levels, as I can’t stand games without them, and I love having equipment caches, alters, shops and whatnot that you return to. These would all be features I add later, but I want to leave room for them.
Character: One of the reasons I want to write this is to play around with rules. As a result, I don’t know how many people will actually play it, but chances are I’ll never finish it anyway. So, I might as well focus on implementing interesting rules, rather then a pure focus on what makes sense to have.
I’m thinking of a system similar to the BRP roleplaying game, with percentage based stats. I’m also thinking I should have them rise with use, instead of with levels. I have a really elegant system for doing this, but it makes adding levels and hitpoints somewhat heterogeneous. Do I even want levels? If I don’t have them, how do I make your HP go up, since it isn’t used? So I’m thinking that skills will go up with use, and it needs more use as you raise them. Basically; every X successful uses (where X = your current skill) you get a roll against the skill. If you *fail* the skill roll, your skill goes up by 1. So it is easy to raise it from 10% to 11%, hard to raise it from 98% to 99%. It may take a bit of tweaking to find the right balance, but that is the basic idea. It is also quite easy to program.
As a result there won’t be any classes, which lowers replayability a bit, but makes it easier to get into the game, as you don’t have to make any decisions at the start of the game.
I might also have a doge skill, lockpicking, stuff like that. Dodge is probably a good idea, but balancing that would be a bit harder. Still, probably worth it.
Now hitpoints are the hard part. Obviously you want them to go up over time. I could have levels just equal an increase in HP, but that seems a bit bland. I could give each monster an XP value, and every time your XP total hits some number then you get more HP. Then I leave myself open to adding traits or such at certain level values later on, and I can tweak things if players rise in XP too quickly or slowly at certain parts of the game by altering my levelling algorithm; original D&D started with an exponential growth equation at low levels, then moved to something more sane at a certain point as I recall, to make it possible for players to keep getting levels. It also allowed low level players to catch up to the fun point of the game, since you could burn through the first few levels quickly. I’m not going to start with something like that, but I might add it over time once I get a feel for the game.
Imitative; I want to do a tick based initiative. I saw a demonstration of this once at a con, I think the game was Aces & Eights. They had a track by the side of the miniatures area, and each player had a token on it. Each action you did would move your token along the track a little. So lying down might take 2 ticks, but standing back up would take 4. So it was really flexible, and you had a choice between trying something big that would make it a while before you act again, or something small that would have less of an impact. There are some articles on RogueBasin about similar systems. It warns against using a turn counter, as you’ll eventually hit a memory error if you play long enough. The really simple way to overcome this is to use an offset from the current turn instead of an absolute value. Then you only have to worry about the total offset instead of a constantly increasing number. The easy way would be a matrix where the current tick is always 0, and you add actions in an offset based on this. The problem you encounter is what happens if there is already a action at that point? So, for example, I make a move that means I next act at +5. There is already a zombie that moves at +5. Now, I have to use either +4 or +6, which is fine, depending on if I use first-in-first-out or last-in-first-out, but what if there is a monster there already? I’m thinking of a linked list of some sort, as I can dynamically add actions in, and don’t have to iterate over the array each time I want to find the next action, I just follow the link to the next one. Each cell in the array would have its offset, so when I add an action I just scan along until I find one with a larger offset, then add the new action in before it. Now, I would then have to decrement the offset on a regular basis, but that shouldn’t be too much of a problem, as I only have to do it on scheduled actions, not every cell in an array.
Then there is the ‘you stop digging’ problem. That is, what if I start digging that takes 10 ticks, and a monster appears? Do I force the player to die? Seems like a bad idea. The elegant way to change the rules would be have the effect of an action happen when you perform the action, then you just stick the player back into the initiative order a bit early. No worries about cancelling an effect. It is a bit unrealistic though; if the dirt is already moved or the spell cast, why do I have to wait to move again? Oh, that also doesn’t work; as it means that players get a free insert back into the initiative order, and have accomplished the task they were working on early.
It also adds a tactical element if some abilities take longer to work, as you risk an enemy moving, or you get a chance to hit them and interrupt their spell or ability. I think I could do that, and it sounds interesting. It means a lot more code though, as I’ll have to define the failure mode of each action. What is the failure mode for getting hit while drawing your gun for example? I guess I could have breakable and unbreakable actions. Do you have any suggestions?
Anyway, I like this idea as I can make some monsters faster just by making their actions faster, without having to worry about movement rates and such. Nethacks system always confused me a little. Then I can add modifiers into actions speeds, such as a stimulate making all actions 1 tick faster, or being encumbered making movement actions 1 tick slower.
Monsters: Ok, making monster stats in my system is easy. Just assign them a skill for each attack they have, a speed for each action they have, and some HP. The hard part is AI; I have no idea how to do AI. There are some articles on roguebasin that might help, but man, most of them are written for more advanced people. I might do a simple ‘if you can see player, and have an attack in range use it. Otherwise move towards player.’ This would be pretty easy to exploit with traps and such; I might go into some of the weighted random bits? It could also be too lethal given how many monsters have ranged attacks when you open a door and everything in the room shoots you. I could add a surprise factor that slows monsters when they first see you…
Saving: I’m going to save my games in text documents, and just save the players stats, what item is on each square and its traits. The hard part will be figuring out the best way to write it, and then parse it back, and the balance between having to change it on a regular basis and adding a zillion exceptions. So, I was thinking each square would just have a delineated list of items: (1,1)|shotgun, 1; bullets, 10; shells, 43| or something like that. That would make it easier to edit, and avoid breaking the save file every time I add a new item, like Nethack does. It would also make it really easy to edit a save file when I want to test a new time, as it is easier to read text instead of numeric codes. Then you get the problem of charged items; Do I add a charge value to every item in the save file, or write an exception? This type of thing doesn’t seem too worrisome though, as it would only effect my input and output bits, so rewriting it as I add things isn’t too worrisome, as long as I don’t care about save compatibility too much. I could even write scripts to upconvert save games to the new files if I wanted.
Items: I’ve still got a lot to decide here. The upside of the science fiction setting is that my game won’t instantly feel like Nethack without all the weird bits. The downside is that thinking up items is harder. Weapons are easy; they just give you an accuracy boost, or fire slightly faster than normal. Or worse, I could make degraded versions that you can find at lower levels then you normally would. I could also make one with slightly larger magazines than normal. Armour is also easy; it reduce the damage you take per blow. That is common in tabletop RPGs, but I always found it cumbersome. However, once you have the computer doing the math, why not?
I’ve got mixed feelings on having some sort of foodclock. On one hand, it is a lot of extra work, and would just be a copy of most other games, right? On the other hand, if I don’t have it, what keeps you from grinding level 1 forever? On the upside, it means no more games were you die just because the RNG won’t drop any rations.
Moving on; a lot of what gives Roguelikes their depth is weird items and how they can be used. If I’m going for a more modern theme then it feels wrong to throw a lot of amulets and wants and such in. I’m thinking I could play off the descent into hell aspect a bit to justify some of those, but still, any suggestions here would be appreciated.
Programming: The hard part is I don’t know Object Orientation very well; we only used it in a couple projects in the last class I was in, with a terrible prof. I started this in part to learn object orientation, but it is tempting to go with what I know in large part. I wonder how much of a sin it would be to use mostly functional programming, and save object orientation for the monsters or something like that? Part of the temptation is there is a really nice guide on how to do a lot of basic things in C++ called The Beginner’s Guide to Roguelike Development in C/C++ that details how to get started that I could extend. However, it is written entirely from a functional programmer perspective, which I’m quite comfortable with. I’m wondering how hard (or sinful) it would be to start with the basics such as movement in functional code, then put things such as items and monsters into objects? I’d need to find a good book on OO as well, my textbook was horrible. Again, recommendations here would be appreciated. I was tempted to try learning another language, like Python or Lua, on the principle that I use scripting more then I use a high level coding language, but learning C++ is a pretty useful skill I think, and would let me get started a lot faster. There is also a temptation to use pure C, so I don’t have to worry about object oriented code or anything, but that would kind of defeat the point, and I really don’t have to worry about portability or performance that much.