Accueil Crush your enemies... and create an EMPIRE!!! Space Empires V -- BUY NOW!!!

Connexion utilisateur

  • Créer un nouveau compte
  • Demander un nouveau mot de passe

Navigation

  • news
    • archive
    • blogs
    • books
    • forums
    • recent posts
    • groups
  • image galleries
  • projects & downloads
  • search
  • create content
  • agrégateur de nouvelles

Rechercher

Qui est en ligne

Il y a actuellement 2 utilisateurs et 155 invités en ligne.

Utilisateurs en ligne

  • Field1701
  • StellarRat

Languages

  • English English
  • French French

Parcourir les archives

« May 2008  
Mo Tu We Th Fr Sa Su
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Accueil » news » forums » Support & Feedback » Scenarios & Mods » SE:V MODs

Creating a dynamic research pathern.

Soumis par Fallen Haven le Lun, 2007-01-08 12:15 SE:V MODs

Right now, i'm working on making my AI research things in a less predictible manner. Right now it just pick things on a list in a sequential order wich means that all AI gets the same things (at least until racial techs start to be researched). My new AI does quite well in all area (it does expend and build stuff quite well) but it's research pathern is lame. I could take hours to make a very elaborate research queue but i would prefer to let the AI choose what it need and pick appropriate tech to level up. I also don't like it to queue up 5-10 level at once as it waste a reseach slot for a long time and the other research fields are left destitute.

I tryied to use the random function, but the random function run each turns and when the roll fail, the item currently researched disapear and research points are wasted. Worst the AI don't fill the free slot so the AI stop researching (though there might be a work around)...

Bah, i'll try something else later today, for now i need some sleep...

‹ Research and the AI. A.I. Modding ›
» Vous devez vous identifier ou créer un compte pour écrire des commentaires

Options d'affichage des commentaires

Sélectionnez la méthode d'affichage des commentaires que vous préférez, puis cliquez sur "Sauvegarder les paramètres" pour activer vos changements.
Image de Thy Reaper
Mod Designer

I've had the same idea

Soumis par Thy Reaper le Lun, 2007-01-08 17:09

Research was the first section I attempted to do in my AI. Unfortunately, I realized that there was a huge amount of work to be done in this regard. I suggest you manually setup a list of the various technologies (a longlist of IDs) and a list of the type of research (longlist of constants you define elsewhere). Put all techs in this list, and later you can pick and choose which ones to exlcude to make more unique AIs.

When the AI gets around to choosing its research, make a longlist of weighting of the various kinds of technologies. If it's in a war, boost up the weighting on battle technologies. If its production is lagging behind, increase the facility research. Pick a random type from this list, and then choose a random technology of that type.

I suggest using something like this (in psuedo code):

goodtech = false
tries = 0

