Results 1 to 10 of 16

Thread: What's the name of the concept of scripting in a Sim/RTS type of game?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Post

    Quote Originally Posted by gcarreno View Post
    Hey peeps,

    I played an Amiga space exploration game in the mid 90' that frustrated me for not being able to finish it.
    Is that game perhaps Elite or Elite2?? Spent countless of hours playing both of them.. Now to the questions:

    Sounds like using an embedded script language might overshoot the target, could you perhaps settle for some basic database instead? I used Json for something similar (not in pascal, but the principles are the same)

    Json makes it easy to store key/value pairs, and it also has (limited) support for conditional branching.

    A quickie:
    Code:
    {
        "technology": [{
            "id": "hyperdrive_1",
            "name": "Basic FTL drive systems",
            "prereq": ["playtime", 1],
            "researched": true
        }, {
            "id": "wormhole_1",
            "name": "Wormhole Navigation for Dummies",
            "prereq": ["playtime", 2],
            "reserached": false
        }, {
            "id": "wormhole_2",
            "name": "Advanced Wormhole Navigation",
            "prereq": ["wormhole_1", "hyperdrive_1"],
            "researched": false
        }]
    }
    Provided that you're using OPascal, you can then fairly easy map each Json-entry to an object, which you then can store away in an array or linked list.

    I would parse the file like this (in pseudo-code)
    Code:
    Load Json-file
    Get Json-object count
    Make place for them (I've got a sweet spot for dynamic arrays)
    For each Json object do
        TechID:=id
        TechName:=name
        for each req in prereq
            if prereq-field contains "playtime" then parse next field member as integer
            else add TechID;s to list of prerequisits.
        TechResearched:=researched
    This would also make it easy to serialize all the data for saving and loading purposes, the memory footprint of the json-object isn't an issue as long as you're running on anything else then a C64, or a Casio pocket calculator. When you've researched a technology, change the "researched"-field of that object to true, and at the end of the game write the modified Json-file back to disk. Then the next time you load the game you will start from where you left instead of having to research all techs all over again.

  2. #2
    Quote Originally Posted by Rickmeister View Post
    Is that game perhaps Elite or Elite2?? Spent countless of hours playing both of them..
    When I was looking for the game name I had that one suggested and also Master of Orion.

    MoO is turn based, the one I played was Real Time and Elite has a trading and mission aspects that the one I played did not have.

    It was quite simply a Sim for resource mining and resource management. The game ended with a battle with the Martians. Either you won, by having a greater quantity of combat drones, or you loosed. I could never win the bloody thing and could not say if it was open ended or not...

    I don't think the game ever got any recognition. It was very simple and didn't have any mission or trading in it, so probably a bit boring for the more hardcore gamers. But it quite appealed to my like. I don't really like the battle and trading aspect of Sims/RTS. What I really like is the calm, relaxed waiting of resource gathering, level updates and going through a tech tree.

    Ok, in regards to your suggestion: It makes a lot of sense and I've already had some version of it in my mind. I asked here because more experienced programmers in the Sim/RTS genres might have already put something in stone.

    From the looks of it, it seems that it's not something that has really cemented.

    At the moment the Objects I've dished out are still "hook" free. I'll need to devise a way to connect the "scripting" objects to the data objects.

    @Ñuño: I've downloaded your code and will have a look at it. Will report on it later. MANY THANKS!!

  3. #3
    Hey peeps,

    After a little bit of searching on https://gamedev.stackexchange.com I found a mention to Finite State Machines (FSM) and it clicked immediately!!!

    DUH!! Of course that's what I want. Why didn't it occurred to me initially is still a mystery

    Now to learn a bit more in depth on the subject and then onto implementation.

    Many thanks to all that gave me an answer.

    Cheers,
    Gus

  4. #4
    Then I recommend you to read this.

    Anyway you can implement your state machine to use a scripting language. it will be more flexible and allow modding, which is always good. In that case the paper I linked may help you with this too.
    Last edited by Ñuño Martínez; 06-02-2017 at 01:03 PM.
    No signature provided yet.

  5. #5
    Quote Originally Posted by Ñuño Martínez View Post
    Then I recommend you to read this.
    Thanks. I actually ended buying the book for my Kindle. The way it's explained connects very well into the game programming world.

    Other stuff I read about the State pattern gave me more question marks in regards of how to make it work on the game, so this chapter is perfect to get the question marks gone.

    Quote Originally Posted by Ñuño Martínez View Post
    Anyway you can implement your state machine to use a scripting language. it will be more flexible and allow modding, which is always good. In that case the paper I linked may help you with this too.
    Thanks for this also. I'll probably implement some kind of modding in the very FAR future.

    Keep in mind that this is a game I'm making for myself. I don't really think I'll ever publish it or anything. But, never say never, and all that, so I'll keep this handy just in case I do get it out from under "for my pleasure only".

    Cheers,
    Gus

  6. #6
    Quote Originally Posted by gcarreno View Post
    After a little bit of searching on https://gamedev.stackexchange.com I found a mention to Finite State Machines (FSM) and it clicked immediately!!!

    DUH!! Of course that's what I want. Why didn't it occurred to me initially is still a mystery
    Hey don't be to hard on yourself. I also had to sleep over before I realized I should recommend you to use one of state machine designs. But I see you already figured that out by yourself

    Any way.
    I also wanted to say that wile you are searching for state machine examples you should note that most of them are only showing the simplest state machine examples with very low complexity like general game state (whether you are in main menu, is game loading or is the game in progress for instance).
    But the state machine that you will need for your game will probably need to have much higher complexity. But don't let that discourage you.

    Also you might want to check Decision_tree and Behavior_tree concepts.
    Now while these two concepts are most often used for implementing AI they can also be used for controlling your game state.

  7. #7
    Quote Originally Posted by SilverWarior View Post
    Hey don't be to hard on yourself. I also had to sleep over before I realized I should recommend you to use one of state machine designs. But I see you already figured that out by yourself
    Thanks !!!

    Quote Originally Posted by SilverWarior View Post
    Any way.
    I also wanted to say that wile you are searching for state machine examples you should note that most of them are only showing the simplest state machine examples with very low complexity like general game state (whether you are in main menu, is game loading or is the game in progress for instance).
    But the state machine that you will need for your game will probably need to have much higher complexity. But don't let that discourage you.
    That's good advice. Thanks!

    I usually don't do much copy/paste type of coding, mainly because if I don't understand what I'm pasting my hives flare up like a bad case of poison ivy
    If I don't understand it I can't master it, and if I don't master it it's gonna be deleted and replaced by something I do understand and can maintain, so why not just understand the damn thing before I get into bugs I can't squash cuz I just pasted some code like a script kiddy

    Quote Originally Posted by SilverWarior View Post
    Also you might want to check Decision_tree and Behavior_tree concepts.
    Now while these two concepts are most often used for implementing AI they can also be used for controlling your game state.
    I've also stumbled on BT's and I still need to get e better grasp on that. I'll probably need it for some other game that has some resemblance of AI.
    Decision trees is a subject that I think I grok, but will have to have a go at your link to see if my mental model coincides with it.

    Cheers,
    Gus

  8. #8
    Don't worry if you can't build it. Actually, IIRC, most people couldn't then.

    [off-topic]
    I'm thinking, since the PGD Engine project is dead (is it?) may be I should update the engine I created for that project to the latest Allegro, fix bugs and do some improvements and donate it.
    No signature provided yet.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •