Topic: Configuration and Scripting  (Read 25361 times)

0 Members and 1 Guest are viewing this topic.

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #20 on: May 30, 2013, 05:24:47 pm »
Hmmm   could be interesting.

The AI would control ships in combat.  For example we program tons of strategies.  Tactical combat maneuvers.  Then it uses them and it learns based on results which strategy is best against a player. 

Missiopn objectives, starting ships, reinforcements and other details in the script.  AI difficulty will be selectable when the mission is. 

AI will be coded using a midified FSM, so not really possible in a script.

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Configuration and Scripting
« Reply #21 on: May 30, 2013, 05:33:55 pm »
Quote from: Exeter
AI will be coded using a midified FSM, so not really possible in a script.

So, you just plan to hardcode the AI for a single objective: try to destroy a player using the best strategies that he can?

Quote from: Exeter
but I see for a mission load the game loads the starting script for a mission and start the AI

And, you just want to acess the script once at the start, load the AI, and never touch it again for the current mission?
« Last Edit: May 30, 2013, 05:59:03 pm by d4v1ks »
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #22 on: May 30, 2013, 06:59:01 pm »
Quote
So, you just plan to hardcode the AI for a single objective: try to destroy a player using the best strategies that he can?

The AI would get its mission directives from the mission script.  But how it tries to achieve them will be codded internal



Quote
And, you just want to acess the script once at the start, load the AI, and never touch it again for the current mission?
Mission scripts will be read at the start of the mission only.  Give we are running multithread and using the GPU, reading during combat poses additional problems besides performance.  If we did this we may as well write the game in C# and use C# as the scripts.

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Configuration and Scripting
« Reply #23 on: May 30, 2013, 07:26:11 pm »
Well that just kills the need for a scripting language.
Cause even a text file would be enough to config it, using a custom parser.
But, as it seems Angelscript is capablr of running in a multithread environent. Have you looked at it?
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline Starfox1701

  • Lt. Commander
  • *
  • Posts: 1049
Re: Configuration and Scripting
« Reply #24 on: May 30, 2013, 07:36:11 pm »
Mission design is not really my thing in that I have no experience so I can't really comment on whether this is a good idea or not I just don't know.  On the scripting language question I think we need to try both Lua and Angelscript out and see ultimately which method produces the most readable file and which gives us the most flexible files.   

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #25 on: May 30, 2013, 08:27:18 pm »
Quote
Well that just kills the need for a scripting language.
Not really as we are discussing and for future expansion.  Allot depends on what we can find out.  I know SFC missions were compiled and had an API for missions.  Possibly do that. bit instead or AI being imbedded in missions have more of the core behaviour in the game.  One issues was how the AI performed in combat. 

Quote
On the scripting language question I think we need to try both Lua and Angelscript out and see ultimately which method produces the most readable file and which gives us the most flexible files.   
One way is to look at sample scripts from each.  The documentation indicates LUA is similar to C and Angelscript is C++.  In fact to use LUA I need a C++ wrapper for LUA as the game is in C++.

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Configuration and Scripting
« Reply #26 on: May 31, 2013, 03:35:46 am »
I understand your perfomance concerns.
But letting AI out, and getting back to the mission scripts, i think that accessing the mission's script once at start will limit the kind of missions you will be hable to do.
in the pseudo-code i wrote, the mission's script is executed at start, an then only when the mission's status change. It could pass some minutes between each calls. Just review the ideia.
Don't understand how executing functions in a mission's script, 3 times during the mission, could hurt the game perfomance.
If you only want to acess it once at start anyway, how you will transverse the mission lines and produce custom reactions? You would need to develop a kind of virtual machine also to handle the diferent mission requirements and reactions, if i make my self clear.
« Last Edit: May 31, 2013, 06:01:34 am by d4v1ks »
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Configuration and Scripting
« Reply #27 on: May 31, 2013, 03:54:39 am »
After a small research i can comfirm that AngelScript is thread-safe. You can run it on a multithread enviroment, being hable of running multiples scripts at once and even on diferent thread spaces.
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Configuration and Scripting
« Reply #28 on: May 31, 2013, 06:38:29 am »
Just thought in a way to acess the mission script just one time at the start, and do the same things as i wanted to do with the first aprouch.

Quote from:  Game Code

void GameConsolePrint( *text ) {
    // print the text into the game's ui computer console
}

void AddEnemyToGame( *race ) {
    // add a enemy of that race to the game
}

etc...

int *functionPtr[];

void GameStart() {
    functionPtr[0] = &GameConsolePrint
    functionPtr[1] = &AddEnemyToGame

    etc...

    script->Setup(*MissionData)

    do
           // track game events...
    loop until TestEventTreeConditions(*currentMission.currentNode) = MISSION_DONE   
}

