Problem Description
I have my AI Player set up in the CASP files, but now I need to make it work in game. At first my thought was to make Null for controller be equal to AI in the flow module, but then it occurred to me that would mess with training mode where I want nothing to happen.
Is there a simple way to make it possible for human players to set a slot for AI, or a way to have training mode override the new default of no device meaning AI input?
Also on a smaller scale, I’m not able to get the game to take Null as meaning AI input in general.
Within CMFlow.gd under the func GetBattleInitDataFromCSS(cssData):
for pid in range(cssData[“Devices”].size()):
var device = cssData[“Devices”][pid]
if(device == null):
device = “empty”
#device = “AI Controlled”
The commented out code is what I attempted to replace the line above it with, but that led to a crash so I had to copy the original code back in.
Technical Info
Castagne Version: v0.57 (Latest)
Host Engine: Godot
Genre: 2D Fighter / 2.5D Fighter
Almost, device = “ai” should do the trick. I belive you can see it in the editor menu too.
“ai” did the trick, though for full context AI Controlled is the display name given to it in the editor so that’s why I went with it. Now I’m at the second part of the problem where the ai is also doing things in training mode instead of staying still like a good training dummy. I’m not sure how to set up an ‘is training mode’ trigger to disable the AI, thought about using a variable but not sure how to ensure it’s at the right values for vs and training.
You can use the game mode as a reference. I went to fetch the snippet I did in Void Fury in CMFlow.gd’s GetBattleInitDataFromCSS():
var device = cssData["Devices"][pid]
if(device == null):
if cssData["CallbackParams"]["Mode"] == 0:
device = "ai"
else:
device = "empty"
Thank you, that worked. For my own comprehension/future reference, how would I find the number values for game modes in the code? I’m trying to find the cssData dictionary but a search all files command in godot didn’t get me to the key and I’m not seeing it in the casp files I’ve checked.
CastagneGlobal.gd has them:
enum GAMEMODES { MODE_BATTLE, MODE_TRAINING, MODE_EDITOR, MODE_NETPLAY }
You can ignore them if you want and add your own modes, it’s just for easier use and not a strict enum, but it doesn’t read any option other than those by default.