Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5 6

Author Topic: Astronaut text based game (Python)  (Read 8551 times)

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #30 on: January 17, 2011, 10:36:50 am »

You mean true and false right?

Exactly, I was going to use 1 or 0 but i thought would be easier to have yes or no.

I was thinking of putting all the possible stages of the missions possible with simple yes or nos.  When it comes to mission resolution it would take from the mission selected the class info and then go through the:

does it have this stage?
no

does it have this stage?
yes
failure
catastrophic failure
you died.

What ill do from here then is get the list of the Mercury Vostok missions, enter into the class system all of the possible stages and whether they are in it. Also Ill add prestige gained for the player for successful specific missions directly from BARIS.
« Last Edit: January 17, 2011, 10:46:33 am by Deadmeat1471 »
Logged

Frajic

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #31 on: January 17, 2011, 10:46:10 am »

Do you think it might be a good idea to put in the class EVERYTHING to do with the mission, for example it seems a nice place to put all the mission info like -

    def __init__(self, program, number, date, OIB, TLI, MCCB, LOIB)

to which the answer to the last four would be yes or no (skipping or running IF statements in mission resolution phase).

something like

while missionsputnik4.OIB == True:
        print 'performing Orbital Insertion burn'
        if random.randint(0, 100) > rocketsafety + c #capsule skill#
                print 'step failure, orbital insertion burn fails'
                if random.randint(0, 100) > 50:
                        print 'catastrophic failure'
                        if random.randint(0, 100) > 50:
                                print 'you are killed!'   
                                alive = 0
        else:
                print ''Orbital insertion burn successful"



Acronyms are Orbital Insertion Burn, Trans-Lunar Injection, Mid Course Correction Burn, Lunar Orbital Insertion Burn if anyones wondering.
Just a little improvement/fix.
And FYI, True and False are equal to 1 and 0.
Logged
EoS company name: Vikings Inc.

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #32 on: January 17, 2011, 10:49:04 am »

Thanks, can always use little fixes. It's them that usually get me :D

The only large things I have to figure out left theoretically are the 'choosing of astronauts for missions' mechanism, and space program progression. The latter can be put on hold until i've finished the basic system and have working Mercury/Vostok missions.

The rest is just donkey work, and once the space program progression bit is done, it's complete! all to do after that would be make small improvements and consider writing AI for the mission creation (which currently will be 'scripted').
« Last Edit: January 17, 2011, 10:54:48 am by Deadmeat1471 »
Logged

Frajic

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #33 on: January 17, 2011, 10:54:45 am »

Thanks, can always use little fixes. It's them that usually get me :D

The only large things I have to figure out left theoretically are the choosing of astronauts for missions, and space program progression. The latter can be put on hold until i've finished the basic system and have working Mercury/Vostok missions.
Astronaut selection is quite simple, if we're still talking about the technical stuff(just make an Astronaut class). For the space program I'd make a counter that checks which mission you're on, and every time you finish a mission it goes up by one.

Edit: OH, and one more thing; the standard when naming classes is making them Uppercase.
« Last Edit: January 17, 2011, 10:58:35 am by Dwarf Midget »
Logged
EoS company name: Vikings Inc.

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: Astronaut text based game (Python)
« Reply #34 on: January 17, 2011, 10:58:20 am »

Thanks, can always use little fixes. It's them that usually get me :D

The only large things I have to figure out left theoretically are the choosing of astronauts for missions, and space program progression. The latter can be put on hold until i've finished the basic system and have working Mercury/Vostok missions.
Eh, that should be easy. First define your characters:

Code: [Select]
class astronaut:
 def __init__(self, strength, agility, randomstatnobodycaresabout)
 self.strength=strength
 self.agility=agility
 self.randomstatnobodycaresabout=randomstatnobodycaresabout
and set their stats

then you make this:
Code: [Select]
println 'choose your character:'
println 'joe watshisname (1)'
println 'yuri gorbatschow (2)'
then ask for input and use a switch
Logged

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #35 on: January 17, 2011, 11:04:07 am »

