Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Vapourware Trying to learn programming from ~0, realistic goals naturally help needed.

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
You're making progress. Your procedural generation is almost as good as Oblivion's.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
heh. Yesterday i was figuring out better way to fiddle with UI in CMD along with reserching if i should use dicts or classes for places in world.
Today i am trying to implement world generation where each type of place has its own thing and has ability to spawn enemies.
I have already build vendor system in place earlier but i will need to rewrite it for class handling instead of dict handling.

From that point from major features i will need to implement basic combat events and that is it. From that point just polishing things maybe some rewrite for better handling of different things in code.

edit:

also i am trying to figure out best way to shorten my code in actual loops so those loops will be easily readable.


for interested here is full code:

Code:
import random
import os

# Manu dictionaries

main_menu_list = {'new game': 1,
                  'quit': 4}
game_option_list = {'move': 1,
                    'inventory': 2,
                    'player stats': 3,
                    'merchant': 4,
                    'quit': 5}
cheats_list = {'+100 health': 1,
               'go to menu': 2}
citi_names = ['the new camp', 'the orchard', 'junktown', 'the glow', 'los capri', 'zandara', 'roxenfurt']
village_names = ['sandy place', 'old scrapyard', 'cows pen', 'roccoti', 'windhill', 'shady sands', 'trek']
base_names = ['siera tin', 'pudric fort', 'spike fort', 'west fortifications']
other_names = ['sulfur cave', 'deep cave', 'old ranch', 'dirty shack', 'shady shack', 'west gas station']

cities = random.randint(1, 2)
villages = random.randint(3, 5)
bases = random.randint(1, 2)
others = random.randint(3, 5)

newplace = 0

enemyname1 = ['dirty', 'old', 'young', 'hungry', 'fat', 'strong', 'crazy', 'hard']
enemyname2 = ['beggar', 'raider', 'bandit', 'thief', 'scavenger']
sexchoice = ['woman', 'man']
weapons = {'piece of glass': 3,
           'knife'         : 5,
           'wooden stick'  : 6,
           'machete'       : 10,
           'pistol'        : 15,
           'machine gun'   : 30}
armor = {'plain clothes'    : 0,
         'leather armor'    : 3,
         'metal armor'      : 5,
         'combat armor'     : 7}
main_loop = True
game_loop = False
gameplay_loop = False
cheats = False
choice = ""
player1 = ""
enemies = []
new_enemy = 0
enemy1 = ""
enemy2 = ""
enemy3 = ""


def inpc():
    print
    print " - your choice - "
    x = raw_input()
    print
    return x


def print_options(option_dict):
    print
    for option in sorted(option_dict.items(), key=lambda x: x[1]):
        print "   ", option[0]

def print_places(places_list):
    print
    places.sort(key=lambda x: x.size)
    for place in places:
        print "   ", place.name, " - ", place.type


def clrscreen():
    if os.name in ("nt", "dos"):
        os.system('CLS')
    else:
        for x in range(49):
            print ""


def cur():
    print
    print "=" * (10 + len(player1.current))
    print "==== %s ====" % player1.current
    print "=" * (10 + len(player1.current))


def wlcdescscreen():
    print
    print "You are currently standing in your shack asking yourself different questions about future."
    print "Calculating your chance to live here you finally decided that this is no place where you can live safely."
    print "You decided that you need to move away from here. Problem is that you don't have supplies for it"
    print "After a while you calculated you will need at least 1200 pesters to buy enough supplies to reach"
    print "other safer zone"
    raw_input()


def theglowscr():
    print "============ THE GLOW ==============="
    print "====================================="
    print
    print_options(main_menu_list)


def worldgen():
    placesx = []
    for x in range(0, cities):
        newplace = PlaceCity()
        placesx.append(newplace)
    for x in range(0, villages):
        newplace = PlaceVillage()
        placesx.append(newplace)
    for x in range(0, bases):
        newplace = PlaceBase()
        placesx.append(newplace)
    for x in range(0, others):
        newplace = PlaceOther()
        placesx.append(newplace)
    return placesx


