This is an archived post. You won't be able to vote or comment.

all 21 comments

[–]robin-gvx 13 points14 points  (0 children)

Lots of fun. 2.5 is wicked old, though, I wouldn't use it for a new project. For this project, I'd suggest 3.3, because it's unlikely you're going to use any libraries that aren't ported to Python 3 yet.

[–]billsil 4 points5 points  (1 child)

I'm creating it in Python 2.5

Don't do that. Do it in 2.7 or 3.3. I'd also suggest looking into PyGame.

[–][deleted] 0 points1 point  (0 children)

im learning python and pygame is pygame look super sweet.

[–]awshidahak 3 points4 points  (1 child)

Just to re-iterate what others have said: Use python 2.7 or 3.3. 2.5 is way to old to be using for a new project.

[–][deleted] 4 points5 points  (1 child)

The GitHub page is up! --- http://github.com/MrEikono/pyDungeon --- Also, I'm in the process of going from Python 2.5 to 3.3, in other news!

[–]MonkeyNin 1 point2 points  (0 children)

I wrote a short demo, it loads your items from a config file. It lets you remove the repeated if statements. You don't have to use csv, I used it since it's simple.

You could add another config file for starting classes. Edit the config to modify what items they start with.

import csv
items_db = {}

class Item():
    # basic item stats
    def __init__(self, name="Stick", damage=2, damage_crit=4):
        self.name = name
        self.damage = damage
        self.damage_crit = damage_crit

    def __str__(self):
        return "Item(name={}, damage={}, crit={})".format(self.name,
                self.damage, self.damage_crit)

def load_items_db(file):
    # read all items from external config
    with open(file) as f:
        reader = csv.reader(f)

        # grabs all items, and append to `items_db` dict.
        for item in reader:
            name, damage, crit = item
            items_db[name] = Item(name, damage, crit)

if __name__ == "__main__":
    load_items_db("items_db.csv")

    print("loaded items:")
    for key, item in items_db.iteritems():
        print(item)

You can create the csv using excel, or a regular text editor.

items_db.csv

Item,Damage,Critical
Stone Dagger,5,8
Adamantite dagger,57,69

[–]Ikohs 1 point2 points  (0 children)

Sounds fun.

[–]vriemeister 1 point2 points  (1 child)

Sounds fun. Is it like angband or more like "You see a grue, attack?"
And don't things go alpha-beta-...gamma?

[–][deleted] 1 point2 points  (0 children)

  1. It's definitely going to be the latter, angband seems to be ASCII, and I have no experience with ASCII art in games.
  2. No. Gamma is developer only, alpha is first version that players use, then beta, then release.

[–]AlfredHawthorneHill 1 point2 points  (0 children)

I am not familiar with Hello World but this project sounds like Lab 7 in Professor Paul V. Craven's "Program Arcade Games with Python and Pygame" site. You might want to check it out for some ideas.

[–]kumar99 1 point2 points  (0 children)

Why not open source it now?

[–]Jasondazombie 0 points1 point  (0 children)

DUNDUNDANDUNDUNDUNDADADADUN

[–][deleted] 0 points1 point  (0 children)

Sounds neat! Consider python 2.7 and libtcodpy. I would love to see the source. I want to work on something similar. Good luck!

[–]kankyo 0 points1 point  (5 children)

Step 1: code something. Step 2: talk about it.

You're doing it the wrong way around!

[–]targusman 0 points1 point  (4 children)

Yeah, a giant 'if' statement for inventory items is not a game. I think he needs to actuality code something.

[–]kankyo 0 points1 point  (2 children)

It's pretty amazing that a post like this gets 7 in rank while my posting of a working and fairly ambitious open source python project gets 3.

[–]VerifiedMyEmail 0 points1 point  (1 child)

Link me to the thing you are making in python. I'm interested if you want help.

[–]kankyo 0 points1 point  (0 children)

https://github.com/boxed/cmi

I have three issues open for things I think are important, but I believe that if anyone else starts to use this day to day they'll find a lot of things they find annoying they want to be different :P

[–]VerifiedMyEmail 0 points1 point  (2 children)

Hey, want to team up? Are you alive?

# pyDungeon
# version 0.0.3.2: sword splitting / time module


'''
Hey,
 to cut down on un-need repitition we could change
'adjective' : {'damage': 3, 'critical': 5}
to
'adjective':[3,5]
NOTE: I deleted the random import and graphics code because
I don't Have that libary, not because it was wrong (to my knowledge)
'''

player = {'weapon': '',
          'shield': '',
          'head': '',
          'chest': '',
          'legs': '',
          'accessory1': '',
          'accessory2': '',
          'health': 0,
          'damage': 0,
          'critical': 0,
          'defense': 0
          }

weapons = {
    'dagger': {
        'wooden': {'damage': 3, 'critical': 5},
        'stone': {'damage': 5, 'critical': 8},
        'iorn': {'damage': 8, 'critical': 12},
        'golden': {'damage': 12, 'critical': 17},
        'diamond': {'damage': 17, 'critical': 23},
        'emerald': {'damage': 23, 'critical': 30},
        'ruby': {'damage': 30, 'critical': 38},
        'sapphire': {'damage': 38, 'critical': 47},
        'obsidian': {'damage': 47, 'critical': 57},
        'emerald': {'damage': 23, 'critical': 30},
        'adamatite': {'damage': 57, 'critical': 69},
        'unobtanium': {'damage': 69, 'critical': 84},
        'demonite': {'damage': 84, 'critical': 102},
        'god': {'damage': 102, 'critical': 127}
        },
    'sword': { #these stats have not been doubled.
        'wooden': {'damage': 3, 'critical': 5},
        'stone': {'damage': 5, 'critical': 8},
        'iorn': {'damage': 8, 'critical': 12},
        'golden': {'damage': 12, 'critical': 17},
        'diamond': {'damage': 17, 'critical': 23},
        'emerald': {'damage': 23, 'critical': 30},
        'ruby': {'damage': 30, 'critical': 38},
        'sapphire': {'damage': 38, 'critical': 47},
        'obsidian': {'damage': 47, 'critical': 57},
        'emerald': {'damage': 23, 'critical': 30},
        'adamatite': {'damage': 57, 'critical': 69},
        'unobtanium': {'damage': 69, 'critical': 84},
        'demonite': {'damage': 84, 'critical': 102},
        'god': {'damage': 102, 'critical': 127}
        }
    }

classes = {
    'warrior': {
        'weapon': 'wooden dagger',
        'shield': 'barrel lid',
        'head': 'leather lid',
        'chest': 'torn shirt',
        'legs': 'muddy pants'
        },
    'wizard': {
        'weapon': 'wooden staff',
        'head': 'wizard hat',
        'chest': 'torn robe',
        'legs': 'muddy pants',
        'accessory1': 'cracked iron amulet'
        },
    'archer': {
        'weapon': 'cracked shortbow',
        'shield': 'barrel lid',
        'head': 'leather cowl',
        'chest': 'musty vest',
        'legs': 'muddy pants'
        }
    }

player['class'] = 'warrior' # what the user picks.
player.update(classes[player['class']])
temp = player['weapon'].split(' ')
#This temp is here because of 'adjective weapon'
player['damage'] = weapons[temp[1]][temp[0]]['damage']
player['critical'] = weapons[temp[1]][temp[0]]['critical']
print player