Opened 12 years ago

Last modified 5 years ago

#997 new enhancement

Unit Conversion / Capturing

Reported by: historic_bruno Owned by:
Priority: Should Have Milestone: Backlog
Component: Simulation Keywords: design
Cc: Patch:

Description (last modified by fatherbushido)

Capturing is defined as one player 'stealing' ownership of an entity from another player. The entities that are capturable in the game are domestic animals, female workers, and some structures (not walls, or towers, or special structures - see #996). Some outdated info from the design doc:

  • Entity must be capable of performing capture
  • Enemy entity must be within specified capture range
  • Enemy entity must stay in capture range for a specified time
  • No enemy units have the enemy entity in their LOS

Potential modifications of capture behavior:

  • Entity must have hitpoints below a specified percentage value
  • Capturer has a 'cooldown' before another capture may be performed
  • Capture time (long/short)
  • Capture radius (small/big)
  • May not be any entities garrisoned within the structure

Change History (18)

comment:1 by historic_bruno, 12 years ago

#1310 was a duplicate of this ticket specific to animal capturing, but some relevant info was presented:

  • The animal can only be tasked to move by the player who owns it
  • Any player (whether they own the animal or not) can stil kill and harvest from it.
  • Domestic animals created by the player (goats, sheep etc) should automatically be owned by that player
  • Boats, structures, and mechanical units (siege) should not convert animals, but other player units may do so.
  • Animal capturing should probably not rely on the number of units involved, but rather a "first come, first captured" system.

Note that animal capturing may not require all the advanced functionality of other types, but it seems cleaner to have one capturing system for everything. It would be reasonable to start implementing capturing with this simplified behavior, provided it is extensible and not an ugly hack :)

comment:2 by Aurélio A. Heckert, 11 years ago

Please come to the forum topic 10848 and lets talk, plan, design and maturate this idea.

comment:3 by michael, 11 years ago

I think there should be a distinction made between "capturing" which generally requires input from the player (e.g., capturing a building or elephant), and "conversion" which would happen automatically when units are in range of a convert-able unit (herd animals, females).

comment:4 by sanderd17, 11 years ago

I have added a small patch for converting (not capturing).

Units will automatically be converted by enemy units when there are enough of them (and they have the right class).

In the template, you can choose the range, this is the range in meters where the convertable unit will count the ratio of allies and enemies.

You can choose the needed ratio, that is the ratio between ally and enemy units needed to convert. Note, as you always count yourself as ally, you can never reach the 100% enemies ratio. The ratio should at least be 0.5, to avoid units switching from side over and over again without any movement.

You can define the minimum and maximum time it takes to convert. The maximum time is the time it takes when there are barely enough enemies to convert you, and the minimum time is when it's full of enemies.

You can define the classes of units that are able to convert you, these are the classes counted to calculate the ratio. Note that, even if you're not in the classes, you count always as 1 unit.

There is currently no GUI for it, but you can already see the conversionStatus in the selectionDetails overlay. When the conversionStatus reaches 0, the unit will be converted.

In this patch, some templates are changed for testing. Herded domestic animals can be converted by any unit, females can be converted by soldiers, and infantry can be converted by champions, healers and heroes. Although it takes very long to convert infantry, so that won't happen often.

Problems with this implementation:

  • units keep their buildable structures, so if you can convert a female, you can construct an enemy civil center, and thus all the buildings and units an enemy can.

comment:5 by sanderd17, 11 years ago

Keywords: patch added
Summary: Unit Conversion / Capturing[PATCH] Unit Conversion / Capturing

comment:6 by Lionkanzen, 9 years ago

Any news with this?

comment:7 by Stan, 9 years ago

Keywords: review added

comment:8 by s0600204, 9 years ago

I've tried this on A17, and have the following remarks:

  • Line 74 has a misplaced semicolon
  • The function ApplyTechModificationsToEntity (lines 270, 279, 290 & 300) was renamed to ApplyValueModificationsToEntity in r14001.
  • Should Chickens, be affected by this? 'cause they are.
  • Sheep can capture Sheep. And chickens. And vice versa.
  • And, more critically, it causes 0AD to crash.

From skimming through the patch, I noticed this, which might be why 0AD crashes:

  • Four lines into the .OnOwnershipChanged function (line 36):
    • this.rangeQueries is set to an empty array
    • Then a few lines later this now empty array is iterated through (or would be if it had anything still in it)
    • Before being set for the second time to an empty array.
  • My reasoning:
    • The array, before it is cleared for the first time, contains Range Queries. (Or more likely references to them.)
    • The iteration is supposed to go through the array and "destroy" the queries.
    • As the array is empty, the Range Queries are not being destroyed and so presumably keep going.
    • Meanwhile, new Range Queries are being created...
  • Commenting out the offending line (41) seems to resolve the crashing problem.
Version 1, edited 9 years ago by s0600204 (previous) (next) (diff)

comment:9 by sanderd17, 9 years ago

Keywords: review removed

Patch wasn't meant for review yet. Merely as a hint to others who want to work further on it, or test stuff.

comment:10 by sanderd17, 9 years ago

Ugh, looks like I accidentally deleted my patch. But anyway, a 2 years old patch should be rewritten I guess.

comment:11 by Stan, 8 years ago

Keywords: capture convert patch removed
Summary: [PATCH] Unit Conversion / CapturingUnit Conversion / Capturing

Removing patch as there is no longer one.

comment:12 by wraitii, 8 years ago

Keywords: design added
Milestone: BacklogAlpha 20

Bumping for interest.

comment:13 by Lionkanzen, 8 years ago

Ok this must be the next step. And is related with many things specially sheeps, mercenary camps and other auto convert.

comment:14 by elexis, 8 years ago

Milestone: Alpha 20Backlog

Backlogging due to lack of progress.

comment:15 by fatherbushido, 6 years ago

Description: modified (diff)
Owner: set to fatherbushido
Status: newassigned

comment:16 by fatherbushido, 6 years ago

WIP

comment:17 by fatherbushido, 6 years ago

Owner: fatherbushido removed
Status: assignednew

comment:18 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

Note: See TracTickets for help on using tickets.