Changes to Command AI: CMD_SET_MAX_WANTED_SPEED

Changes to Command AI: CMD_SET_MAX_WANTED_SPEED

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Changes to Command AI: CMD_SET_MAX_WANTED_SPEED

Post by ILMTitan »

I am looking through CCommandAI and it's subclasses, attempting to clean them up, remove some bugs (the aircraft move acting like fight for one), and setting CAirCAI to inherit from CMobileCAI as apposed to CCommandAI.

I would also like to make an alt modifier on non-build commands append to the front of the queue (this would impact some functionality of the move command and so needs to be discussed).

The main purpose of this post, however, is to discuss CMD_SET_MAX_WANTED_SPEED. Currently, it affects:
All commands after it, if it is the last SetMaxWantedSpeed command, even if the queue is canceled before the command executes.
All commands prior to it if it is the first SetMaxWantedSpeed command. If the queue is canceled, it affects all new commands until an new SetMaxWantedSpeed command is added anywhere in the queue (I think).
All commands between it and the preceding SetMaxWantedSpeed command.

All of this seems too complicated to me. I would propose changing it so that it only changes the max wanted speed when it executes. Allowing an alt modifier to place it at the front of the queue would give flexibility similar to the current setup, with a simpler system.

Even if the current system is going to be kept, I'm going to rewrite the code so that it does not iterate through the command queue every slow update.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

hmm, Did you stop to think about how people are going to use this in their script in possibly balance changing ways? An Ai would totally mess that up.

I'm thinking a RequestMaxSpeed cob call be added for scripts to allowmodders to discard it should they deem the new speed as an interference.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I don't think they should be able to prevent it, it's necessary for smarter group behaviour.
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Post by ILMTitan »

The set max wanted speed command already exists. I'm not currently looking to change how one is given, only how it is interpreted by the Command AI once it gets there.
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Post by ILMTitan »

Resurrecting an old thread, I'm going to go ahead and make the change. I don't see enough reason not to. It only seems to be used in SelectedUnitsAI for formation moves. If it breaks some scripts, I can change it back.

P.S. My work on spring was temporally suspended by my team winning the World Series (that's baseball for those of you who don't follow American sports). A 3 hour game I felt compelled to watch most nights for the better part of a month.

EDIT: Ok, I read SetMaxWantedSpeed wrong. It only affects a single command directly in front of it, and does not iterate through he command queue (I was thrown by the use of an iterator). In conclusion, I will not be making any changes to SetMaxWantedSpeed.
Post Reply

Return to “Engine”