What I want it to do, Is use the lists of astronauts, take from the current missions its necessary componants and elect the best astronaut, if more than one are equally skilled in the necessarys, 50:50 dice roll decides. That would be fairly easy I think.

For example.

Orbital EVA mission:

The candidates:

Glenn = good at capsule, bad at eva

Shepard = good at capsule, good at eva

Cooper = bad at capsule, exellent at eva


Cooper would have his skills added up, the necessarys being combined for his 'suitability' value. He would come in the middle. Glenn would come above him having two and Shepard would outstrip them both, getting the place. For Mercury these are one manned, but for future missions it will look for different roles. Example - Apollo mission would require a Command Module Pilot (capsual skill) a LEM specialist and a docking specialist. That would take 3 different resolutions between the astronauts in order to decide who gets the places.

Also ill add modifiers such as injured = yes, training = yes which would immediatly rule them out of the selection (being preoccupied).

I cant see why using my current lists wouldnt work for this, and I dont want to rewrite the astronauts into functions etc if i dont have to. But if someone sees a problem with this idea, say so! :D
Logged

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: Astronaut text based game (Python)
« Reply #36 on: January 17, 2011, 11:05:46 am »

so no actual choosing of a character?

Good, that saves me the effort of remembering how the eff input works in python.
Logged

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #37 on: January 17, 2011, 11:06:26 am »

You dont play them, you compete against them! You play as yourself!


*Well I will, I doubt anyone else would want to play :D
« Last Edit: January 17, 2011, 11:08:13 am by Deadmeat1471 »
Logged

Frajic

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #38 on: January 17, 2011, 11:08:47 am »

so no actual choosing of a character?

Good, that saves me the effort of remembering how the eff input works in python.
input() returns a value, raw_input() returns a string. For keyboard input, I use libtcodpy(won't explain how that works though).
Logged
EoS company name: Vikings Inc.

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: Astronaut text based game (Python)
« Reply #39 on: January 17, 2011, 11:13:23 am »

You dont play them, you compete against them! You play as yourself!


*Well I will, I doubt anyone else would want to play :D
Aaaaaah.

Quote
input() returns a value, raw_input() returns a string
Thanks, that's what I was trying to remember. I somehow can't remember more than one programming language at once, so right now some of my skills with Delphi probably flew out of the window.
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Astronaut text based game (Python)
« Reply #40 on: January 17, 2011, 11:14:33 am »

And FYI, True and False are equal to 1 and 0.
Depends on your programming language. Java doesn't allow implicit conversions between numeric types and booleans (true or false). Lisp treats everything but NIL or an empty list as false. C doesn't even have proper booleans IIRC, they're just macros for 0 and 1.
Logged

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #41 on: January 17, 2011, 11:15:28 am »

Quote
i I somehow can't remember more than one programming language at once, so right now some of my skills with Delphi probably flew out of the window.

At least you have had some skills!


*And ya I know about yes/1, called booleans? or something. Don't need to worry about that one!
Logged

Frajic

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #42 on: January 17, 2011, 11:15:55 am »

And FYI, True and False are equal to 1 and 0.
Depends on your programming language. Java doesn't allow implicit conversions between numeric types and booleans (true or false). Lisp treats everything but NIL or an empty list as false. C doesn't even have proper booleans IIRC, they're just macros for 0 and 1.
I'm talking pure Python here, I didn't have any idea how it worked with other languages.
Logged
EoS company name: Vikings Inc.

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Astronaut text based game (Python)
« Reply #43 on: January 17, 2011, 11:26:12 am »

Oh OK, I was just pointing out that you can't always expect things to work the same in all languages. Using 0 = false as a shortcut is allowed, but not really elegant if you ask me.
Logged

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #44 on: January 17, 2011, 11:27:06 am »

Ok, I've got alot of theoreticals worked out today! I think i better get some of the donkey work done.

*thanks for all your help guys, its probably due to you that A) I know exactly what I need to do and B) It actually is working ;)

« Last Edit: January 17, 2011, 11:29:04 am by Deadmeat1471 »
Logged
Pages: 1 2 [3] 4 5 6