class PlaceCity(object):
    def __init__(self):
        self.name = random.choice(citi_names)
        citi_names.remove(self.name)
        self.vendor = True
        self.type = "city"
        self.size = 5


class PlaceVillage(object):
    def __init__(self):
        self.name = random.choice(village_names)
        village_names.remove(self.name)
        self.enemies_count = random.randint(1, 5)
        self.enemies = []
        self.type = "village"
        for x in range(self.enemies_count):
            new_enemy = Enemy()
            self.enemies.append(new_enemy)
        self.size = 2



class PlaceBase(object):
    def __init__(self):
        self.name = random.choice(base_names)
        village_names.remove(self.name)
        self.enemies_count = random.randint(5, 10)
        self.enemies = []
        self.type = "base"
        for x in range(self.enemies_count):
            new_enemy = Enemy()
            self.enemies.append(new_enemy)
        self.size = 3


class PlaceOther(object):
    def __init__(self):
        self.name = random.choice(other_names)
        village_names.remove(self.name)
        self.enemies_count = random.randint(0, 4)
        self.enemies = []
        self.type = "base"
        for x in range(self.enemies_count):
            new_enemy = Enemy()
            self.enemies.append(new_enemy)
        self.size = 1



class Weapon(object):
    def __init__(self, name, damage):
        self.name = name
        self.damage = damage


class Armor(object):
    def __init__(self, name, armor_value):
        self.name = name
        self.armor = armor_value


class Player(object):
    def __init__(self):
        self.lvl = 1
        self.name = raw_input("CHARACTER NAME: ")
        clrscreen()
        self.age = raw_input("CHARACTER AGE:  ")
        clrscreen()
        self.sex = raw_input("CHARACTER SEX:  ")
        clrscreen()
        self.str = random.randint(1, 5)
        self.pre = random.randint(1, 5)
        self.end = random.randint(1, 5)
        self.initiative = (self.lvl * 5) + self.pre * 5
        self.maxhealth = (self.lvl * 10) + 50 + self.end * 10 + self.str * 5
        self.health = self.maxhealth
        self.current = "shack"
        self.money = 0
        self.weapon = Weapon("bare hands", 3)
        self.armor = Armor("plain clothes", 0)
        self.inventory = []

    def desc(self):
        print
        print "================="
        print "  NAME : %s" % self.name
        print "  AGE  : %s" % self.age
        print "  SEX  : %s" % self.sex
        print "-----------------"
        print "  HEALTH    : %d|%d" % (self.health, self.maxhealth)
        print "  STRENGTH  : %s" % self.str
        print "  ENDURANCE : %s" % self.end
        print "  PRECISION : %s" % self.pre
        print "================="
        print

    def inv(self):
        print
        print "================="
        print "   WEAPON : ", self.weapon.name
        print "   ARMOR  : ", self.armor.name
        print "-----------------"
        print "inventory:"
        if len(self.inventory) > 0:
            print
            for item in self.inventory:
                print "   ", item
            print
        else:
            print
            print "    EMPTY       "
            print
        print "================="


