Openage: Scripting API

Created on 7 Feb 2017  路  6Comments  路  Source: SFTtech/openage

As our ultimate goal is cool moddability, and not everything can be done with data mods (with nyan #734) we also need scripting support.

This consists of multiple parts that need to be done:

  • [ ] Load and run scripts

    • [ ] Load scripts via nyan

    • [ ] Install script hooks via nyan

    • [ ] Let the script manipulate the hooks it installed

  • [ ] Game manipulation

    • [ ] Apply patches in nyan

    • [ ] Perform actions with game entities

    • ...

  • [ ] higher level AI scripting

    • [ ] Python interface

    • [ ] even higher level lisp-like interface like the original's ai scripting language

    • ...

  • [ ] Caution users against unsgned mod packs containing scripts

    • We can't and want to sandbox python, you should be able to use http://scikit-learn.org/ and the like

    • The openage-dev-team should be able to sign mods that have approved code: We can still hack your computer with the regular openage code, so we can also sign mod code.

api python to-discuss

Most helpful comment

The Standard ones:
Defend the Wonder, Conquest, King of the Hill, Conquest

New types:

  • Tower Defense: all Players against AI (where does the Emeny appear? how many? who do the attack?)
  • HelmsKlamm: 2 Players defend a position and get 2xressources per villager as the other 6
  • Capture the Flag/Relic: go to the enemy base and capture the relic
  • toxic map: units/defense structures/buildings loose their health points over time (until 20% or 30% or only 10 points?)
  • civ hopping: every 5min the players civ changes randomly (got to work out details like civ1 research paladin and civ2 has not, but the next civ3 you can have paladin again)
  • Wonder Race with fighting
  • Kill the Founding Fathers, kill all the villagers from the game start (nothing else matters) (to the players, they are indistinguishable from normal villagers), you have to remember them or place them in towers and give up ressource gathering, good times for raiding with horses

other stuff:

  • environment changes, new lakes, forests, shallow crossings, rivers disappear
  • technology upgrades only for newly created units.
  • technology stealing, monk converts unit => you get all technologies this unit has
    monk converts blacksmith/stable.. => you get all technologies which has been researched in this type of building (option: other player looses it, must research it again)
  • units/castles earn experience for every kill/damage = unit gets stronger=> more attack, more range,.. or become a special unit (Robin Hood)
  • technology choosing, if you do x, the cost of y doubles
  • the same random civ bonuses/handicap for all players/teams, e.g. woodworkers are 20% faster-
    every player(or team) get a different random bonus/handicap
  • random events => gold/forest/lake/relic appears on the map, (all) player gets a random unit/building/technology
  • upgrade town center to castles
  • technology civ conversion, change civ mid game
  • the thief (a villager who changes color), can steal gold from castles/town center, if he is killed on the way back, the gold transforms to a gold mine, counter unit: every non mounted military unit who is on attack mode can look him in the eye and see the enemy

All 6 comments

if the api has access to the whole gamestate

it can determine if a player has lost and will be removed from game
=> so every gametype can is possible by simple providing a python script

Yes, it should be possible then. What other gametypes do you have in mind?

The Standard ones:
Defend the Wonder, Conquest, King of the Hill, Conquest

New types:

  • Tower Defense: all Players against AI (where does the Emeny appear? how many? who do the attack?)
  • HelmsKlamm: 2 Players defend a position and get 2xressources per villager as the other 6
  • Capture the Flag/Relic: go to the enemy base and capture the relic
  • toxic map: units/defense structures/buildings loose their health points over time (until 20% or 30% or only 10 points?)
  • civ hopping: every 5min the players civ changes randomly (got to work out details like civ1 research paladin and civ2 has not, but the next civ3 you can have paladin again)
  • Wonder Race with fighting
  • Kill the Founding Fathers, kill all the villagers from the game start (nothing else matters) (to the players, they are indistinguishable from normal villagers), you have to remember them or place them in towers and give up ressource gathering, good times for raiding with horses

other stuff:

  • environment changes, new lakes, forests, shallow crossings, rivers disappear
  • technology upgrades only for newly created units.
  • technology stealing, monk converts unit => you get all technologies this unit has
    monk converts blacksmith/stable.. => you get all technologies which has been researched in this type of building (option: other player looses it, must research it again)
  • units/castles earn experience for every kill/damage = unit gets stronger=> more attack, more range,.. or become a special unit (Robin Hood)
  • technology choosing, if you do x, the cost of y doubles
  • the same random civ bonuses/handicap for all players/teams, e.g. woodworkers are 20% faster-
    every player(or team) get a different random bonus/handicap
  • random events => gold/forest/lake/relic appears on the map, (all) player gets a random unit/building/technology
  • upgrade town center to castles
  • technology civ conversion, change civ mid game
  • the thief (a villager who changes color), can steal gold from castles/town center, if he is killed on the way back, the gold transforms to a gold mine, counter unit: every non mounted military unit who is on attack mode can look him in the eye and see the enemy

Will the normal game be done within this API? I remember vanilla Call of Duty having all of their gametype code as "mods".

what is normal gametype?
conquest=> (1: all own units destroyed) and (2: all own towncenters destroyed) and (3: all own villagers dead) and (4: all own buildings destroyed) => I lost
(5: all enemies have lost) => I win

hooks: 1-5 will be implemented as hooks, so yeah everything will be a "mod". It will be a big API, if we want everything as accessible as hook.

@Yanikore yes exactly. The converted data from the original game is then just a data pack for the engine that happens to behave and look as aoe2.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

heinezen picture heinezen  路  7Comments

jimbob88 picture jimbob88  路  13Comments

UmbertoCorvaglia picture UmbertoCorvaglia  路  6Comments

k3x picture k3x  路  7Comments

ShadowCreator picture ShadowCreator  路  3Comments