while (not goodtech) and (tries

» Vous devez vous identifier ou créer un compte pour écrire des commentaires

I did some progress...

Soumis par Fallen Haven le Lun, 2007-01-08 19:43

Thy Reaper wrote:
When the AI gets around to choosing its research, make a longlist of weighting of the various kinds of technologies. If it's in a war, boost up the weighting on battle technologies. If its production is lagging behind, increase the facility research. Pick a random type from this list, and then choose a random technology of that type.

I don't understand the game code enough to create such funtion yet. But i did a few routines that do tech upgrades in sequence using the Add wanted tech function as base. It save a lot of line of code and make things easier to debug and tune up.

I should also note that i modded the AI so it can research more things at once. It work quite well and allow the AI to use the extra "slots" to research required technologies (like Construction or Physics tech, so no need to add them to the queue myself). My AI will be very efficient at researching, but still won't be able to pick technologies on a need it basis. Of course i use AI states to dictate the build queues, this should help the AI to focus on some Area that are more useful at the moment. What i want to avoid is that all the AI have the same techs at the same time (bearing the same research potential).

» Vous devez vous identifier ou créer un compte pour écrire des commentaires
Image de Captain Kwok
Mod Designer

Use the AI state to prioritize research

Soumis par Captain Kwok le Lun, 2007-01-08 19:49

What you might want to do is use the AI's current state (explore, infrastructure, attack, defend, etc) to push certain techs ahead of others using conditional statements.

I plan to this in two ways for the Balance Mod AI. The first will be set percentages for each research type (theoretical, weapons, applied, custom ones etc.) and the second way is in the research script itself to push "needed" techs based on the current state.

-----

Space Empires Depot | SE:V Balance Mod

» Vous devez vous identifier ou créer un compte pour écrire des commentaires

well...

Soumis par Fallen Haven le Lun, 2007-01-08 20:04

Captain Kwok wrote:
What you might want to do is use the AI's current state (explore, infrastructure, attack, defend, etc) to push certain techs ahead of others using conditional statements.

The idea crossed my mind but i have no idea on how to implement it. What conditions should i use? Also my tech research splitting mean the AI can reseach multiple tech at once, if it's already researching something, the other slot will pick something else (if it's nothing in it's field, it will pick something from another). I try to avoid multiple level reseach because it occupy a slot for a long time and when the AI try to retrofit, the new ship cost is too high and it will refuse to upgrade (and since the AI can't scrap, it's a useless hulk lying around).

» Vous devez vous identifier ou créer un compte pour écrire des commentaires
Image de Thy Reaper
Mod Designer

Grr...

Soumis par Thy Reaper le Lun, 2007-01-08 21:55

I forgot to escape my greater signs, so I lost most of the rest of that post... crap...

Just in case you didn't know, there is a file in the SE5/Docs folder that explains most of the basic scripting. Even if you know about it I can understand how long getting a hold of the calls can be. I know I still haven't gotten many down...

I'm tired and running low on waking moments, so if you want, I could take some time to explain how to do what I proposed. It'll make more sense than my first ramblings, too. I'll probably think about the best way to do it during school, so I'll have a smoother way of doing it by tomorrow. Or I'll just make a giant topic in the mods forum about dynamic research, and give an example script.

-----
Watch for my mod - codename: Dimensions - coming by Summer, 2007!

» Vous devez vous identifier ou créer un compte pour écrire des commentaires
Image de Captain Kwok
Mod Designer

Setting up research priorities...

Soumis par Captain Kwok le Lun, 2007-01-08 23:36

It's not too hard.

First thing is you'll want to organize the techs in the research script individually or for stock-type level amounts, perhaps in jumps of 2 or 3 levels at a time. I sorted further into the groups that matched the different tech groups.

In the empire's main script file, there is a function "Set_Race_Research_Spending". Essentially create a case structure for the AI's state like this example:

set ai_state := Sys_Get_AI_State(sys_long_Player_ID)

case (ai_state)
  AI_STATE_EXPLORE_AND_EXPAND:
    call lst_Research_Spending_Group_Name.add("Cultural Advancement")
    call lst_Research_Spending_For_Group.add(2)
    call lst_Research_Spending_Group_Name.add("Theoretical Science")
    call lst_Research_Spending_For_Group.add(20)
    call lst_Research_Spending_Group_Name.add("Applied Science")
    call lst_Research_Spending_For_Group.add(48)
    call lst_Research_Spending_Group_Name.add("Weapon Technology")
    call lst_Research_Spending_For_Group.add(30)
  AI_STATE_INFRASTRUCTURE:   
    blah blah
  AI_STATE_ATTACK:
    blah blah
  AI_STATE_DEFEND:
    blah blah
  AI_STATE_NOT_CONNECTED:
    blah blah
endcase

-----

Space Empires Depot | SE:V Balance Mod

» Vous devez vous identifier ou créer un compte pour écrire des commentaires

Ok...

Soumis par Fallen Haven le Mar, 2007-01-09 00:28

Captain Kwok wrote:
It's not too hard.

In the empire's main script file, there is a function "Set_Race_Research_Spending". Essentially create a case structure for the AI's state like this example:

set ai_state := Sys_Get_AI_State(sys_long_Player_ID)

case (ai_state)
  AI_STATE_EXPLORE_AND_EXPAND:
    call lst_Research_Spending_Group_Name.add("Cultural Advancement")
    call lst_Research_Spending_For_Group.add(2)
    call lst_Research_Spending_Group_Name.add("Theoretical Science")
    call lst_Research_Spending_For_Group.add(20)
    call lst_Research_Spending_Group_Name.add("Applied Science")
    call lst_Research_Spending_For_Group.add(48)
    call lst_Research_Spending_Group_Name.add("Weapon Technology")
    call lst_Research_Spending_For_Group.add(30)
  AI_STATE_INFRASTRUCTURE:   
    blah blah
  AI_STATE_ATTACK:
    blah blah
  AI_STATE_DEFEND:
    blah blah
  AI_STATE_NOT_CONNECTED:
    blah blah
endcase

Not sure it will be of use to me as my research script is quite flexible already. Applied and Weapon Technology are splitted in half and can get things done quite fast with low level techs or with a research powerhouse. Theorical get tech on a need basis (like when a required tech show up), i don't set any theorical techs (i removed the part of the script that picked tech to research in alphabetical order). The Cultural value is so insignificant that i don't bother with it. Besides i don't put any tech in there before the second age so a required tech almost always take the slot.

So what i did is i set tech in 1 to 3 level queue. When in low priority, they have less level to queue and i don't set a second instance of it in the list so a free slot to pick it up. This increase the likelyness that a wanted tech get the slot and get researched. My testing show great promise for my scripts and i rooted out all the bugs i could find, it's bullet proof Smiling.

Here an exemple :

  if (Sys_Get_AI_State(sys_long_Player_ID) = AI_STATE_ATTACK) then

    call Add_Tech_Area("Point - Defense Weapons", 2)
    call Add_Wanted_Tech_Areas_For_Designs(2)
    if (lng_Research_Age_Max_Level = 40) then
      if bool_Race_Uses_Cloaking_Devices then
           call Add_Tech_Area("Cloaking", 2)
      endif
    endif
    call Add_Wanted_Tech_Areas_For_Espionage(1)
    if (lng_Research_Age_Max_Level = 20) then
      call Add_Tech_Area("Ship Weapon Mounts", 2)
      call Add_Tech_Area("Base Weapon Mounts", 2)
      call Add_Tech_Area("Shields", 1)
      call Add_Tech_Area("Organic Armor", 1)
      call Add_Tech_Area("Crystalline Armor", 1)
    endif
    call Add_Tech_Area("Sensors", 2)
    call Add_Tech_Area("Armor", 1)
    if (lng_Research_Age_Max_Level = 20) then
      call Add_Tech_Area("Psychic Sensors", 1)
      call Add_Tech_Area("Temporal Sensors", 1)
      call Add_Tech_Area("Scanners", 2)
    endif
    call Add_Tech_Area("Point - Defense Weapons", 3)
    call Add_Wanted_Tech_Areas_For_Designs(3) 
    call Add_Tech_Area("Repair", 2)
    if (bool_Race_Uses_Mines) then
      call Add_Tech_Area("Mines", 1)
    endif
    if (bool_Race_Uses_Satellites) then
      call Add_Tech_Area("Satellites", 2)
      call Add_Tech_Area("Unit Weapon Mounts", 2)
    endif
    if (bool_Race_Uses_Fighters) then
      call Add_Tech_Area("Fighters", 2)
      call Add_Tech_Area("Fighter Weapons", 2)
    endif
    if (bool_Race_Uses_Drones) then
      call Add_Tech_Area("Drones", 2)
    endif
    if (bool_Race_Uses_Weapon_Platforms) then
      call Add_Tech_Area("Weapon Platforms", 1)
      call Add_Tech_Area("Unit Weapon Mounts", 2)
    endif
    if (bool_Race_Uses_Troops) then
      call Add_Tech_Area("Troops", 2)
      call Add_Tech_Area("Troop Weapons", 2)
    endif
    call Add_Wanted_Tech_Areas_For_Designs(1)
    call Add_Tech_Area("Point - Defense Weapons", 1)
    call Add_Wanted_Tech_Areas_For_Hull_Upgrades(1)
  endif

//------------------------------------------------------------------------
// Add_Wanted_Tech_Areas_For_Racial
//------------------------------------------------------------------------
function Add_Wanted_Tech_Areas_For_Racial returns boolean
params
  max_level:         long
vars
  item_added:        boolean
  loop_index:        long
  tech_area:         string
begin
  return TRUE
  // Add wanted types for Racial Techs.
  set item_added := FALSE
  for loop_index := 1 to 5 do
    case (loop_index) 
      1:
        set tech_area := "Psychic Technology"
      2:
        set tech_area := "Religious Technology"
      3:
        set tech_area := "Temporal Technology"
      4:
        set tech_area := "Crystalline Technology"
      5:
        set tech_area := "Organic Technology"

    endcase
    set item_added := Add_Tech_Area(tech_area, max_level)
  endfor
end

  set lng_Research_Age_Max_Level := 10

if (lng_Research_Age_Max_Level = 10) then
  call Add_Wanted_Tech_Areas_For_Planets(1) 
  call Add_Tech_Area("Ion Engines", 3)
  call Add_Tech_Area("Sensors", 3)
  call Add_Tech_Area("Armor", 3)
  call Add_Wanted_Tech_Areas_For_Designs(3)
  call Add_Tech_Area("Cargo", 1)
  call Add_Tech_Area("Storage", 1)
endif

That's how i currently coded my research. Of course i may find some more efficient way to do it but it seem to work flawlessly. My empire get research done quite fast...

» Vous devez vous identifier ou créer un compte pour écrire des commentaires

I succeded.

Soumis par Fallen Haven le Mer, 2007-01-17 22:42

My latest version of my mod does have a dynamic research. It was hard to make, a pain to test and required me to figure out how the game research actually work. For starter, the game always scan the whole research file each round, wich can become quite slow later on. Second the number in () is the level to reach. Once the level is reached, that line is "dead" and won't do anything but waste processing time. The game will run each lines of code in sequence until all the research slots are filled (in stock it's just 3, in my mod, it's 6). Also, if there is nothing to research in a particular field, the game will pick something from another (i believe the game scan the research tree several times). For exemple, it's possible to run out of Theorical techs quite early in the game, this mean the slot is free and the game will pick the next thing you haven't researched to max level(). If not it goes for stuff in the next age, and last will start researching things in sequential manner (alpha order from what is availiable). The game also have the possibility of researching requirments for a tech. How far it will research to get it is dictated by the current research age value. The flaw in that proceding is that it look for level, not how much you have to spend to do it. The AI can be stock a long time researching an expensive 1 level tech (like Astrophysics and the like) instead of doing something else more pressing...

My new research pathern work differently. Max levels are a value that increment in a loop until all research "slots" are filled and all research points are used. It's also divided in the 4 AI states so i can give different priorities (base level to research) for each fields. For thoses i don't want to be picked too early, i give them low or negative numbers so the AI will pick the other techs first. Since the AI clear research spendings every turns, when it switch states it just pick other technologies and continue spending as usual. It work quite well, but only actual field testing will confirm how effective my system works. I just hope to read about it in the following days when comments start comming...

I did not release my code yet, but i will once it showed it's efficiency and all bugs are rooted out. I don't want to repost it 10 times (already post new versions way too often Smiling ).

» Vous devez vous identifier ou créer un compte pour écrire des commentaires

Options d'affichage des commentaires

Sélectionnez la méthode d'affichage des commentaires que vous préférez, puis cliquez sur "Sauvegarder les paramètres" pour activer vos changements.

Now on STEAM

Now on STEAM!Space Empires V via STEAMSpace Empires IV via STEAMSTEAM online by Valve Corporation

Contenu populaire

Aujourd'hui :

  • Defence vs. Attack and other Combat related questions...
  • Sphärenwelt
  • Why Retrofit is limited to +50% per order?
  • Babylon 5 Wars SEV Mod Update
  • Balance Mod Neutral Races

Depuis toujours :

  • Space Empires V and VI: Expansions and the Future: Tell the Company What's on Your Wish List
  • Space Empires V
  • Gritty Galaxy Fleet Clash
  • Damn Dirty Bugs/Annoyances
  • Space Empires V: General Thoughts, Observations, and Suggestions

Dernier accès :

  • Battle Cruisers
  • Empire Starting Positions
  • Allegiance Subverter - works only during battle?
  • SmallShips
  • PLauge bombs
(c) Strategy First, Inc. All rights reserved.