class Enemy(object):
    def __init__(self):
        self.name = random.choice(enemyname1) + " " + random.choice(enemyname2)
        self.lvl = 1
        self.age = random.randint(20, 40)
        self.sex = random.choice(sexchoice)
        self.str = random.randint(1, 5)
        self.pre = random.randint(1, 5)
        self.end = random.randint(1, 5)
        self.initiative = (self.lvl * 5) + self.pre * 5
        self.maxhealth = (self.lvl * 10) + self.end * 10 + self.str * 5
        self.health = self.maxhealth
        self.money = random.randint(1, 50)
        self.weapon = random.choice(weapons)
        self.armor = {'plain clothes': 0}
        self.inventory = [self.weapon, self.armor]

    def desc(self):
        print
        print "================="
        print "  NAME : %s" % self.name
        print "  AGE  : %s" % self.age
        print "  SEX  : %s" % self.sex
        print "-----------------"
        print "  STRENGTH  : %s" % self.str
        print "  ENDURANCE : %s" % self.end
        print "  PRECISION : %s" % self.pre
        print "================="
        print

    def inv(self):
        print
        print "================="
        print "   WEAPON : ", self.weapon
        print "   ARMOR  : ", self.armor
        print "-----------------"
        print "inventory:"
        if len(self.inventory) > 0:
            print
            for item in self.inventory:
                print "   ", item
            print
        else:
            print
            print "    EMPTY       "
            print
        print "================="


# MAIN LOOP // MAIN MENU #######################################
# MAIN MENU LOOP START ########################################
while main_loop is True:
    theglowscr()
    print
    choice = raw_input()
    clrscreen()
    if choice == 'new game':
        player1 = Player()
        player1.desc()
        places = worldgen()
        print
        raw_input("press any key to continue")
        if 'continue' in main_menu_list:
            game_loop = True
        else:
            main_menu_list['continue'] = 2
            main_menu_list['cheats'] = 3
            game_loop = True
    elif choice == 'continue':
        game_loop = True
    elif choice == 'cheats':
        cheats = True
    elif choice == 'quit':
        clrscreen()
        break
    else:
        print
        clrscreen()
#   MAIN MENU LOOP END ########################################
#   GAME LOOP START  ##########################################
    while game_loop is True:

        clrscreen()
        if 'continue' not in main_menu_list:
            wlcdescscreen()
        cur()
        print_options(game_option_list)
        print
        choice = raw_input()

        if choice in game_option_list:
            if choice == "move":
                clrscreen()
                print "Where :"
                print_places(places)
                print
                choice = raw_input()
                if choice in places:
                    player1.current = choice

                    clrscreen()
                else:
                    print "wrong answer going back to previous menu"
            elif choice == "inventory":
                clrscreen()
                player1.inv()
                raw_input()
                pass
            elif choice == "player stats":
                clrscreen()
                player1.desc()
                raw_input()
            elif choice == "merchant":
                pass
            elif choice == "quit":
                game_loop = False
                clrscreen()
            else:
                clrscreen()
        else:
            clrscreen()
#   GAME LOOP END #################################################
#   CHEATS LOOP
    while cheats is True:
        clrscreen()
        print_options(cheats_list)
        print
        choice = raw_input()
        if choice == '+100 health':
            player1.health += 100
            clrscreen()
        elif choice == 'go to menu':
            cheats = False
        else:
            clrscreen()
#   CHEATS LOOP END ##############################################

print
print "GAME OVER"
raw_input()
 

7h30n

Augur
Joined
Aug 14, 2012
Messages
311
Traceback (most recent call last):

File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 299, in <module>
places = worldgen()
File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 113, in worldgen
newplace = PlaceVillage()
File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 141, in __init__
new_enemy = Enemy()
File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 253, in __init__
self.weapon = random.choice(weapons)
File "D:\Coding\Installed Programs\Languages\Python 2.7.8\lib\random.py", line 275, in choice
return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
KeyError: 1

You should read what the error tells you.
Code:
return seq[int(self.random() * len(seq))]  # raises IndexError if seq is empty
KeyError: 1

This means it tries to access something that doesn't exist in seq meaning seq is empty. This is inside Python 2.7.8\lib\random.py meaning a function inside random module. The function call before that was this:
Code:
self.weapon = random.choice(weapons)
It calls function from random module called choice with a collection of weapons. Since this call breaks because it tries to get something from an empty collection it means the collection weapons you pass it is empty. You need to fill the weapons before passing it to random.choice.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
Traceback (most recent call last):

