• Civilization 7 has been announced. For more info please check the forum here .

CIV2 With AI Help?


Aug 31, 2001
@Prof. Garfield
I was sent this image today, which shows an AI working with Lua...

Apparently Chat-AIs know all about Lua language, and can effortlessly be made to bug-hunt, or spool out scripts.
Seems that this tool can be tailored to CIV2 scenarios. I think it is a path we should explore...Defintely if we can
get the AI to churn out templates and then populate the templates with CIV2 scenario data...The possibilities are vast...

What do you think, lads?
I'd have to spend time with the actual AI program to get any idea of whether or not this would be useful. At the moment, it is just making stuff up about Civ II Lua. This could be useful in its current state as a sort of "road map", like asking an experienced programmer who is unfamiliar with the details of Civ II Lua writing the outline of a program, after which the scenario designer has to go through and figure out how to actually make the details happen with the Civ II Lua API. Or, it could be largely useless in this role, because it doesn't understand the limitations (and therefore necessary workarounds) of the Civ II Lua API.

For example, this script doesn't know that you can't change a unit's movement, only the unitType's movement. And the workarounds to give a particular unit extra movement are the actual hard part of the program. Anyone who could do that would have no problem with the logic of this script.

The usefulness of the AI also depends on how much it can "learn" about the actual Civ II programming. I don't know if the stuff that has been written is enough training data for the AI to get the details of Civ II Lua correct. Would we have to resubmit Civ II data each time we used the program, or could we submit it to the maintainers once? If I "teach" the AI by correcting errors, will it "learn" from those errors? In particular, would it remember those corrections in a different session, either with me or someone else trying to get it to program some Civ II Lua?
So, I've spent a couple months using GitHub Copilot . I've been using it in VS Code along with the Lua Language Server extension. Lua LS is free, and I've been documenting much of the template using it. It both provides tooltips within VS Code and can export that information, making it easier to build the documentation website.

GitHub Copilot is definitely worth $10/month for me. I'm not sure how useful it will be to others, but they do offer a free trial, and they did email me before the end of the trial in case I wanted to cancel.

GitHub Copilot is not a substitute for knowing how to program. It will offer suggestions and it is up to you to know whether the suggestion will do what you want it to do. Sometimes the suggestions feel like magic, and sometimes they're wrong. It seems to me that you have to be pretty decent at reading code and understanding what it does in order to tell the difference between good suggestions and bad ones. And you have to be sufficiently familiar with TOTPP Lua and the template to know if it is suggesting real functions. I suppose a decent amount of this ability to distinguish good code from bad could be substituted with actually testing the code with the game.

In addition to sometimes "magically" knowing exactly what you want to do based on the function name (and, maybe, comments you've written earlier in the code), Copilot is also pretty good at doing repetitive tasks after a couple of examples. It is also good at generating error messages for if statements that "guard" against bad inputs. Furthermore, I find it quite good at doing "standard" programming tasks, like counting things, where I might sometimes stop to think "how exactly do I write this".

If you hesitate to spend $10/month to enhance a hobby unless its really worth it (which I totally understand), I'd suggest getting to the point where you can complete a decent size Lua project (at least mostly) on your own, before trying GitHub Copilot. (Also become comfortable with VS Code beforehand.) That way, you can get a good idea of what it can offer during the trial period, without being inhibited by the process of learning programming.
Top Bottom