Modder Designed AI Programs Or Input/Output AI

Started by
8 comments, last by axiomsofdominion 7 years, 5 months ago

I've been developing an idea I plan to use in my current game project. At least I hope to do so.

I would like to enable a game state output to a file, sort of like saving, which can then be accessed by a separate program. That program could then return a file which would be read with the game. In this way you would enable modders to have 100% freedom to design the AI mod of their dreams, probably a compiled program in C++ or some other language. Since they are trading file outputs the actual nature of the program probably doesn't matter as far as languages are concerned. The modder made AI could do all sorts of stuff like have its own files and data just like the built in AI of a game does since its its own totally separate program. Well there may need to be a way to spawn multiple instances of the AI module so that they can all run simultaneously and speed up the end turn wait. My CPU has 8 logical cores so it could use 1 for each instance of the AI.

Well, even just using all 4 cores would be helpful. Otherwise as long as your program could produce proper output you would have total freedom in the AI. Obviously for real time and multiplayer games this could be an issue, especially some kind of cheat in multiplayer, though I'm not sure it would be super easy to send a bogus output to get some benefit.

Also each individual AI could allow for scripting if so desired since it can do anything it wants, so you wouldn't be preventing non programmers from helping.

I'm working out some of the details of this now as I do other things so I'm curious if people here had any thoughts.

Advertisement

Exposing game data and allowing input is something a few existing games do.

For example, the sim racing title "iRacing" outputs all kinds of telemetry. While they've taken steps to stop you from being able to develop an AI that actually drives your car, people have developed 3rd party programs such as a voice-controlled AI race engineer to tell you strategy information and handle your pit stop settings for you.

I'm thinking more of strategy games, should have made that clear, but good to know that the general idea has been functionally implemented. In the strategy context the AI would play the AI and you'd play the player, since unlike a racing sim the AI can't easily out-compete humans, so there'd be little benefit in having the AI play for you. Though I suppose some sort of cheating could be done in multiplayer or something if you worked hard at it.

In the more specific context of turn based strategy games, especially single player, do you see any downsides? I feel like the upside for modders would be huge given how shitty TBS AI tends to be.

I would like to enable a game state output to a file, sort of like saving, which can then be accessed by a separate program. That program could then return a file which would be read with the game.

These don't have to be actual files on the disk - the general topic to look up is inter-process communication, or IPC

Some options to look into are: named pipes, shared memory or good old sockets.

Sockets and named pipes let you send packets of data back and forth, so you can define your own data protocol to communicate with these external apps. Anyone who follows your protocol can then make their own app. e.g. our engine is C++, but it works fine with 3rd party apps written in Visual Basic .NET :)

Exposing game data and allowing input is something a few existing games do. For example, the sim racing title "iRacing" outputs all kinds of telemetry

In our racing game engine, we support exporting the state of the player's vehicle via pipes and shared-memory, so that 3rd party programs can convert that data into motor control signals for 6DOF motion platforms.
iRacing works well on these kinds of motion platforms too, thanks to them outputting the same data :)

I'm thinking more of strategy games, should have made that clear, but good to know that the general idea has been functionally implemented. In the strategy context the AI would play the AI and you'd play the player, since unlike a racing sim the AI can't easily out-compete humans, so there'd be little benefit in having the AI play for you. Though I suppose some sort of cheating could be done in multiplayer or something if you worked hard at it.

In the more specific context of turn based strategy games, especially single player, do you see any downsides? I feel like the upside for modders would be huge given how shitty TBS AI tends to be.


I think you overestimate self-driving cars :D I was mainly referring to things like making fast ARB adjustments during cornering, or automatically increasing traction control in the event of wheelspin.

I think that as long as you only expose to the AI what a player character would have exposed to them, then it's quite feasible. Obviously your game would need to generate enough interest that someone would want to develop an AI for it, but at the very least it would allow you to easily drop in your own AI as well.

I'd love for something like Civ6 or GalCiv3 to add this system. Their AIs are so awful. There's so many things you could do with their game systems to make AIs that act uniquely and do interesting stuff and are also really, really good. Also you could easily scale difficulty without cheating.

I'd love for something like Civ6 or GalCiv3 to add this system. Their AIs are so awful. There's so many things you could do with their game systems to make AIs that act uniquely and do interesting stuff and are also really, really good. Also you could easily scale difficulty without cheating.
Have you ever considered trying this in an open source project?

It comes with full source code, that you can change as you like.

I'd love for something like Civ6 or GalCiv3 to add this system. Their AIs are so awful. There's so many things you could do with their game systems to make AIs that act uniquely and do interesting stuff and are also really, really good. Also you could easily scale difficulty without cheating.
Have you ever considered trying this in an open source project?

It comes with full source code, that you can change as you like.

You can do that yes, but it would still be better for the AI to be separate from the game.

You can do that yes, but it would still be better for the AI to be separate from the game.
Doesn't "you can change as you like" already include that option?

As far as I can see, nothing stops you from building an external interface first.

You can do that yes, but it would still be better for the AI to be separate from the game.
Doesn't "you can change as you like" already include that option?

As far as I can see, nothing stops you from building an external interface first.

I mean I can do it but I'm not sure why I would. For testing purposes? I don't have any particular interest in most open source games and their userbases are small and generally not very good and their mechanics design tends to be easily exploitable. Who puts enough time into FreeCiv that making an AI that can beat them is impressive at all? Making a good Civ6 AI is impressive, would have visibility, and could be tested against top players with name recognition for talent.

Also with open source I'd have to convince people to download, set up, and test the game vs whatever form they prefer.

And getting up to speed with an open source code base is a pain and would take away from the time I spend developing my own current not Civ like project.

This topic is closed to new replies.

Advertisement