File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 299, in <module>
places = worldgen()
File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 113, in worldgen
newplace = PlaceVillage()
File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 141, in __init__
new_enemy = Enemy()
File "D:/Coding/Projects/PyCharm/Vendor/The Glow.py", line 253, in __init__
self.weapon = random.choice(weapons)
File "D:\Coding\Installed Programs\Languages\Python 2.7.8\lib\random.py", line 275, in choice
return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
KeyError: 1

You should read what the error tells you.
Code:
return seq[int(self.random() * len(seq))]  # raises IndexError if seq is empty
KeyError: 1

This means it tries to access something that doesn't exist in seq meaning seq is empty. This is inside Python 2.7.8\lib\random.py meaning a function inside random module. The function call before that was this:
Code:
self.weapon = random.choice(weapons)
It calls function from random module called choice with a collection of weapons. Since this call breaks because it tries to get something from an empty collection it means the collection weapons you pass it is empty. You need to fill the weapons before passing it to random.choice.

ohh thanks. Yeah i forgot that i rewrote enemy weapon list earlier in preparation for weapon generation module.

I am dumb
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
Ok world now lives.

Now i need to implement event in which when i move to place it will check for enemies and if they are in that place it will add option to menu that will give me ability to attack them and then i need to implement combat math based on Combat(player1,current_enemy)

edit:

on other sides of things i can no generate 2D map in world view and upon world generation assign each place coordinates in their class.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
If i could find a way in which CMD would work on button press instead of command then enter i would be sooooo haaaaapy..
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
implemented check system where player before attack will have option to check how many and how equipped are enemies.


edit:

Honestly now adding new features based around data already in place feels easy as hell.

edit2:

I have idea on how to make procedurally based NPC decisions upon their stats. Like for example agreeing to trade with you, joining you, giving you quests based for example on your look.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
Thanks,

another interesting question. Saving... What is general gist of saving ?
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
Implemented turn based combat based on inititive derived from main stats.

Now i only need to implement actually combat math and game will be playable. Then i will need to work on weapons and armors, implement vendor and end game goal check.
 

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
another interesting question. Saving... What is general gist of saving ?

There are many ways to do it.

I have thought about this problem for quite some time. I assume many people concentrate on the game first and don't work on saving. Then at the end they try to squeeze it in as fast as they can.
This can be a good approach, depending on what you are doing, because you don't waste time on something that you later have to remove.
But I would hate not be able to save during development.

I rather suggest a simple, general solution which maps properties directly in XML. I have used something like that for a non-gaming project and it is fast and very flexible.
You can also use an automated way to store classes in Xml (serialization), but it is in my opinion, utter shit.
There are also so called ORM "mappers" that maps your objects into relational databases. This stuff is very powerful but cumbersome.

My basic idea is to use an XmlDocument that is stored in memory (this is important for performance!) and an XmlNode class that has features for getting setting, creating etc.

Here is a simple example for a "Name" property:

Code:
  private XmlNode xmlNode;
  ..
  public string Name
  {
  get
  {
  return xmlNode.GetData("Name");
  }
  set
  {
  xmlNode.SetData("Name", value);
  }
  }

This is the basic idea. If you try to understand that, it's enough.

Now to the more complex stuff. The GetData() and SetData() are functions that need to be implemented on your own.

This is of course more complicated because it handles different types (also lists of objects) and access to Xml, as well as some application specific stuff.

I give you an example. You don't need to understand it! It just shows how that there are function that get the data in and out of the Xml

