• Welcome to The Campaign Builder's Guild.
 

Just what this site needs...

Started by SDragon, May 06, 2009, 11:26:02 AM

Previous topic - Next topic

SDragon

It's own computer game. I decided I wanted to try writing my own video game, and somehow ended up getting inspiration from... cabbage.

The basic premise of this game is fairly simple. You, the player, are running around a cabbage patch grabbing cabbages. The more cabbage you get, the higher your score. The catch is that The Fiend is also running around this patch, so you have to avoid being caught by him... Or Else! Another element I'm thinking of is having something else growing in the cabbage patch; carrots, for example.

Since I'm such a novice at programming, and since I've already established that this game would be for the site, I figured this would be as good of a place for development as any. Python is the language of choice, since it's the only one I know so far. Here's the stripped down basics of what I have so far:

[spoiler=Game outline so far]
class map(object):
row_a = [a1, a2, a3, a4, a5, a6, a7, a8, a9]# blank space = "^"
row_b = [b1, b2, b3, b4, b5, b6, b7, b8, b9]# inert things = "Y", active things = "@"
row_c = [c1, c2, c3, c4, c5, c6, c7, c8, c9]# player = "P", enemy = "F"
map = [row_a, row_b, row_c]
for i in map:
print i


class thing(object):
def position():
class activething(thing):
def active():
def deactive():
wait = #random time to wait
waited = #number of turns waited
if waited = wait: #change to active

class people(object):
def position():
class player(people):
def move():#user input
def deactivate():
def die():#endgame
class enemy(people):
def move():#AI
def kill():#trigger endgame

def mainloop():

mainloop()
[/spoiler]

Does anyone feel like helping this little project along?
[spoiler=My Projects]
Xiluh
Fiendspawn
Opening The Dark SRD
Diceless Universal Game System (DUGS)
[/spoiler][spoiler=Merits I Have Earned]
divine power
last poster in the dragons den for over 24 hours award
Commandant-General of the Honor Guard in Service of Nonsensical Awards.
operating system
stealer of limetom's sanity
top of the tavern award


[/spoiler][spoiler=Books I Own]
D&D/d20:
PHB 3.5
DMG 3.5
MM 3.5
MM2
MM5
Ebberon Campaign Setting
Legends of the Samurai
Aztecs: Empire of the Dying Sun
Encyclopaedia Divine: Shamans
D20 Modern

GURPS:

GURPS Lite 3e

Other Systems:

Marvel Universe RPG
MURPG Guide to the X-Men
MURPG Guide to the Hulk and the Avengers
Battle-Scarred Veterans Go Hiking
Champions Worldwide

MISC:

Dungeon Master for Dummies
Dragon Magazine, issues #340, #341, and #343[/spoiler][spoiler=The Ninth Cabbage]  \@/
[/spoiler][spoiler=AKA]
SDragon1984
SDragon1984- the S is for Penguin
Ona'Envalya
Corn
Eggplant
Walrus
SpaceCowboy
Elfy
LizardKing
LK
Halfling Fritos
Rorschach Fritos
[/spoiler]

