Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2580 closed defect (fixed)

[PATCH] Civ Specific technologies researchable outside Specific Civ

Reported by: s0600204 Owned by: leper
Priority: Must Have Milestone: Alpha 17
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

Very few of the civ-specific technologies have a civ requirement set. This means that with the right instruction, it is possible to research a technology intended for use by another civ. Repeatedly.

Example: I start a new single player skirmish, playing as the Mauryans. Using the 0ad javascript debugger (although I could have used the tools on the Developer Overlay), I find the entity id of a building belonging to me. Making sure I have enough resources, I call down the console line and type Engine.PostNetworkCommand({"type": "research", "entity":5482, "template": "persians/persian_architecture"}), press enter, and my Mauryan building starts researching a Persian technology. And once it finishes, I can then call down the console line and run the same command, and research the tech again, with cumulative effects.

I note that both the mauryan and persian civs have a special_archery_tradition tech, which adds +10 to the range of archers. It is currently possible to research either or both, on any civ, by using the above technique, giving archers ever increasing range (and ever decreasing max-health). And as special_archery_tradition seems to affect buildings as well (or did when I experimented), researching this tech a few times means one ends up with towers that may be very weak structurally, but can pick enemy units off at an unrealistically long distance!

I haven't played any multiplayer yet, so I do not know whether it would be possible to do the above whilst playing against others rather than the AI. Admittedly the average player may not have the technical know-how to even start working out how to do the above, and I realise that Engine.PostNetworkCommand() is not something you might expect a player to use mid-game, but it only takes one malcontent to screw a game up for others.

Possible Solutions:

  • Adding a civ requirement to all civ-specific techs (not just the civbonus_* techs as is at the moment) would prevent a player from researching techs not intended for the civ they're playing.
  • As to the ability to research techs repeatedly - this applies to all techs (the cumulative effects from running vision_outpost six times in succession gives outposts sufficient line-of-sight to see across half a medium size map - and can be done fairly early in a game). Maybe an array in the player object of the techcodes belonging to the techs a player has already researched, to be checked before research is initiated?

Attachments (2)

command.js.diff (1.2 KB ) - added by s0600204 10 years ago.
A check to prevent a technology from being researched more than once.
civReqs_on_techs.diff (29.4 KB ) - added by s0600204 10 years ago.
Add civ requirements to civ-specific techs that don't already have them.

Download all attachments as: .zip

Change History (13)

in reply to:  description comment:1 by historic_bruno, 10 years ago

Replying to s0600204:

I haven't played any multiplayer yet, so I do not know whether it would be possible to do the above whilst playing against others rather than the AI

Indeed it is, thanks for reporting this! :)

I guess we are relying on the UI to prevent these cases. Engine.PostNetworkCommand is used by the GUI scripts directly to send commands, so we can't do anything about that, but we definitely shouldn't rely on it passing only valid/legal/correct commands. The proposed checks should go in Commands.js or component helper functions it uses, if applicable.

Please let us know if you find any more.

Last edited 10 years ago by historic_bruno (previous) (diff)

comment:2 by historic_bruno, 10 years ago

Milestone: BacklogAlpha 17
Priority: Should HaveMust Have

comment:3 by sanderd17, 10 years ago

I think it's fine to rely on the GUI to check those things. But the developer console should be disabled in rated games.

Note that we also have a cheat to research technologies now, so you don't even need the dev console. (cheats are also disabled by default in multiplayer games).

in reply to:  3 comment:4 by historic_bruno, 10 years ago

Replying to sanderd17:

I think it's fine to rely on the GUI to check those things. But the developer console should be disabled in rated games.

And what prevents me from modifying the GUI to remove those checks? That would be even easier than using the console. The problem isn't in the console. The simulation has to perform the checks, that way if someone tries to modify that, the game will go OOS.

by s0600204, 10 years ago

Attachment: command.js.diff added

A check to prevent a technology from being researched more than once.

by s0600204, 10 years ago

Attachment: civReqs_on_techs.diff added

Add civ requirements to civ-specific techs that don't already have them.

comment:5 by leper, 10 years ago

Keywords: patch review added
Summary: Civ Specific technologies researchable outside Specific Civ[PATCH] Civ Specific technologies researchable outside Specific Civ

Please read SubmittingPatches when doing so, thanks.

comment:6 by leper, 10 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 15343:

Also check if a technology was already researched when checking requirements. Fixes #2580.

comment:7 by leper, 10 years ago

In 15345:

Add civ requirements to civ specific techs. Patch by s0600204. Refs #2580.

comment:8 by leper, 10 years ago

Keywords: review removed

Thanks for the patches. I didn't use the one for Commands.js as a tech should only be researchable once, so checking it as a part of the requirements makes more sense IMO.

comment:9 by s0600204, 10 years ago

No problem. It's nice to feel like I've contributed, even if its small.

Just one thing, and this is my fault for not realising it earlier, is that the romans/vision_sibylline tech was created after I posted my patch and thus was not included in the diff. To be consistent, the requirements value should be altered to include a requirement for the rome civ. My mistake, sorry. Do you need/want a patch for this?

And thank you for committing even some of my patch work.

comment:10 by leper, 10 years ago

In 15346:

Add civ requirement to tech that was missed in the previous commit. Refs #2580.

comment:11 by leper, 10 years ago

Thanks for checking it again.

Note: See TracTickets for help on using tickets.