Code:
  public void SetData(string xPath, object value) /
  {
  string name = xPath.Substring(xPath.LastIndexOf('/') + 1);
  XmlNode node = XmlNode.SelectSingleNode(xPath);
  if (node == null)
  {
  node = XmlDocument.CreateNode(XmlNodeType.Element, name, "");
  XmlNode.AppendChild(node);
  }
  node.InnerText = value.ToString();
  }

  public void SetData(string xPath, List<string> values)
  {
  string name = xPath.Substring(xPath.LastIndexOf('/') + 1);
  XmlNodeList xmlNodeList = XmlNode.SelectNodes(xPath);
  foreach (XmlNode xmlNode in xmlNodeList)
  {
  XmlNode.RemoveChild(xmlNode);
  }
  foreach (string value in values)
  {
  XmlNode xmlNode = XmlDocument.CreateNode(XmlNodeType.Element, name, "");
  xmlNode.InnerText = value.ToString();
  XmlNode.AppendChild(xmlNode);
  }
  }

  public string GetData(string xPath)
  {
  XmlNode node = XmlNode.SelectSingleNode(xPath);
  if (node != null)
  {
  return node.InnerText;
  }
  else
  {
  return null;
  }
  }

  public List<string> GetData(string name)
  {
  XmlNodeList xmlNodeList = XmlNode.SelectNodes(name);
  List<string> values = new List<string>();
  foreach (XmlNode xmlNode in xmlNodeList)
  {
  values.Add(xmlNode.InnerText);
  }
  return values;
  }

The advantage is that when I want to add a new property to this class (or any other class that uses XmlNode) I only need to repeat a simple boilerplate (that means you find a pattern hundreds of times in code).

Lets say we want a property "Age" and Age is a number

Code:
  public int Age
  {
  get
  {
  return int.Parse(xmlNode.GetData("Age"));
  }
  set
  {
  xmlNode.SetData("Age", value);
  }
  }

XmlDocument has a Save method in which you can save to disk, but you only use that when the user is saving. All the other time the data is only in memory.

Does that make any sense to you? It might sound a little complex but if you work on such a general solution you can use it all of your career.

But you could also just try to hand wire everything and write the data explicitly to a file. There is really no shame to that, at your level.
 
Last edited:

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
Frankly i think i understand completely how to do "save" and i realized it even before you made that post.

For game i am creating i implemented "continue" option in main menu if game is started. This made me realize that i just need to get every important variable and save them into a file on save and update those variables when user loads. When i do that this won't be different than "continue" which i already have.

So i must simply look for what variables i have and use I/O to export them and import them implementing save/load menu nothing else. Though if project is bigger this might be a big task (with all those variables)


edit:

also i got what people said about functions and that i should not use global variables in them. I realized this when i had change my combat formula to accomodate guns having more to math just than damage value.

Gameplay is going smoothly and i would love to have something better to work than CMD (and still simple !) to show graphic and maybe implement some paintings. Though i read some of on easier things like flash and engines and seems that even for simple graphic i would need to learn shit ton of functions, classes and what they do.

But that is something for future beyond GOAL4

edit:

that Valkyria Chronicles on PC also cuts into my programming time... eh
 
Last edited:

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
So i must simply look for what variables i have and use I/O to export them and import them implementing save/load menu nothing else. Though if project is bigger this might be a big task (with all those variables)

That's what I meant with hand-wiring. It can be done that way, but it's a lot more work, and you will shoot yourself in the foot sooner or later, but that's part of learning.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
So i must simply look for what variables i have and use I/O to export them and import them implementing save/load menu nothing else. Though if project is bigger this might be a big task (with all those variables)

That's what I meant with hand-wiring. It can be done that way, but it's a lot more work, and you will shoot yourself in the foot sooner or later, but that's part of learning.

That is why i think i should keep variables to minimum and for functions don't use global variables only locals. Though objects probably will have a bit more problems to store them (as they may have a lot variables)
 

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
I have nothing against global variables by the way, you need them.
You must only encapsulate them in namespaces, to avoid collisions with local variables, see what I wrote some pages after the beginning. I'm using a lot of such variables. For example Configuration is always a global scope I am using and can access any time from anywhere, without needing instances of anything.
Once I am sure what I keep I write Configuration in a file and restore it when the application initializes.
Same with your save data, you can put it in a Game class or something, and serialize/deserialize.
A savegame for me is a "Game" instance and it must have save and load functions.
The rest is "Data" which is invariant for a Game session and is externalized in files. So you don't need to save it, only load.
 

