Monday evening, I understood what my game wanted to be about. Tuesday, I realized that the game was horribly, horribly flawed. Coming in, all I really knew I wanted to do was the graph paper-like room generation, and I hoped the rest of the game would occur to me as I was doing that.
And it did — it just turned out to be a different game than the one I was writing.
So my 7DRL is ending up as a game very difficult to extend. By making it graphical, and not basing it off an existing Rogue-like engine, I had to spend a LOT of time on just the basic mechanics. Writing a separate class for every monster and weapon seemed like a good idea at the time — Swords inherit from Melee Weapons inherit from Weapons inherit from Object. Though that is kind of how you would think you would want to implement stuff in an object-oriented language like Python, I think it limited me.
Well, with an evening and a morning still left to go, perhaps it’s too early to do a post-mortem on the project. The unhappy fact is that while I would love to finish this game, to do it properly I would have to rewrite it from scratch, and I just don’t have the time. Chalk this one up to a learning experience.
Day 5 of my 7DRL was all about adding combat. My penalty for dying is not harsh; you just pop back in the upper left corner, and the monsters leave you along for a little while.
The damage done by monsters is sometimes fractional because your wielded weapons add a certain amount of physical and magical damage resistance. Wands tend more toward magic resistance, and swords the physical. The idea is that, since you don’t gain xp or levels in this game, you would slowly build up nearly 100% resistance in certain areas, so when the dragon came at you and did 1000 points of damage, you’d resist 99% of it. Woe be she who drops her sword without another one handy.
Oh yeah, almost forgot to mention: the screen capture utility on my Linux box kept crashing for some mysterious reason, so I ran it on my Windows machine and captured the game with Windows Media Encoder, which worked really well! So, here’s the vid of my 7DRL working on Windows Vista 🙂
Don’t sell yourself short Tipa. You have created the first game I have ever heard of that has realistic odour modelling. You are breaking completely new ground here so it is no wonder you are hitting unexpected challenges. You’ll be the one laughing in a few year time though when every self respecting games console comes with a hardware accelerated olfactory engine!
Jokes aside – well done on your project. As ever I remain in awe of people who can actually create things. I have a question about creating the map: I assume the rooms and doors are randomly generated. Do you need a special algorithm to ensure every room is accessible or is that a trivial problem?
I have a special algorithm that connects rooms. It essentially does a “flood fill”, like in a paint program, and I keep knocking holes in walls until a “flood fill” at any given point would fill every room.
Here’s the code that connects the rooms:
def connectRooms(self):
"adding room connectivity"
connectivity = [x for x in range(ROOMW*ROOMH)]
shuffle(connectivity)
spaces = self.getAll()
connected = {}
# no rooms are connected
for s in spaces:
if s.isRoom():
connected[s.getCode()] = False
# well, the first room we encounter is
for i in connectivity:
if spaces[i].isRoom():
connected[spaces[i].getCode()] = True
break
while not self.allConnected(connected):
for i in connectivity:
s = spaces[i]
if s.isRoom() and not connected[s.getCode()]:
neighbors = [N,E,W,S]
shuffle(neighbors)
for ni in neighbors:
n = spaces[ni+i]
if n.isRoom() and connected[n.getCode()]:
d = Door()
s.setDoor(ni,d)
n.setDoor(-ni,d)
connected[s.getCode()] = True
break
Don’t worry about being perfect. You’re doing a game in a very limited amount of time, so there will always be “learning opportunities” to improve next time.
One thing you should definitely do is separate out your data from your code. So, instead of making each weapon its own object, think about each weapon as data. A short sword would be an instance of MeleeWeapon, but with damage stats of X, weight of Y, etc. Store your data in a separate format (I like comma separated value (CSV) files you can open in spreadsheet applications), and load that in. Adding a new weapon is just a matter of adding a new line in the data file. Apply this to items, monsters, etc. The tricky part comes when you want to add special features (like a vampiric weapon), then you have to add code and then set a flag for an item.
Now I’m off to read your next entry. 🙂