Page MenuHomeWildfire Games

Enable one-time effects for technologies.
AbandonedPublic

Authored by wraitii on Mar 27 2017, 11:28 AM.

Details

Reviewers
leper
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Owners Package(Owns No Changed Paths)
Summary

(can't link to trac since it's down right now).

The attached patch does two things that would imo be quite interesting:

  1. It adds a "oneTimeEffect" option for technologies, which can go in addition or in replacement of "modifications". This oneTimeEffect is applied once, upon tech research. It can do anything we define in TechnologyManager.js (we may want a separate file for this?). Technologies that only have a oneTimeEffect have a "repeatable" option which allows them to be researched ∞ times.

This feature can be used to make god-power like features, such as the "spies" tech in AoE 2 or some of the god powers in AoM. It can also be used to upgrade units into other units (see upgrade tech). For the example here I've made a tech that deals 30 damage to all units, and an upgrade one.

  1. It allows technologies to affect tokens. This is done by extending the current technology files to support a "tokens" value, in which you can use "A>B" to change A into B, "-A" to remove A and "B" to add B to the production queue. It works well in my tests, and gets serialised properly.

It also fixes a bug where the training panel does not get refreshed when it should be.

NB: the technologies should NOT go into the game, they're here for demonstration purposes. The one time effects implemented might or might not stay, I don't really care all that much.

EDIT: for tokens, see D270 instead.

Test Plan

Verify that the features work as advertised, report edge cases if you can think of them.

Review the code.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 906
Build 1424: Vulcan BuildJenkins
Build 1423: arc lint + arc unit

Event Timeline

wraitii created this revision.Mar 27 2017, 11:28 AM
Owners added a subscriber: Restricted Owners Package.Mar 27 2017, 11:28 AM
wraitii added reviewers: Restricted Owners Package, Restricted Owners Package.Mar 27 2017, 11:30 AM
wraitii added inline comments.
binaries/data/mods/public/gui/session/session.js
816

not sure what happened here.

source/ps/Replay.cpp
57

this should not be in here, sorry.

Vulcan added a subscriber: Vulcan.Mar 27 2017, 12:32 PM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/613/ for more details.

leper requested changes to this revision.Mar 27 2017, 7:43 PM
leper added a subscriber: leper.

I'm not sure it is a good idea to shove one-time effects into technologies.

I still agree with quantumstate on replacing producable/researchable things being a stupid idea.

This revision now requires changes to proceed.Mar 27 2017, 7:43 PM

Well, I did consider doing otherwise, but I feel like this type of things would necessarily share a lot with technologies (they'd have a cost, a train time, requirements, a name, a description, they would affect only some units…) so I don't think it would make a lot of sense to put it elsewhere. For some other god-power type things we might consider instead training special entities, but for this type of thing I don't really see the point.

I still agree with quantumstate on replacing producable/researchable things being a stupid idea.

Could you detail/link why? This is imo a useful feature (if only for mods, cf Delenda Est, though I plan on using it) that we currently cannot efficiently reproduce with other components.

In D266#10312, @wraitii wrote:

Well, I did consider doing otherwise, but I feel like this type of things would necessarily share a lot with technologies (they'd have a cost, a train time, requirements, a name, a description, they would affect only some units…) so I don't think it would make a lot of sense to put it elsewhere. For some other god-power type things we might consider instead training special entities, but for this type of thing I don't really see the point.

Units do also have a cost, a train time, requirements, a name, a description, and they can even be trained only once.

If it wasn't obvious, the above is not a suggestion but another example of something that could be made to fit when using enough force. You want to do something that doesn't match with technologies, or auras, or units, but rather some effect that can be unlocked (that's where a tech can come in) or something like that. Not that I have an idea what you want to do with that since there is nothing in this diff or elsewhere detailing that, so I'm going to assume that you just picked the first idea that could possibly work and tried that.

I fail to see the point why everything needs to be shoved into one component when adding one that does exactly what is wanted is a lot easier and keeps the whole thing sane.

I still agree with quantumstate on replacing producable/researchable things being a stupid idea.

Could you detail/link why? This is imo a useful feature (if only for mods, cf Delenda Est, though I plan on using it) that we currently cannot efficiently reproduce with other components.

Search for some discussions from 2012. Changing the available entries in those queues hides things from the player. Better have tech requirements, so people know what they need in order to use something. Also the author of that one thing agreed with that back then.

elexis added a subscriber: elexis.Mar 28 2017, 1:08 PM

I see that people may want to accomplish temporary effects when clicking on butttons and see the problem that each time we add one of these, we have to add a unique way to the GUI to implement those.
If there are multiple use cases you foresee to implement, let us hear. It sounds like implementing a new component might be an idea if they share some logic.

Also agree that it's often annoying that our selection panels only show one type of component at a time. For example entities with production queue and techs have no more space to show the Upgrade buttons.
That however, if so, should be addressed in the GUI rather than the simulation.

The way to proceed would be examining what we want to accomplish exactly and then finding a way to implement it cleanly without breaking the well-defined design of some components.

That'd make sense.

The intent of the feature is to enable "one-time" effects, such as spies in Age of Empires 2, some god powers in Age of Mythology, to trigger. Ideally anything could trigger them. If we want that, perhaps the best way is a specific system component that listens to messages and triggers the appropriate effect. However, technologies should still imo allow triggering those effects in a non-complicated way. An example usage of this feature is transforming all entities of type A into entities of type B.

"Timed" effects are just technologies with a time limit, imo. That sounds like something that should come as an improvement to the current technologies component.

Aside from that, there is the feature that we can change Tokens with technologies. I don't really see why we should be dogmatic about this, if a unit, unlockable by tech is just an upgrade on another one it's reasonable to replace it instead of cluttering the GUI. Mods might also want to use it for various features.

wraitii retitled this revision from Enable one-time effects for technologies and allow technologies to affect tokens. to Enable one-time effects for technologies..Mar 28 2017, 4:50 PM
wraitii edited the summary of this revision. (Show Details)
mimo added a subscriber: mimo.Mar 28 2017, 10:12 PM

We currently have 2 hard-coded tech effects (SharedLos and SharedDropsites, see OnResearchFinished in the Player component), could they take advantage of such a "one-time tech"?
On the other side, the "repeatable" option which allows tech to be researched several times looks quite strange to me and in opposition to the concept of a tech. If that is really needed, i think that means that tech is not the proper way to implement it.

wraitii planned changes to this revision.Mar 31 2017, 12:28 PM

Will update using D281.

wraitii abandoned this revision.Sep 6 2019, 10:36 AM

The functionality would be useful, but this most likely isn't the way to go about it.