SCO

Arcane
In My Safe Space
Joined
Feb 3, 2009
Messages
16,320
Shadorwun: Hong Kong
Your save format will break often (or better, you won't bother to read previous versions) if you don't take the small step of separating config file data from game save data. As you change your required config data, if you bundle it with the save you'll break saves all the time without some extra effort, while if you keep those two in separate files, you can simply reset the config data (i find that game/program data doesn't change that often)
It's also a advantage in that the user can change the settings without depending on saves, which can be a major pain if a player starts a new game (for instance ToEE saved keybindings in the save, new game -> keybinds wiped).
Useful advice not only for games, but all 'user data' vs 'config data' in normal programs too.
 
Last edited:

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
Ok now i have shitty problem to deal with.

I created script that generates bullets for me and those bullets have :

self.name
self.type
self. ...

It generates for merchant random bullets list with each bullet being an object.

Problem i have now is with counting them in proper matter. I can sort them first by type then by name but i can't figure out how to count them so that i can display it to player in proper manner like this:

23 9mm bullets
15 9mm+ bullets
40 20Ga Shells
25 20Ga Magnum Shells.
....
....

What i mean is that this bullet list can be small or big and i need to write code that won't be dealing with manual list (which i will later use to sort). But that will automatically add new position depending on how many bullets types/names there are.

Now i can do short for example dictionary that will have name and integer (which will be bullet count) which i will be able later to use to display count number for each bullet type but i won't be able to sort it then by type because there will be no type value so different names bullets won't be in groups of bullet types.


Back when i was doing vendor script i just used manual list/dict that i would type for it but here i have situation in which my sorting display needs to be automatic based on classes vars instead of outside list or dict.
 

Raghar

Arcane
Vatnik
Joined
Jul 16, 2009
Messages
22,698
bullet inventory {ammunition bulet-type, int amount}
bulet-type{
type
name
use
}
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
This will make ammunition number based not object based which is why i even use class for a bullet instead of simply making it number.

I am using procedural generation so that in future for example weapon will be able to blow up for example if bullet is shitty quality. Which means i need treat each bullet separate.

So in my merchant script it generates random int upon which will iterate random choice from list with ammo types/names. When it will choose ammo then it will generate bullet with that stats based on list with ammo stats.

So it creates a list of bullets with each bullet being independent entity.
What i need now is to print that list grouping bullets in first type then name.

I can sort that object list via type and name but i don't have an idea how to iterate on this. I have something like this:

Code:
...
self.ammo_list = [bullet1, ... )
...

print "=BULLETS="
        bullets_bar = {}
        for x in self.ammo_list:
            if x.name in bullets_bar:
                bullets_bar[x.name] += 1
            else:
                bullets_bar[x.name] = 1
        print bullets_bar

This will print me list of bullets grouped by name but it won't give me group by type.

There is naturally quick way of "fixing" it by simply keeping some name rule like 9mm (normal), 9mm (AP) so it will autosort above but i am looking for answer that will be truly procedural. So for example if i will have a rusted 9mm bullet it will know this is 9mm and nor some railway spike cartridge.

Other way of fixing above is to create list that will contain dictionaries with keys being types and those types holding all of names so i could run script that will check each bullet from each type/name and group it by that dict.

Both of above though are additional script and i am looking something simpler (which i think there is) but i don't know how to deal with it (same as i didn't know earlier about lambda)
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
thanks. Can't use google-fu if i don't know what i am looking for.
how to count occurrences is what i was looking for.

gonna research that
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,875
Status progress on my THE GLOW game:

