Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop a form of cheating with saved templates #378

Merged
merged 4 commits into from Jun 14, 2019

Conversation

@KJeff01
Copy link
Contributor

commented Jun 11, 2019

A player could save a Viper-MG-Wheels template to later on gain an unfair advantage over someone who didn't (about 30 second lead in production access). This is due to how saved templates are enabled with setDesign() (and how it currently is supposed to be used).

These patches require all players to own an HQ just once to produce anything other than the default truck template.

Additionally, I enabled the default truck and Viper-MG-Wheels template in fastplay which saves players from needing to design them, and turning hasBuiltCommandRelay() into a more general purpose structure finder: structureExists()

Resolves #367

@Forgon2100

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

Test results:

Skirmish games now behave as they should, with one (old) exception:
In T3 games, a transporter template is available by default.

In campaign games, no units can be produced at all before a HQ is built.
Cyborg factories are not exempt from this rule. They should be.
The "Truck Viper Wheels" template should always be available, too.

Fastplay works as expected.

@KJeff01 KJeff01 force-pushed the KJeff01:hq branch from b16854c to 13f894e Jun 12, 2019

@KJeff01

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

Made this skirmish/multiplayer exclusive and explicitly enabled the default truck template in Gamma 1.

Never knew about the T3 transporter always being available like that. Not sure why this happens.

@Forgon2100

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

Made this skirmish/multiplayer exclusive and explicitly enabled the default truck template in Gamma 1.

This is an improvement.
But there are still no cyborg templates without a HQ (try Gamma 1).

In Alpha 1, the "Machinegun Viper Wheels" template should also not be
available as long as the HQ is missing. This would be consistent (and
allow me to submit a patch which makes this mission more challenging
with the campaign difficulty set to "Hard"/"Insane"). What do you think?

diff --git a/data/base/script/campaign/cam1a.js b/data/base/script/campaign/cam1a.js
index bc9892f..77023e0 100644
--- a/data/base/script/campaign/cam1a.js
+++ b/data/base/script/campaign/cam1a.js
@@ -138,9 +138,8 @@ function eventStartLevel()
 
 	enableBaseStructures();
 	camCompleteRequiredResearch(PLAYER_RES, CAM_HUMAN_PLAYER);
-	// These are available without needing to build a HQ.
+	// The truck is available without needing to build a HQ.
 	enableTemplate("ConstructionDroid");
-	enableTemplate("ViperLtMGWheels");
 
 	// Give player briefing.
 	hackAddMessage("CMB1_MSG", CAMP_MSG, CAM_HUMAN_PLAYER, false);

Never knew about the T3 transporter always being available like that. Not sure why this happens.

The transporter that is available is the Cyborg Transport,
which depends on Cyborg Factory and VTOL Factory, according to
http://betaguide.wz2100.net/Research.php?details_id=R-Cyborg-Transport.

The "give all" cheat also enables the Super Transporter.

Both are enabled because their "available" property is set to true in
./data/mp/stats/templates.json. To reverse this, apply the patch below:

