My First Dungeon That I Wroted All By Myself
Posted by Rampant Coyote on January 20, 2011
Dunno why my brain was going there, but for some reason I was thinking of the first(ish) RPG I ever wrote. No, it wasn’t Hackenslash. I don’t remember if it even had a name. It was a game for the Commodore 64 that I wrote (in BASIC!) when I was a kid. For sure, it was the first one I wrote which anybody other than me played.
The dungeon was represented with character graphics in the Wizardry-style 3D view. The C-64 had some simple graphics tiles you could use for making games, especially card games and simple maze games. I wussed out a little bit, though, and only displayed one room at a time. With doors. I’d done tech experiments where I rendered more complete halls, but the more important consideration for this game was the size of the dungeon.
You see, I made the dungeon 10 rooms x 10 rooms x 10 levels. That’s 1,000 rooms / squares. If I only used 1 byte per room, then it only used up 1K of my available 38k or so of working RAM (the core operating system and BASIC language and reserved memory ended up taking up the rest). So the entire dungeon was generated at the beginning of the game inside of 8 bits. They were arranged something like this:
Bit 0: If set, there was a door to the north.
Bit 1: If set, there was a door to the east.
Bit 2: If set, there was a door to the south
Bit 3: If set, there was a doorway to the west.
Bit 4: If set, there was a staircase going up to the previous level here.
Bit 5: If set, there was a staircase going down to the next level here.
Bit 6: If set, the player had visited this room already.
Bit 7: Don’t remember. Probably unused.
In the random maze generation code, I would have to reciprocate the values. So if one room had bit zero set (north door), the room to the north had to have bit 2 set (south door). Of course, the idea was that you could also have one-way doors and stairs that way, too, but I never got that far.
All monsters and treasure were generated at random. When the player entered a room, it checked bit six to see if the player had been there before. If not, then it generated a potential encounter at random. It also generated a treasure at random. And it set that bit for future reference. If the player had been in the room before, there was a much smaller chance of a random encounter, and no treasure.
Separate from this 10 x 10 x 10 array, I also kept track of the location of the big treasure of the dungeon – I think it was a mystic orb or something. It was always somewhere on the last level of the dungeon. If you entered the room with the orb, you automatically picked it up. Probably before combat happened.
I’d intended to have equipment in the game, which were really just higher bonuses to attack and and defense. I think I had two spells – an attack spell and a healing spell, cast by a magic user and a cleric. And – oh, yes, it was party-based. You had to make your party in advance. I had fighters, magic-users, clerics, and thieves as the core classes. And like so many RPGs, the thef was a pretty useless class. I intended to have traps in the game at some point, as an encounter type that the thief could bypass, but I never got that far. And equipment never happened. You COULD level up, though, and every gold piece you picked up in the dungeon added to your experience point total. There was no other use for gold.
I had some very rudimentary, cheesy sound and music for victories, and no graphics for the monsters.
The random dungeon generator made sure there were no doors that led past the edges of the map. But otherwise, it simply assigned doors randomly, making sure every room on the map had at least one door. usually two or three. Stairs were scattered about more randomly, but all levels had at least one staircase going down. Often 2 or 3. Of course, this algorithm didn’t guarantee that the every room was accessible, or that the game was winnable.
Maybe at higher level, your magic user was supposed to learn some kind of passwall or teleportation spell. I don’t know that I ever really thought that far ahead.
But I did have a couple of friends come over to play it, and we had a silly time making characters, fist-pumping the air when my off-key victory music played.
The code is long-gone now. My memories of it are less than perfect.
At least I can say that Frayed Knights is a better game than the one I wrote when I was fourteen.
Filed Under: Programming, Retro - Comments: 10 Comments to Read
Joe Larson said,
Sounds like a pretty impressive undertaking. maybe I’ll steal the idea for a programming tutorial.
Rampant Coyote said,
Heh – today 14-year-olds are doing stuff taking over the iphone. Durned kids… er, kid…
And I thought I was hot stuff with my little dungeon thingy…
Miral said,
This description gave me a few flashbacks of Wizard’s Castle (http://www.sharpmz.org/mz-700/wizardscastle.html for an idea; I played the DOS version though).
Also of Dungeon of Doom (http://www.gamebase64.com/game.php?id=11518&d=42), which was a type-in from a book.
I was a little too young to write my own games in those days…. but good times. 🙂
Adamantyr said,
Man, that game sounds WAY cooler than Frayed Knights. 😀 (Kidding…)
On the AtariAge TI Forums, one of the frequent contributors, Owen Brand, is working on a vintage CRPG in Extended BASIC/machine language. It’s his first programming project, and it’s pretty neat. I certainly hopes he finishes it!
http://www.atariage.com/forums/topic/157664-the-legend-of-beryl-reichardt/
Viridian said,
When I was 16 or so, I wrote two very basic RPGs, both on the PC and both in BASIC.
The first used character graphics (I’d played DND so I’d seen them used before) and basically replicated the solo dungeon of the Red Book (the Dungeons & Dragons starter player’s guide, for the uninitiated). It was pretty complete – it included monsters to fight, potions to pick up and use, and the Magic Mouth with a riddle (that doubled your gold if you answered right and took it all away if you answered wrong).
My second game was based on the C-64 game Legacy of the Ancients. I loved how the towns had colorful roofs that disappeared when you stepped over the threshold of building, so I replicated that technique, drawing a whole lot of graphics in order to make it look right.
Unfortunately, neither of these games has survived to this day; the disk my second game was on got corrupted…I was quite upset. But those were the first two RPGs I ever wrote.
McTeddy said,
You know… this post was a great read.
It’s amazing to think how far we’ve come over the years… both in our own abilities and the technological advancements.
Acrin1 said,
That sounds pretty good 🙂 Much more sophisticated that my first efforts. I also used the Commodore 64’s built in character set to draw my 3D dungeon view. I remember thinking I was going to build epic adventure games & CRPGs using C64 Basic.
LateWhiteRabbit said,
I was inspired to make my first RPG by Zork, I hadn’t even played DnD at that time yet. I didn’t know how to program a text parser, so I faked it by having the most God-awful nested set of if-else statements you have ever seen. Needless to say that the game wasn’t very long.
There is a reason I became an artist rather than a programmer!
Rampant Coyote said,
Some of my first games WERE text adventures (with some color & sound in one) – and I gotta say, the text parser wasn’t too bad. Way better than Scott Adams or original adventure of the time, at least. Nowhere near as good as Zork, though. 🙂
Bad Sector said,
I wasn’t really interested in RPG games as a kid (English not being my native language helped there a lot… although somehow i played adventure games, but again never finished them because of the language barrier).
At about 11 or 12 i remember making my first “groundbreaking” discovery: images! I made some sort of platformer in 640×480 VGA which used images (i called them icons then) for the level, entities, etc and a tilemap for the world. For me that was a groundbreaking discovery since every time before that i was manually drawing all graphics (and was under the impression that others were doing the same… and actually many games i played at the time *were* doing the same, so my assumption wasn’t totally off :-P).
This was also the first “big” game i made since it had enemies, collectibles, powerups and about 20 levels :-). I *might* have the code somewhere, but i don’t have a 5.25″ drive to read it :-P. Once i move to a bigger house, i need to find some old 90s computer for this kind of stuff :-P.
The closest to an “RPG” was something that i wrote in GWBasic that looked like a DOS roguelike (ascii characters, the happy face for the user, double border characters for rooms, etc). It had some random monsters, etc (although the areas were predesigned) but not stats (so it looked like a roguelike but it wasnt :-p). On the other hand it had cutscenes between the levels with stories like the protagonist coming at home and finding his wife cheating on him :-P. I had more fun making the cutscenes than the game so i never finished that… 😛