#1555 closed enhancement (fixed)
[PATCH] Cheats
Reported by: | O.Davoodi | Owned by: | O.Davoodi |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 11 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: |
Description
http://www.wildfiregames.com/forum/index.php?showtopic=13439&hl=cheat&st=40
We should determine which cheats we really like to include. This patch adds 4 resource cheats and a reveal map one.
Attachments (6)
Change History (34)
by , 12 years ago
Attachment: | cheats.patch added |
---|
comment:1 by , 12 years ago
Milestone: | Backlog → Alpha 11 |
---|
comment:2 by , 12 years ago
comment:3 by , 12 years ago
Keywords: | patch review added |
---|---|
Summary: | Cheats → PATCH] Cheats |
I was thinking there would be something like a CheatManager
component, then as quantumstate says, it could have a method like SetCheatsEnabled(bool)
which gets called during game setup. That would provide an easy way to enable or disable cheats. It should be possible to cheat in both single and multiplayer games. So basically moving the logic from commands.js
to the proposed cheat manager (I think there should only be one such global, system component).
comment:4 by , 12 years ago
Summary: | PATCH] Cheats → [PATCH] Cheats |
---|
comment:5 by , 12 years ago
New version with some new cheats. I should explain some things though. I didn't add a checkbox in the game setup because people can change their gamesetup code too. Also I didn't add a cheat component because of the unnecessary complexity it seemed silly to make a whole new system component just for cheats. So I added it to the player component (after all, it is players who cheat). Each player has a "enableCheats" that determines if it can use cheats. AI players should be able to do that (for a super-hard ai) but human players should only be able to use cheats if they are the only non-ai player in the game. The check is done in the init part of the player.
Another note is: for fast train/gather/build cheats, we can add a multiplier to the whole time attributes that toggles between something like 0.01 and 1 when those cheats are entered. But is it a good approach?
comment:6 by , 12 years ago
Only enabling cheats when there are AI's in the game is a bit of a hack, you can have AI's in a multiplayer game. There should be a proper way to disable cheats, having them permanently disabled in multiplayer and enabled in single player would be ok but an option in the game setup would be better.
comment:7 by , 12 years ago
I agree with the need for a game option. In single player the game will become too easy if there's no way to disable cheats pre-game, the player will always be tempted by their availability. And obviously I think cheats should be an option for multiplayer as well, why not?
The option could be handled easily in simulation\helpers\InitGame.js
and simulation\helpers\Player.js
depending on how it's implemented.
I don't think it's possible to modify the UI to get around a proposed cheat option in multiplayer, not if it's done correctly, because the host will send game settings to all client players. If one player has different game settings then they will become out of sync after a cheat is improperly used. If they modify the session UI to send cheat commands, it will work on their local simulation but on others, also leading to an OOS. It might be possible to interfere with the setup messages somehow or impersonate the host, but well, that's a bit beyond the scope of this ticket ;)
One thing about the last patch: IID_TrainingQueue
no longer exists, being replaced by IID_ProductionQueue
.
by , 12 years ago
Attachment: | cheats.3.patch added |
---|
comment:8 by , 12 years ago
Done. Although you didn't answer my last question: for fast train/gather/build cheats, we can add a multiplier to the whole time attributes that toggles between something like 0.01 and 1 when those cheats are entered. But is it a good approach?
by , 12 years ago
Attachment: | cheats.4.patch added |
---|
follow-up: 11 comment:10 by , 12 years ago
This looks like a good approach.
I don't like IsNumbered, IsNumeric would be better.
In the multiplayer setup the cheat option is not updated when the host changes it (you can launch multiple 0 A.D. instances to test multiplayer locally).
Also when playing a multiplayer game the cheat gets repeated once for every player in the game. So using "i want pizza" gets me 300 resources in a 3 player game. This probably means that you are sending a network message from code which is running due to a network message being sent (I think the PostNetworkCommand call in message.js is the unnecessary one).
When cheats are typed and cheats are disabled then they are silently absorbed, they should be shown as normal chat messages instead.
comment:11 by , 12 years ago
Replying to quantumstate:
This looks like a good approach.
I don't like IsNumbered, IsNumeric would be better.
In the multiplayer setup the cheat option is not updated when the host changes it (you can launch multiple 0 A.D. instances to test multiplayer locally).
Also when playing a multiplayer game the cheat gets repeated once for every player in the game. So using "i want pizza" gets me 300 resources in a 3 player game. This probably means that you are sending a network message from code which is running due to a network message being sent (I think the PostNetworkCommand call in message.js is the unnecessary one).
When cheats are typed and cheats are disabled then they are silently absorbed, they should be shown as normal chat messages instead.
I can't reproduce the third one. Is it sent to every human player or ai players are also counted? If this is a problem for cheats, it is also problem for all other network commands as well (eg. it should train 3 units instead of 1). The rest are fixed and will be committed when the third one is fixed.
comment:12 by , 12 years ago
I don't know if this solves the problem (but it probably should), but you should hook the cheat parsing (for the gui) into messages.js
's submitChatInput() as that is only called once (and seems like the proper place to do this). You can also check (with a GuiInterfaceCall?) if cheats are enabled and if not skip the parsing there.
by , 12 years ago
Attachment: | cheats.5.patch added |
---|
comment:14 by , 12 years ago
Tried the latest patch... Everything seems to have patched OK, got the following errors:
Using "iwanttopwnthem" or "how do you turn this on?"
ReferenceError: IID_TrainingQueue is not defined
Cheat([object Object])@simulation/helpers/Cheat.js:80
ProcessCommand(1,[object Object])@simulation/helpers/Commands.js:41
ERROR: Failed to call ProcessCommand() global script function ERROR: JavaScript error: simulation/helpers/Cheat.js line 80
After having used "i am too busy", clicking on a tree.
WARNING: JavaScript warning: simulation/components/ResourceGatherer.js line 260 reference to undefined property rates[type.generic]
It also appeared "pandoras box" didn't work, but no errors. I believe "isee a mountain here" should be "i see a mountain here".
Also, you used IsNumberic and not IsNumeric, I assume it's a typo?
comment:15 by , 12 years ago
The first one is my fault. I forgot to change IID_TrainingQueue to IID_ProductionQueue.
The second one however, is very odd. Does it happen without "i am too busy" ?
Those two are typos. Sorry.
comment:16 by , 12 years ago
For "createunits", spawn
should be renamed to cmpProductionQueue
per convention.
Is it intentional that "fastactions" will affect all players? Either way it seems yucky to use a global variable for that. Why not have it in the Player component, then it could be per-player (also get the benefit of serialization)?
I would rename SetCheatStatus
/GetCheatStatus
to SetCheatsEnabled
/GetCheatsEnabled
, since status is less clear.
follow-up: 19 comment:17 by , 12 years ago
fastaction is intentional. It will be used very much when we start balancing the game and to maintain balance, we must make it work for all players.
The rest are fixed. Any more suggestions?
comment:18 by , 12 years ago
It would be nice that when using a cheat a message is printed to the screen giving a feedback to the user (other than the cheat effect itself), similar to what happens when opening the Developer Overlay.
follow-up: 20 comment:19 by , 12 years ago
Replying to Spahbod:
fastaction is intentional. It will be used very much when we start balancing the game and to maintain balance, we must make it work for all players.
Well consider the case of AIs, for a harder AI we could make them act faster, but it shouldn't apply to human players as well. This is why I say it should be per-player, but for a global "fastaction" we could easily set the multiplier for all players at once. And we eliminate the possibility of weird serialization problems related to an un-serialized global.
follow-up: 21 comment:20 by , 12 years ago
Replying to historic_bruno:
Replying to Spahbod:
fastaction is intentional. It will be used very much when we start balancing the game and to maintain balance, we must make it work for all players.
Well consider the case of AIs, for a harder AI we could make them act faster, but it shouldn't apply to human players as well. This is why I say it should be per-player, but for a global "fastaction" we could easily set the multiplier for all players at once. And we eliminate the possibility of weird serialization problems related to an un-serialized global.
I don't know much about the programming part of this, but just at face value it does sound a bit weird to use cheats to change the AIs. But perhaps this is some more basic function that can be used by both AIs/cheats?
comment:21 by , 12 years ago
Replying to feneur:
Replying to historic_bruno:
Replying to Spahbod:
fastaction is intentional. It will be used very much when we start balancing the game and to maintain balance, we must make it work for all players.
Well consider the case of AIs, for a harder AI we could make them act faster, but it shouldn't apply to human players as well. This is why I say it should be per-player, but for a global "fastaction" we could easily set the multiplier for all players at once. And we eliminate the possibility of weird serialization problems related to an un-serialized global.
I don't know much about the programming part of this, but just at face value it does sound a bit weird to use cheats to change the AIs. But perhaps this is some more basic function that can be used by both AIs/cheats?
We won't be going to use cheats to change the ai. Just a super hard AI may use cheats to be more a challenge.
comment:22 by , 12 years ago
@Spahbod: nope, the "I am too busy" error actually also happens without using the cheat. But it's only there when using your patch. Procedure to reproduce: start a normal game on Oasis 4 (change nothing). Select all your starting units but the horse, click on a tree (I personally clicked on the left-most tree of that forest on the right.) It only happens when clicking with a group, though.
by , 12 years ago
Attachment: | cheats.6.patch added |
---|
comment:23 by , 12 years ago
Newest patch.
wraitii: i still can't reproduce the error. maybe your own files are not clean?
follow-up: 25 comment:24 by , 12 years ago
Perhaps. Running "svn status" gives me no difference with SVN, but you never know. I'll look into it.
Pandoras Box still seems not to work for me. "How do you turn this on?" was seen as a cheat but spawned no planes. The rest is ok.
comment:25 by , 12 years ago
Replying to wraitii:
Perhaps. Running "svn status" gives me no difference with SVN, but you never know. I'll look into it.
Pandoras Box still seems not to work for me. "How do you turn this on?" was seen as a cheat but spawned no planes. The rest is ok.
Pandora's Box really doesn't seem to work. The problem is that, it worked before. I really don't understand what I have done. O_o
Did you select a cc/barracks/any building that trains something? It is how addunits effect works (so that you can still call planes when your cc is destroyed).
comment:26 by , 12 years ago
Quick note: cheats.6.patch seems to include a bunch of changes for choosing player colour.
comment:28 by , 12 years ago
Keywords: | cheat patch review removed |
---|
Removed "pandora's box" from the cheat list because it no longer worked. Didn't commit the player color choice because it would certainly need some cleanup.
Thanks for the patch. Unfortunately it is currently insecure, so anyone who modifies their GUI scripts can cheat. The networked check needs to be moved to simulation (Commands.js). Unfortunately this is not so straightforward since g_IsNetworked is not available in the simulation. I would guess that to make things work you would use a setting at game launch.