#4078 closed defect (fixed)
[PATCH] Singleplayergame with only bots
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 22 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
It should be possible to start a game with only bots assigned (and without having to start a networked game for that).
Relevant code is all in gamesetup.js
. The player should still be assigned to slot 1 by default, but if unassigned, don't reassign forcefully.
Attachments (2)
Change History (16)
by , 8 years ago
Attachment: | all_ai_in_sp.patch added |
---|
comment:1 by , 8 years ago
Keywords: | rfc patch added |
---|---|
Milestone: | Backlog → Alpha 21 |
Summary: | Singleplayergame with only bots → [PATCH] Singleplayergame with only bots |
comment:2 by , 8 years ago
Your patch works. Style looks good.
Only remarks:
- delete L1604-L1606 and enable the StartGame button by default in gamesetup.xml
assignedCount
is not used anymore, so remove it at all- Use
if (
instead ofif(
by , 8 years ago
Attachment: | all_ai_in_sp_v2.patch added |
---|
Do not forcefully reassign players and remove the check requiring at least one human player to start
comment:4 by , 8 years ago
Keywords: | review added; rfc removed |
---|
comment:5 by , 8 years ago
Keywords: | rfc added; review removed |
---|
Hey Ixly only devs are allowed to put patches in the review queue, so I'm bumping this back to rfc queue. Thanks for your work.
comment:6 by , 8 years ago
Independent TODO:
It were great if we could fast forward AI only games with more than 2x speed. This can happen when setting g_GameSpeeds
in session.js
. game_speeds.json
and settings.js
would have to be extended. This can happen independently of the gamesetup patch.
comment:7 by , 8 years ago
Milestone: | Alpha 21 → Alpha 22 |
---|
Sorry that we didn't have time to review this yet. Part of the fact is that it is very easy to break things in this file in non-obvious ways.
follow-up: 10 comment:9 by , 7 years ago
Your patch allows to use unassigned players (gray "Unassigned"), it doesn't throw any error for me, but I think, it's not good to allow to the user do that.
comment:10 by , 7 years ago
Keywords: | simple rfc removed |
---|
Hello ixly! Sorry we had no time to further review your patch in the last 6 months :/ The patch still applies cleanly and is mostly correct. However it needs some polishing:
guid.substr(0, 3) == "ai:"
can usestartsWith
- Merging of the
unassigned
andai
case is good, I'm surprised it wasn't done in svn yet (in one of my branches though :P) -
enabled="true"
is not needed, as that is the default - Notice that we can already start a networked game with only bots, as unassigning the previously replaced player in MP games is done via the
Engine.AssignNetworkPlayer(playerID, "");
statement. So your addition is correct, but this one seems more straight-forward (and avoids a variable):else if (g_PlayerAssignments.local.player == idx+1) g_PlayerAssignments.local.player = -1;
(Also this check is preferable as it doesn't rely on theselection
variable which is constructed by the somewhat complicated but unneeded code in the same function. ) - Removal of the
Only enable start button if we have enough assigned players
is correct, as that check was tautological in singleplayer and irrelevant in multiplayer.
Replying to vladislavbelov:
Your patch allows to use unassigned players (gray "Unassigned"), it doesn't throw any error for me, but I think, it's not good to allow to the user do that.
In that case we should remove the "Unassigned" option altogether, right?
About fast-forwarding (more than 2x) in singleplayer: that doesn't seem useful currently as the AI is too slow for that in the first place.
comment:11 by , 7 years ago
Also the unassignInvalidPlayers
function resets the player to slot 1 if it was assigned to a slot that was removed after reducing the number of players. Instead, the player could remain unassigned, so as not to overwrite AI setting.
comment:13 by , 7 years ago
Description: | modified (diff) |
---|---|
Milestone: | Work In Progress → Alpha 22 |
Do not forcefully reassign players and remove the check requiring at least one human player to start