- main features are implemented: I can change my gear, sell, buy, explore different places, check if those places have enemies and if they have i can fight with rather good math behind it (instead of simple like health - damage)
- basically in this form game is fully playable.

What i have left to do:

- implement reload system for guns and get bullets to work with my combat math (simple stuff)
- enemy weapon system in which they will have weapon and armor depending on place they inhabit. So knifes and clothes in some dirty shack and combat armor and shotgun in military base (simple stuff)
- general balancing

What i might do:

- non random generated stats. Nothing really hard to do. I would just need to handle few different menus in CMD and loops which is imo no worthwhile.
- leveling system. I already have experience gain but it is useless. Adding simple leveling method would be really easy now (just for health). Though i don't see really benefit of "leveling" as gear is really what matters and general stats.
- more robust loot system. I have now system in which it counts people dead and it randomly chooses money prise depending on how many people you killed. Imo it would be much better to have instead of this corpse loot system in which i can sell loot. Though feature creep is real deal.

Thoughts:

I reeeeeealy want to do something finally with GUI. Constant CMD gameplay is really annoying.
I found Kivy library for python which looks absolutely bonkers. If i could do something like this and get my code to work with that i could fucking do some game that will not only work like a game but also look like one. In other words a game.

This is why i have now conflicting thoughts on GOAL4.

#1. I can go into different language syntax. C# probably. It naturally would be good for me (as i won't really loose anything).
#2. I can go on with python add to that kivy and do some game that looks like a game. Which is really something i wouldn't believe i could do just month ago.


QUESTION:

Is it really normal that game-play is so quick and easily developed ? I mean i am complete noob in programming and i basically created sandbox game in which game procedurally generates world and where i can add in seconds new weapons armors and stuff, where i can edit now combat math in minutes and possibly rewriting whole thing in day at most.

I mean i know that procedural generation is amazing thing for content as i don't need to sit and type everything for every place, weapon, character, merchant and so on but i really didn't know how fast this is...

Probably no 2d or 3D grid helps also a lot.
 
Last edited:

7h30n

Augur
Joined
Aug 14, 2012
Messages
311
Status progress on my THE GLOW game:
This is why i have now conflicting thoughts on GOAL4.

#1. I can go into different language syntax. C# probably. It naturally would be good for me (as i won't really loose anything).
#2. I can go on with python add to that kivy and do some game that looks like a game. Which is really something i wouldn't believe i could do just month ago.

If you really want to learn another language and if you want to understand how things really work then learn plain old C.
The best would be to continue your Python project as well as start learning C. With C you won't develop as fast as Python so continuing on your Python project will provide you with the feeling of fun in programming, while learning C will provide you with tremendous insight into inner workings.

I recommend these books for learning C:

The C Programming Language (ansi C edition) - The standard C book from the authors of C, perhaps a bit too old.
Learn C The Hard Way - This is still in development, can be freely read on the web: http://c.learncodethehardway.org/book/
Head First C - Modern book (2012) and the Head First series was usually good.

I would also recommend to learn Unix as you are learning C because the two go hand in hand, but I feel that would be too hard for you.
Learn C The Hard Way teaches you compiling and linking in the terminal, so you might want to install Ubuntu in a VM on Windows.

Edit: Oh, and another benefit of learning C is that you can easily call C functions from Python. So if you continue with your project and find something that works slow and can be done faster in C - you can do it in C and call from Python.
 
Last edited:

baturinsky

Arcane
Joined
Apr 21, 2013
Messages
5,538
Location
Russia
Is it really normal that game-play is so quick and easily developed ? I mean i am complete noob in programming and i basically created sandbox game in which game procedurally generates world and where i can add in seconds new weapons armors and stuff, where i can edit now combat math in minutes and possibly rewriting whole thing in day at most.

You just made a prototype of some of the game's mechanics. This can be done quite fast, yes.
But then you discover that there is so many things left to do, and even more to do them quite the way you want them. And to weed off bugs, both in programming and game design.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom