Author Topic: Scripting access to the engine for modding  (Read 12481 times)

Offline Turbo

  • Squaddie
  • *
  • Posts: 2
    • View Profile
Scripting access to the engine for modding
« on: June 11, 2010, 07:05:23 am »
(created a different thread for each suggestion, hope it's OK)

It would be cool to allow the maximum access to the game engine through a scripting language to allow modders to change stuff, such as adding new weapons, graphics, game rules, AI, etc. This could be done using a popular scripting language (Lua, Python, AngelScript).

Just saying because I would very much like to see/implement riot shields, grappling hooks and other stuff into the game, and feel that the project would benefit by using a design of this kind.
« Last Edit: June 11, 2010, 07:22:27 am by Turbo »

Offline sardaukar

  • Squaddie
  • *
  • Posts: 2
    • View Profile
Re: Scripting access to the engine for modding
« Reply #1 on: June 11, 2010, 03:56:26 pm »
+ 1 on this. If you build it, they will come ;)

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Re: Scripting access to the engine for modding
« Reply #2 on: June 11, 2010, 07:15:50 pm »
+1

That would be cool. I think that after finishing reimplementing x-com functionality, it would be great if most of game logic (prices, technologies, alien species, mission types) could be softcoded. That way C++ code could only contain engine, while actual game could be implemented in some scripting language. This would allow experimenting with game without requirement to compile code.

AngelScript could be best choice if you would like to stick to c++ like syntax. I would suggest also lua - many games are using it. For example corsix-th (open source engine for theme hospital) has all high-level logic written in lua:
https://code.google.com/p/corsix-th/wiki/LuaAndC

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Scripting access to the engine for modding
« Reply #3 on: June 12, 2010, 08:58:01 pm »
While it will be a while before the game can be easily modded, I am designing it with that in mind. Currently all the static value stuff like crafts, weapons, items, aliens, research tree, base layout, etc, are all kept separate from the engine. So the engine treats all that stuff equally. Whether it's a Skyranger or an Avenger it won't care, it'll just look at the values like "soldier capacity" or "acceleration", so you can easily make your own stuff and later it'll all be loaded from XML or something.

I haven't looked at stuff like Lua and external scripting though. I know it's all the rage but I imagine it's a lot more work than it looks, and I'm not sure of the advantage of softcoding everything and turning it into a generic game engine just for moddability's sake.


Offline gosse

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: Scripting access to the engine for modding
« Reply #4 on: June 12, 2010, 09:45:37 pm »
I'd strongly advise into putting all the content data-driven (UI screens, soldier names, base facilities, aircrafts, etc.) instead of hard coded within the game logic. A good example of great externalization is what they did with Jagged Alliance 2 1.13; making the game fully customizable.
As for LUA, it is really not that hard to integrate, but I'm not sure it would serve much purpose, except maybe for the AI.

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Scripting access to the engine for modding
« Reply #5 on: June 13, 2010, 01:56:17 am »
I haven't looked at stuff like Lua and external scripting though. I know it's all the rage but I imagine it's a lot more work than it looks, and I'm not sure of the advantage of softcoding everything and turning it into a generic game engine just for moddability's sake.

For mods for such things like new craft etc. You wouldn't need scripting, you could just read in the data like you do with the current UFO data.

The only thing I could think you'd need scripting for is for things like building a non-standard weapons (like the Blaster Launcher), or a teleporting device (like Unreal Tornament's Translocator)

Offline serge

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: Scripting access to the engine for modding
« Reply #6 on: June 20, 2010, 01:43:48 pm »
People who are interested in a scriptable xcom compatible engine may consider ufo2000 as an alternative ;)

Regarding lua vs. xml. Being able to use scripts as opposed to just a plain structured data representation gives a bit more flexibility. For example, ufo2000 uses lua scripts for random maps generation (in order to ensure properly aligned roads, etc.).

AI is another good candidate for scripting, but it was mentioned already.

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Re: Scripting access to the engine for modding
« Reply #7 on: June 20, 2010, 05:03:20 pm »
Script maybe could also allow to implement custom missions. Like "aliens kidnapped some very important person, and you must rescue him" etc.