diff --git a/data/mp/stats/templates.json b/data/mp/stats/templates.json
index 2aaa5cc..15b1f0b 100644
--- a/data/mp/stats/templates.json
+++ b/data/mp/stats/templates.json
@@ -2313,7 +2313,6 @@
         ]
     },
     "SuperTransport": {
-        "available": true,
         "body": "SuperTransportBody",
         "id": "SuperTransport",
         "name": "Super Transport",
@@ -2371,7 +2370,6 @@
         ]
     },
     "Transporter": {
-        "available": true,
         "body": "TransporterBody",
         "id": "Transporter",
         "name": "Cyborg Transport",

I personally dislike transporters in multiplayer games, but do not know
whether players use them regularly for tactics that are considered fair.

If we keep them, their templates must be available, since they cannot be
designed. But should we? I have asked for opinions in a new forum thread
at http://forums.wz2100.net/viewtopic.php?f=48&t=15224.

@KJeff01 KJeff01 force-pushed the KJeff01:hq branch from 13f894e to 95f25ba Jun 12, 2019

KJeff01 added 4 commits Jun 7, 2019
Check for existing structures better.
Changed hasbuiltCommandRelay() into a general structure checking function.
Require players to have a HQ just once to use saved templates.
Stops an unfair advantage where a player could save a Viper-MG-Wheels template
and begin producing them much sooner than someone who didn't in later matches.

@KJeff01 KJeff01 force-pushed the KJeff01:hq branch from 95f25ba to e0d0af2 Jun 12, 2019

@KJeff01

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

But there are still no cyborg templates without a HQ (try Gamma 1).

I'll put that one setDesign(false) back into the design reticule update section with a comment. setDesign() always enables researched templates.

In Alpha 1, the "Machinegun Viper Wheels" template should also not be
available as long as the HQ is missing. This would be consistent (and
allow me to submit a patch which makes this mission more challenging
with the campaign difficulty set to "Hard"/"Insane"). What do you think?

I would not mind. For the record, I believe some people actually complained about the viper-MG NOT being available without the HQ built on Alpha 1.

I personally dislike transporters in multiplayer games, but do not know
whether players use them regularly for tactics that are considered fair.

If we keep them, their templates must be available, since they cannot be
designed. But should we? I have asked for opinions in a new forum thread
at http://forums.wz2100.net/viewtopic.php?f=48&t=15224.

I don't think it's a good idea to remove transporters from multiplayer just because of this. If anything, a unit limit on transporters might be sufficient to stop bases from being overwhelmingly destroyed by friendly howitzers. That is the one "bad" situation I can think of, anyway.

@Forgon2100

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

But there are still no cyborg templates without a HQ (try Gamma 1).

I'll put that one setDesign(false) back into the design reticule update section with a comment. setDesign() always enables researched templates.

In Alpha 1, the "Machinegun Viper Wheels" template should also not be
available as long as the HQ is missing. This would be consistent (and
allow me to submit a patch which makes this mission more challenging
with the campaign difficulty set to "Hard"/"Insane"). What do you think?

I would not mind. For the record, I believe some people actually complained about the viper-MG NOT being available without the HQ built on Alpha 1.

I'm looking forward to these updates.

I personally dislike transporters in multiplayer games, but do not know
whether players use them regularly for tactics that are considered fair.
If we keep them, their templates must be available, since they cannot be
designed. But should we? I have asked for opinions in a new forum thread
at http://forums.wz2100.net/viewtopic.php?f=48&t=15224.

I don't think it's a good idea to remove transporters from multiplayer just because of this. [...]

Okay. I have dropped that idea.

Forgon2100 added a commit to Forgon2100/warzone2100 that referenced this pull request Jun 13, 2019
Remove Machinegun template without HQ from Alpha 1
While no HQ has been built, only the truck template should be available.

Refs Warzone2100#378
Fixes Warzone2100#383

@KJeff01 KJeff01 added this to the 3.3.0_GM milestone Jun 13, 2019

Forgon2100 added a commit to Forgon2100/warzone2100 that referenced this pull request Jun 13, 2019
Remove Machinegun template without HQ from Alpha 1
While no HQ has been built, only the truck template should be available.

Refs Warzone2100#378
Fixes Warzone2100#383

@KJeff01 KJeff01 modified the milestones: 3.3.0_release, 3.3.0_beta2 Jun 14, 2019

@KJeff01 KJeff01 merged commit 6bd1ca7 into Warzone2100:master Jun 14, 2019

7 of 8 checks passed

LGTM analysis: Python No code changes detected
Details
LGTM analysis: C/C++ No new or fixed alerts
Details
LGTM analysis: JavaScript No new or fixed alerts
Details
WIP Ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
freebsd_build FreeBSD:freebsd-11-2-release-amd64 Task Summary
Details
freebsd_build FreeBSD:freebsd-12-0-release-amd64 Task Summary
Details

@KJeff01 KJeff01 deleted the KJeff01:hq branch Jun 14, 2019

@WZ2100ModsFan

This comment has been minimized.

Copy link

commented Jun 14, 2019

Question Does enable template still works with a mod? or with a military unit it will give you an error?
With this change templates will be harder to get to work with the WZmini mod.
I hope it only affects saved templates. :)

Forgon2100 added a commit to Forgon2100/warzone2100 that referenced this pull request Jun 18, 2019
Remove Machinegun template without HQ from Alpha 1
While no HQ has been built, only the truck template should be available.

Refs Warzone2100#378
Fixes Warzone2100#383
Forgon2100 added a commit to Forgon2100/warzone2100 that referenced this pull request Jun 18, 2019
Remove Machinegun template without HQ from Alpha 1
While no HQ has been built, only the truck template should be available.

Refs Warzone2100#378
Fixes Warzone2100#383
KJeff01 added a commit that referenced this pull request Jun 18, 2019
Remove Machinegun template without HQ from Alpha 1
While no HQ has been built, only the truck template should be available.

Refs #378
Fixes #383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.