Loading...
  OR  Zero-K Name:    Password:   
Title: Coop Battle
Host: AUrankAveragePlan
Game version: Zero-K v1.7.2.1
Engine version: 104.0.1-287-gf7b0fcc
Battle ID: 688084
Started: 5 years ago
Duration: 47 minutes
Players: 3
Bots: True
Mission: False
Rating: None
Watch Replay Now
Manual download

Team 2

AI: Brutal (1) <CircuitAIBrutal32>
AI: Brutal (2) <CircuitAIBrutal32>
AI: Brutal (3) <CircuitAIBrutal32>

Show winners



Preview
Filter:    Player:  
sort


5 years ago
Brutal AI really doesn't understand sea. It keeps thinking that any unit can attack submarines.
+1 / -0
Just add "SUB" into "noChaseCategory" of every unit that can't chase submarines. Currently the game says that almost anything can target SINK, and SINK is a part of submarine's category. It is unrelated to difficulty/AI (i think).

TODO: Check map type detection (water/land): hiccups a bit - no reason to build land-only striders on this map.
+0 / -0
Pretty much all ZK SINK units can become attackable by normal weapons. Subs can be beached with lobsters or terraform, amphs can just walk onto land or float.


I think a more robust in-Circuit check would be to check if the target unit is legitimately a sub or currently submerged (see waterline, submarine tags and unit's current altitude - a surfaced SINK buoy should be killed, but a submerged one will require waterweapons).

Then compare against the currently considered unit's equipment of waterweapons (or maybe just store this per-unitdef, "can attack underwater targets".)
+0 / -0
Done. :P

Except that waterline is hardcoded, and it's not 0 (but negative value) because we want to attack pesky grizzly if it just started to submerge.
Hence the issue is to calculate the bottom (for subs) and upper (for land/air) boundaries of unit's hitbox. And i'm afraid it's not related to unit's model height and position (not quite sure how to calculate it with AI API).

I think SUBs weren't swimming in such shallow waters in former times, but i could be wrong.

Adding SUB to noChaseCategory of units that can attack only above water would fix issue with submarines only indeed; just an option. Having malformed models with position.y above water and hitbox hidden underwater will still cause bad chasing.

So what's the full proper way to determine if hitbox is underwater, in water (both sub and land can attack), or over it from AI's API perspective?
+0 / -0
At least for purposes of generating wake effects for ground units, i consider the unit to be not completely submerged when unit height + pos.y > 0.

But this applies only to ground units; for subs and ships i guess you'll have to actually also substract the waterline, going to this:

isSubmerged = (pos.y + unit.height - unit.waterline) > 0 


In the Java interface you can obtain these values like this:
UnitDef.getWaterline
UnitDef.getHeight

I assume the C++ interface has something extremely similar.

Height (and radius) are not guaranteed to completely match the unit's collision volume.

But parsing the actual colvol SEEMS TO BE EXTREMELY SIMPLE is an absurdly difficult task because there's no unified way in which is defined; it's influenced by model file (in different formats for different models; s3o and 3do have in-file metadata, assimp models have modelname.ext.lua metafiles), unitdef fields (colllisionVolumeScales etc) and gadgetry (which takes some customParams and applies them in a similar way).

(Note that that is per-unitdef and not per-unit; however ZK generally doesn't modify colvols for unit instances).

But i think generally height should be good enough.
+1 / -0
Unfortunately provided link to getCollisionVolume is outdated, no such function exists for native AI in modern engine (same as getMinAirBasePower, getRefuelTime, getMaxFuel). Have to rely on unreliable position and height.
isSubmerged = (midpos.y + unit.height/2 - unit.waterline) < 0
+0 / -0