TestEventTreeConditions (*node)
{
   do
       if (node.Conditions && node.ConditionsRequired) == node.ConditionsRequired (
           r = script->CallFunctionByPtr(node.functionptr)

           select case Index[node.arg_type && node.total_args]
           case x   
              r = (*functionPtr[node.function])(node.Arg[1]);
           case y
              r = (*functionPtr[node.function])(node.Arg[1], node.Arg[2]);
           etc...

           if node.child != NULL (
              //step into next mission

              node = node.child
              return NEXT_MISSION
           ) else (
              //the mission has ended

              return MISSION_DONE
           )

       ) else (
           //if the current mission node was not fulfied try the other mission at the same tree level...

           node = node.brother
       )
    until node == NULL
}


Quote from:  Script Code
CONSOLE_PRINT = 1
ADD_ENEMY = 2
etc...

void Setup(CObject *MissionData) {
    //setup all the things in the last posts...
    //but we use a new event creator now...
 
    // 1º scan planet
             
    CreateEvent(mission.eventTree,
        SCAN _MADE,
        CONSOLE_PRINT,
        1  //number of args,
        "The planet seems to have the resources you want"

    //Other mission events...
    )
}

CreateEvent(*node, Goal, funcIndex, funcTotalArgs, Arglist]{
    node = new EventData

    node.Goal = Goal
    node.Function = funcIndex
    node.total_args = 1
    node.arg[] = arglist
}
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #29 on: May 31, 2013, 10:21:31 am »
That could work.

The idea is to read the scripts and have all the necessary events loaded into memory for the mission.  My concern is if we need to load a script or information from a file, performance is dead.  But we also want to minimize the memory requirements .

If we can create some generic events in the game code for missions and then pass then parameters from the script that is ideal.  Some events will be unique to a mission and being able to load them for use  is fine.

So, d4v1ks, you interested in heading up the script area?  and Missions?  That does not mean doing all the work.  but based on how the scripts will be designed we also design the mission API.  and that can drive the AI API. 

Offline Starfox1701

  • Lt. Commander
  • *
  • Posts: 1049
Re: Configuration and Scripting
« Reply #30 on: May 31, 2013, 11:24:42 am »
2 questions, what language are those purposed scripts in and how will all this effect unit and equipment scripts?

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Configuration and Scripting
« Reply #31 on: May 31, 2013, 11:37:19 am »
You are doing all by yourself till now, right?
I really like to talk about a project like this. I'm a star trek fan. I enjoyed the board game, the SFC also.
One thing is giving ideias. I like the challange of solving things. But atm i am doing my own projects. I'm writing 2 games for Windows phone\android. The ideia is to get some extra money.
Going deeper into coding means hard work. I would have extra responsabilities. Its too early to talk about that proposal. Put that ships flying like you talked with good graphics and them i will help you. Mission or AI can wait a little more.
Still waiting for the the detaiçs of your game design  :P
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Configuration and Scripting
« Reply #32 on: May 31, 2013, 11:47:08 am »
2 questions, what language are those purposed scripts in and how will all this effect unit and equipment scripts?
The language i used its not a standart language. I wrote about an ideia. Not true code.
I was giving ideias about an script implementation inside the context of the script language that Exeter wanted.
About those unit and equipments, a person can implement all your wishes. That the beauty of coding.
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #33 on: May 31, 2013, 11:52:51 am »
Quote
2 questions, what language are those purposed scripts in and how will all this effect unit and equipment scripts?
The scripting language is not decided.  I would like d4v1ks's opinion on that as he seems to have more experience in that realm.
Not sure how it will effet unit and equipment scripts.  The base game will have them embedded and not changeable.  But they can be overwritten or others added.  This was mods can change unit and equipment.

Quote
You are doing all by yourself till now, right?
I really like to talk about a project like this. I'm a star trek fan. I enjoyed the board game, the SFC also.
One thing is giving ideias. I like the challange of solving things. But atm i am doing my own projects. I'm writing 2 games for Windows phone\android. The ideia is to get some extra money.
Going deeper into coding means hard work. I would have extra responsabilities. Its too early to talk about that proposal. Put that ships flying like you talked with good graphics and them i will help you. Mission or AI can wait a little more.
Still waiting for the the detaiçs of your game design  :P
Just making sure you are willing when the time arrives.  Also means you input on how things are designed and which script language to use. 
Not looking for any coding at this point, but flushing out the design.  I know that takes time.  The ideas I have gathered will be used to modify and enhance the design I have, and it took many months of research.

I am still planning on finished the design this weekend.

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #34 on: May 31, 2013, 11:59:25 am »
I propose we settle on Angelscript as it is multithread, easy to implement, and it is a known script language.  Being C++ bases it is a little easier to understand that LUA (C based).

If we have to change it later we will, not a major issue.  The we can focus discussion on standards, what we want to do, etc. 

Offline Lieutenant_Q

  • Lt. Commander
  • *
  • Posts: 1669
  • Gender: Male
