0 votes

Hello

I am making turn based game. My AI has excessive calculations to do before every turn, and I believe these should not be optimised any more. They cause a sharp and short framedrop, that affects animations and actions coming afterward. Is there any way I can tell the code to calculate it calmly and start the animated actions only when the frame is back to normal ??

I also implemented all main calculations in one compressed line, like in this pseudocode :

func AIpickaction():

decide(choosebestaction(countallpossibilities("turn-now"),"sortbyrisk"),choosebestaction(countallpossibilities("turn-future"),"sortbyrisk"))

Should I fragment this line into smaller parts to improve framework, or is it not necesarry ? Or should I use cascade of yields ?

in Engine by (1,110 points)

You can force non-realtime simulation using the --fixed-fps N command line argument (where N is the desired framerate), but this will make the project run as fast as possible. You don't want to use this in an actual game, but rather use it for offline rendering and stuff like that.

Maybe do calculations in another thread? Just maybe.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.