Bay 12 Games Forum

Please login or register.

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

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

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #75 on: February 15, 2011, 04:41:48 pm »

Sounds ok, I need to work on this again. I began to get swamped with stuff I didn't understand. I'm going to go over it piece by piece until I understand every bit.

I do programming in spates, each time I learn more and more. I don't want to leave it too long this time as finally I am capable of creating a completed program/game. Which annoyed me for a long time. Albeit a crude one.

I'm going to work on something similar for a while. A text based adventure game for my girlfriend :D go north, get sword, etc etc.
« Last Edit: February 15, 2011, 04:45:59 pm by Deadmeat1471 »
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: Astronaut text based game (Python)
« Reply #76 on: February 16, 2011, 06:30:53 am »

Hmm, looks interesting, but as far as code goes, I think you should brush up on your python. See python is object oriented, and that allows you to do some realy cool things a lot easyer then using a prodecual paradime like you have been implmenting.

I know, sometimes you just want to make a game, not learn a language, but OOP will make your game better, trust me.

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #77 on: February 16, 2011, 08:07:40 am »

Hmm, looks interesting, but as far as code goes, I think you should brush up on your python. See python is object oriented, and that allows you to do some realy cool things a lot easyer then using a prodecual paradime like you have been implmenting.

I know, sometimes you just want to make a game, not learn a language, but OOP will make your game better, trust me.

5 steps ahead of ya, I've been reading about OOP for the last few days :P

*and it's not so much brushing up as learning 8)
« Last Edit: February 16, 2011, 08:10:45 am by Deadmeat1471 »
Logged

Frajic

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #78 on: February 16, 2011, 04:38:16 pm »

So, total rewrite of the game? I'm looking forward to it :)
Logged
EoS company name: Vikings Inc.

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #79 on: February 16, 2011, 04:40:24 pm »

So, total rewrite of the game? I'm looking forward to it :)

It looks that way, also if I can get java to work (or my brain to work in java.) properly it may be in java code instead :D
But thats a big if  :P
« Last Edit: February 16, 2011, 04:47:40 pm by Deadmeat1471 »
Logged

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #80 on: February 17, 2011, 09:13:41 am »

I thought of a better way to do recruitment of astronauts:

Give them a hire_weight.

Example.

Vostok 1
mission = (c*2) + En*1#value of capsule is 2, value on endurance is one.

Astronaut Deadmeat
C 4
E 4
L 1
En 4

hire_weight = mission ## 12

I still have to think about how to make the ai 'search' through the records properly though and find the highest hire_weight.

*solved.
using the max() thingy will work.

Having said that, I'm looking into Classes as an alternative to list.
« Last Edit: February 17, 2011, 01:40:23 pm by Deadmeat1471 »
Logged

Frajic

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #81 on: February 17, 2011, 02:19:26 pm »

Do it. The code becomes much easier to manage if you use names instead of numbers.
Logged
EoS company name: Vikings Inc.

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #82 on: July 03, 2011, 11:14:42 am »

Time to necro my own thread  :P

Getting back on top of this..... I updated most of the stuff to python 3.2, added a bunch of parentheses on the prints mostly. In preparation for a total overhaul.

Current issue is this bit:

Spoiler: Code (click to show/hide)

Apparently the bold line are incompatible str + nonetype. I'm assuming the nonetype may be due to 3.2 changing raw_input to input? I am unsure. If I don't fix this, I'd appreciate insight :D

The actual error:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

*Fixed this, the parentheses were in the wrong place.



First general focus: Sort out the system for selecting astronauts for missions finally! Whether I use classes or lists or whatever else, it needs sorting. I am thinking on this.

Noob workaround idea:
+Could make the mission_weight based on persons stats and experience be counted as follows:

Code: [Select]
selected = 'no'

while selected = 'no'
    if astronaut(0+1) has (50-1) weight:
        astronautsoandso is allocatedtomissionsuchandsuch
        if another has the same weight:
            randomly pick between them.
        break
    break

I need to test this to see if it works, i believe it should. For this I could use classes and have one of the factors in the class a character number(for code purposes) such as 1, 2, 3 etc
« Last Edit: July 03, 2011, 11:42:30 am by Deadmeat1471 »
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Astronaut text based game (Python)
« Reply #83 on: July 03, 2011, 01:57:52 pm »

Are the weights different per mission? Because otherwise you could just sort your sequence and whenever you need an astronaut, use the first one and remove him from the sequence. There should be a sorting function in Python to help you.
Logged

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #84 on: July 05, 2011, 01:15:45 pm »

Are the weights different per mission? Because otherwise you could just sort your sequence and whenever you need an astronaut, use the first one and remove him from the sequence. There should be a sorting function in Python to help you.

Yeah I'm currently looking at Python sorting functions, the weights would be their skills added up and compared to the mission.

Example:

Mission needs capsule skills, LEM, EVA

add these skills for the astronauts together = mission selection weight.

Once I sort out the sorting though, the rest should be easy. This is really the only major block ive had to progress, figuring a way to make the program search and pick the best astronaut. If I have much problems, I will revert to my backup plan, which is a fixed rotor for astronaut missions (historic) with a possibility for the player to replace one of the historic nauts.
« Last Edit: July 05, 2011, 02:11:16 pm by Deadmeat1471 »
Logged

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Astronaut text based game (Python)
« Reply #85 on: January 31, 2012, 01:54:40 pm »

Bumping cos I will fiddle with this again and need to find.

I think due to my utter failure to comprehend sorting, at least thats how I recall this project, I am going to 'hardcode' everything except the player interaction.
*Unless when I have a refresh at python I find a usable sorting function I understand and can use.

Astronaut selection will go as follows:

Historic naut has this skill for this mission; does player have the same or more? if so, player takes mission.


I will restart it from scratch, hopefully it will be slightly more efficient this time.


Before all this, I will brush up on object oriented programming. I really need to get that cracked for python.
« Last Edit: January 31, 2012, 02:07:12 pm by Deadmeat1471 »
Logged
Pages: 1 ... 4 5 [6]