Re: Configuration and Scripting
« Reply #35 on: May 31, 2013, 03:20:47 pm »
I too, know nothing about scripting, I can write pseudo-code for missions, but I couldn't convert it to actual code.  One thing that sticks out though, is the adaptive AI.  There's a number of things that the AI does that makes me facepalm.  But rather than having the AI learn on the fly, it should be set up that the game sends "performance" reports to a central location, where people can say... well, this is a weakness of it, we need to address this.  This was just the player making a monumental mistake (either intentionally or not) the AI SHOULD NOT be trying to take advantage of that.  (One thing that just popped into my head was the Player purposefully dropping their forward shield when they finished charging their overloads to coax the AI to make a move to attack the downed shield, which, ordinarily would be a good tactic, but with the player ready to unleash a full alpha strike, would be a very BAD tactic.  And then a possible fix to said tactic, the ability to remember things like weapons statuses and shield strengths going back a couple of minutes, so that if a shield went from 30 to 0... the AI should smell a trap, unless said shield just got hit by a 50 point Plasma Torpedo.) 

The AI being able to guess as to when a weapon was ready to fire again would be a big help, if the Player just launched a volley of Photon Torpedoes, the AI should be able to recognize that it has two turns minimum before those weapons can be fired again, and move to take advantage of that.  I think adding Memory ability to the AI would be a massive upgrade, so that it not only is trying to determine the best tactic for the moment, but so that it remembers what happened just a couple of minutes ago, and uses that to build on that tactic.

I think the easiest way to record it (again, I have limited programming experience) is to track every weapon that has a arming time of LONGER than 1 turn.  Phasers, Disruptors, and most Drone Racks are not tracked.  As soon as the AI detects the Heavy Weapon (either by sensors, or the weapon firing) it puts a timer on it, that timer is equal to the amount of time it would take to charge at that game speed. (so a real time game would set a Photon Torpedo timer at 60 seconds)  While the timer for the weapon is greater than 0 the AI would act more aggressively trying to take advantage of the fact that the weapon is still loading.  Once the timer reached, say 15, the AI would go into a defensive posture, ready to counter the Plasma Torpedo that could be launched as soon as 15 seconds.  The number can be updated through Tac Intel, so if it gets close enough to tell that the Player (or other AI) isn't charging their Heavies as fast as possible, it can reset the timer accordingly.  A threshold would have to be set, based on the AI's ship size (and possibly damage state), as to how much heavy incoming fire it would be willing to take.  So that if someone decided that they would just be charging one Heavy, or holding a single Heavy in reserve just to keep the AI on a defensive footing, the AI could determine, that it was willing to take a single Photon, even an Overloaded Photon, to close on the player while he's reloading the other three.  Or that that F-torp that's loaded and ready just isn't a big enough deterrent to keep my fully shielded cruiser from closing and hosing, but if I don't get in in the next 45 seconds, the Player will have that big nasty R-Torp ready for me...
"Your mighty GDI forces have been emasculated, and you yourself are a killer of children.  Now of course it's not true.  But the world only believes what the media tells them to believe.  And I tell the media what to believe, its really quite simple." - Kane (Joe Kucan) Command & Conquer Tiberium Dawn (1995)

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #36 on: May 31, 2013, 03:47:22 pm »
Very good suggestions and much of that is being thought about.  The AI will used a modified Fixed State machine (FSM).  The idea is there will be strategic strategic states that govern the overall strategy of the AI.  And during the tactical portion there will be other rules that will change, but still within the strategic rule.  Like a hierarchy. 

The exact details of how this works cannot be discussed in public forums.


Offline Captain Adam

  • Lt.
  • *
  • Posts: 754
  • Gender: Male
Re: Configuration and Scripting
« Reply #37 on: May 31, 2013, 04:52:48 pm »
.
« Last Edit: April 06, 2016, 01:41:46 pm by Captain Adam »
Odo :    
"Being accused of a crime is not a disgrace, Chief. Some of the great figures of history have shared the honour with you."
to O'Brien
DS9 : Tribunal

Offline [UFP]Exeter

  • Moderator
  • Lt. Commander
  • *
  • Posts: 1080
  • SFC4 Lead Developer
Re: Configuration and Scripting
« Reply #38 on: May 31, 2013, 06:35:15 pm »
The specifics of the AI cannot be in public forums.

To protect the code we are using the Trade Secret laws of the US.  So if for some reason somebofy thinks we my have used SFB stuff and want to review our code, we say no, as they are protected as trade secret.  The difficulty lies that we control access to the knowledge, ergo a non disclosure.

So in general we can discuss but when the discussion gets to close to actual implimentation and how, then I have to pull back.

AI is one of those areas as my thesis was on AI in computer gaming and I did some research there, my knowledge can give us an advantage.

Offline Captain Adam

  • Lt.
  • *
  • Posts: 754
  • Gender: Male
Re: Configuration and Scripting
« Reply #39 on: May 31, 2013, 08:17:44 pm »
.
« Last Edit: April 06, 2016, 01:46:58 pm by Captain Adam »
Odo :    
"Being accused of a crime is not a disgrace, Chief. Some of the great figures of history have shared the honour with you."
to O'Brien
DS9 : Tribunal