Before you accept advice from this post, remember that the poster has 0 ranks in knowledge (the hell I'm talking about)

Ghostman

Just an idea: maybe the fiend is also turning fresh cabbages into rotten cabbages, and you have to avoid grabbing those. Good luck with the project!
¡ɟlǝs ǝnɹʇ ǝɥʇ ´ʍopɐɥS ɯɐ I

Paragon * (Paragon Rules) * Savage Age (Wiki) * Argyrian Empire [spoiler=Mother 2]

* You meet the New Age Retro Hippie
* The New Age Retro Hippie lost his temper!
* The New Age Retro Hippie's offense went up by 1!
* Ness attacks!
SMAAAASH!!
* 87 HP of damage to the New Age Retro Hippie!
* The New Age Retro Hippie turned back to normal!
YOU WON!
* Ness gained 160 xp.
[/spoiler]

sparkletwist

I don't know anything about Python, so I can't really comment on anything specific. Most development I've done has been in C or C++.

I do have some general thoughts:

How is the game going to be presented? It looks like you're doing something with just straight ASCII art, is that correct? Or are you using PyGame?

Even if it's just ASCII art, I'd have some separation between the presentation of your tilemap and how it's stored internally. That is, I would have an array of "Tile" classes, rather than simple characters. This is more complex at first, but allows room for expansion, and will ultimately save your sanity. ;)

SDragon

At this point in development, I want it ASCII, but I do eventually want it to have graphics.

What I was thinking for the elements was that each class had a character/sprite in the class, and it wouldn't be saved in the map itself. I'm not sure if that's what you mean or not, but if it is, that's what I'm thinking.

Also, it might not matter too much if you know Python or not. I mean, obviously it helps, but I think there's a few members on here who know the language, anyway. If you write in other languages, you can still try to give some general programming ideas :)
[spoiler=My Projects]
Xiluh
Fiendspawn
Opening The Dark SRD
Diceless Universal Game System (DUGS)
[/spoiler][spoiler=Merits I Have Earned]
divine power
last poster in the dragons den for over 24 hours award
Commandant-General of the Honor Guard in Service of Nonsensical Awards.
operating system
stealer of limetom's sanity
top of the tavern award


[/spoiler][spoiler=Books I Own]
D&D/d20:
PHB 3.5
DMG 3.5
MM 3.5
MM2
MM5
Ebberon Campaign Setting
Legends of the Samurai
Aztecs: Empire of the Dying Sun
Encyclopaedia Divine: Shamans
D20 Modern

GURPS:

GURPS Lite 3e

Other Systems:

Marvel Universe RPG
MURPG Guide to the X-Men
MURPG Guide to the Hulk and the Avengers
Battle-Scarred Veterans Go Hiking
Champions Worldwide

MISC:

Dungeon Master for Dummies
Dragon Magazine, issues #340, #341, and #343[/spoiler][spoiler=The Ninth Cabbage]  \@/
[/spoiler][spoiler=AKA]
SDragon1984
SDragon1984- the S is for Penguin
Ona'Envalya
Corn
Eggplant
Walrus
SpaceCowboy
Elfy
LizardKing
LK
Halfling Fritos
Rorschach Fritos
[/spoiler]

Before you accept advice from this post, remember that the poster has 0 ranks in knowledge (the hell I'm talking about)

Nomadic

So it's like pacman, but with demons and fresh farm-grown vegtable?

Loch Belthadd

Quote from: NomadicSo it's like pacman, but with demons and fresh farm-grown vegtable?
no demons, just the fiend of the 9th cabbage.

also, I am saddened by the lack of turtles in this game.
a.k.a. gnomish cheetos
[spoiler=siggy]
[spoiler=gnomes]
Rock Gnomes:good
Lawn Gnomes:Evil[/spoiler]
 [spoiler=have a smiley]                    [/spoiler]
My Unitarian Jihad Name is Brother Rail Gun of Reasoned Discussion.

I am a (self-appointed) knght of the turtle. Are you?

Do not meddle in the affairs of dragons...for you are crunchy and taste good with ketchup...

 Make something idiot-proof and someone will invent a better idiot.
 [spoiler]Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!

fi yuo cna raed tihs, palce it in yuor siantugre.
[/spoiler]
[/spoiler]
  [spoiler=badges]= Elemental Elf's kamalga and the murkmire badge
 = Nomadic's quick play badge [/spoiler]

SDragon

Quote from: NomadicSo it's like pacman, but with demons and fresh farm-grown vegtable?

Yes, only it's a field instead of a maze. There's a few other noticeable differences, but yes, Pac-Man is the closest equivalent.


Loch, why can't we say the player is a turtle?
[spoiler=My Projects]
Xiluh
Fiendspawn
Opening The Dark SRD
Diceless Universal Game System (DUGS)
[/spoiler][spoiler=Merits I Have Earned]
divine power
last poster in the dragons den for over 24 hours award
Commandant-General of the Honor Guard in Service of Nonsensical Awards.
operating system
stealer of limetom's sanity
top of the tavern award


[/spoiler][spoiler=Books I Own]
D&D/d20:
PHB 3.5
DMG 3.5
MM 3.5
MM2
MM5
Ebberon Campaign Setting
Legends of the Samurai
Aztecs: Empire of the Dying Sun
Encyclopaedia Divine: Shamans
D20 Modern

GURPS:

GURPS Lite 3e

Other Systems:

Marvel Universe RPG
MURPG Guide to the X-Men
MURPG Guide to the Hulk and the Avengers
Battle-Scarred Veterans Go Hiking
Champions Worldwide

MISC:

Dungeon Master for Dummies
Dragon Magazine, issues #340, #341, and #343[/spoiler][spoiler=The Ninth Cabbage]  \@/
[/spoiler][spoiler=AKA]
SDragon1984
SDragon1984- the S is for Penguin
Ona'Envalya
Corn
Eggplant
Walrus
SpaceCowboy
Elfy
LizardKing
LK
Halfling Fritos
Rorschach Fritos
[/spoiler]

Before you accept advice from this post, remember that the poster has 0 ranks in knowledge (the hell I'm talking about)

Loch Belthadd

that works, but if there weren't any turtles...
a.k.a. gnomish cheetos
[spoiler=siggy]
[spoiler=gnomes]
Rock Gnomes:good
Lawn Gnomes:Evil[/spoiler]
 [spoiler=have a smiley]                    [/spoiler]
My Unitarian Jihad Name is Brother Rail Gun of Reasoned Discussion.

I am a (self-appointed) knght of the turtle. Are you?

Do not meddle in the affairs of dragons...for you are crunchy and taste good with ketchup...

 Make something idiot-proof and someone will invent a better idiot.
 [spoiler]Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!

fi yuo cna raed tihs, palce it in yuor siantugre.
[/spoiler]
[/spoiler]
  [spoiler=badges]= Elemental Elf's kamalga and the murkmire badge
 = Nomadic's quick play badge [/spoiler]

Nomadic

Quote from: Rorschach Fritos
Quote from: NomadicSo it's like pacman, but with demons and fresh farm-grown vegtable?

Yes, only it's a field instead of a maze. There's a few other noticeable differences, but yes, Pac-Man is the closest equivalent.


Loch, why can't we say the player is a turtle?

But that would imply that turtles can die... and that is of course impossible.

SDragon

Certainly, "die" in this case is just shorthand for "allows self to be captured indefinitely as part of an elaborate supersecret plan to bring benevolence to the world". It's easier to type.

Anyway, we're definitely going to need to import Random for the Fiend's AI, and probably for the placement of the cabbages. I think we might eventually need to import the Time module (that sounds so sci-fi), but I just want to deal with the basic mechanics first.
[spoiler=My Projects]
Xiluh
Fiendspawn
Opening The Dark SRD
Diceless Universal Game System (DUGS)
[/spoiler][spoiler=Merits I Have Earned]
divine power
last poster in the dragons den for over 24 hours award
Commandant-General of the Honor Guard in Service of Nonsensical Awards.
operating system
stealer of limetom's sanity
top of the tavern award


[/spoiler][spoiler=Books I Own]
D&D/d20:
PHB 3.5
DMG 3.5
MM 3.5
MM2
MM5
Ebberon Campaign Setting
Legends of the Samurai
Aztecs: Empire of the Dying Sun
Encyclopaedia Divine: Shamans
D20 Modern

GURPS:

GURPS Lite 3e

Other Systems:

Marvel Universe RPG
MURPG Guide to the X-Men
MURPG Guide to the Hulk and the Avengers
Battle-Scarred Veterans Go Hiking
Champions Worldwide

MISC:

Dungeon Master for Dummies
Dragon Magazine, issues #340, #341, and #343[/spoiler][spoiler=The Ninth Cabbage]  \@/
[/spoiler][spoiler=AKA]
SDragon1984
SDragon1984- the S is for Penguin
Ona'Envalya
Corn
Eggplant
Walrus
SpaceCowboy
Elfy
LizardKing
LK
Halfling Fritos
Rorschach Fritos
[/spoiler]

Before you accept advice from this post, remember that the poster has 0 ranks in knowledge (the hell I'm talking about)

sparkletwist

You'll also need the time for seeding the random number generator. This process is pretty trivial in C++:
srand(time(NULL));

I'd be surprised if Python was more complicated.

How are you timing the game?

SDragon

The Random module has a few options for number generators, but I think randrange might be best. Probably something like:

random.randrage(1, 8)

For the AI movement, with each number being a different direction on the grid. You could use that with the range going up to however many cells the map has, and have it for the random placement of the elements (characters, vegetables). For the AI, there will also have to be a variable that saves the last move made, to prevent the Fiend from simply moving back and forth between two cells. Here's what I just thought up:

The direction of movement has a design that's something like:

512
6F3
784


and the AI would have something roughly along the lines of:

while fiendlastmove + fiendcurrentmove == 9:
fiendcurrentmove = random.randrange(1, 8)


Hm. Apparently I can't show the randrange method ending at 8. That's odd.

Timing, at this point in development, is turn-based, but I do want it to eventually be realtime.
[spoiler=My Projects]
Xiluh
Fiendspawn
Opening The Dark SRD
Diceless Universal Game System (DUGS)
[/spoiler][spoiler=Merits I Have Earned]
divine power
last poster in the dragons den for over 24 hours award
Commandant-General of the Honor Guard in Service of Nonsensical Awards.
operating system
stealer of limetom's sanity
top of the tavern award


[/spoiler][spoiler=Books I Own]
D&D/d20:
PHB 3.5
DMG 3.5
MM 3.5
MM2
MM5
Ebberon Campaign Setting
Legends of the Samurai
Aztecs: Empire of the Dying Sun
Encyclopaedia Divine: Shamans
D20 Modern

GURPS:

GURPS Lite 3e

Other Systems:

Marvel Universe RPG
MURPG Guide to the X-Men
MURPG Guide to the Hulk and the Avengers
Battle-Scarred Veterans Go Hiking
Champions Worldwide

MISC:

Dungeon Master for Dummies
Dragon Magazine, issues #340, #341, and #343[/spoiler][spoiler=The Ninth Cabbage]  \@/
[/spoiler][spoiler=AKA]
SDragon1984
SDragon1984- the S is for Penguin
Ona'Envalya
Corn
Eggplant
Walrus
SpaceCowboy
Elfy
LizardKing
LK
Halfling Fritos
Rorschach Fritos
[/spoiler]

Before you accept advice from this post, remember that the poster has 0 ranks in knowledge (the hell I'm talking about)

brainface

Quote from: random numbersimport random
random.seed() # you only need to call this once inside a program.
random.randint(1,8 ) # call however many times as needed.
[/code]
randint(1,8 ) is equal to randrange(1,8,1)

Python random numbers are Mersenne Twister generated--this is good enough unless you're actually the CIA or trying to encrypt files. Don't let anyone ever tell you different, they will be wrong and much suffering will ensue. (People are very good at detecting patterns, and will detect patterns in even random numbers, then tell you that your numbers aren't random. trust me on this.)
"The perfect is the enemy of the good." - Voltaire

SDragon

Don't the steps in randrange default to 1, though? So, in that case, there really isn't any difference between randint and randrange unless you specify the steps. Wouldn't that make randint obsolete?

Edit-- looking in one of my books (Python in a Nutshell), I don't even see the randint method. Maybe it's been phased out or something? Anyway, I have enough experience with the random module to know that it's Good Enough for this project. I don't really expect powergaming CIA agents to play this ;)
[spoiler=My Projects]
Xiluh
Fiendspawn
Opening The Dark SRD
Diceless Universal Game System (DUGS)
[/spoiler][spoiler=Merits I Have Earned]
divine power
last poster in the dragons den for over 24 hours award
Commandant-General of the Honor Guard in Service of Nonsensical Awards.
operating system
stealer of limetom's sanity
top of the tavern award


[/spoiler][spoiler=Books I Own]
D&D/d20:
PHB 3.5
DMG 3.5
MM 3.5
MM2
MM5
Ebberon Campaign Setting
Legends of the Samurai
Aztecs: Empire of the Dying Sun
Encyclopaedia Divine: Shamans
D20 Modern

GURPS:

GURPS Lite 3e

Other Systems:

Marvel Universe RPG
MURPG Guide to the X-Men
MURPG Guide to the Hulk and the Avengers
Battle-Scarred Veterans Go Hiking
Champions Worldwide

MISC:

Dungeon Master for Dummies
Dragon Magazine, issues #340, #341, and #343[/spoiler][spoiler=The Ninth Cabbage]  \@/
[/spoiler][spoiler=AKA]
SDragon1984
SDragon1984- the S is for Penguin
Ona'Envalya
Corn
Eggplant
Walrus
SpaceCowboy
Elfy
LizardKing
LK
Halfling Fritos
Rorschach Fritos
[/spoiler]

Before you accept advice from this post, remember that the poster has 0 ranks in knowledge (the hell I'm talking about)

brainface

ah, here's the deal:
Randrange does not include the upper bound, whereas randint does, so:

randint(1,6)
randrange(1,7)

both give a number between 1 & 6 inclusive.
"The perfect is the enemy of the good." - Voltaire