Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Conclusion: ###
- I want a gridID for every shield grid in a game like http://Zero-K.info.
- BUT
- Grids
- * can get decimated by a single shield at a time
- * can grow by adding new shields
- * removed at once or by a random percentage by atomar nukes
- * split into a random number of grids
- * created from a new shield unit and a random number of grids
- * can have only 1 shield
- ### Numbers and Table-sizes ###
- IMPORTANT:
- Above the following specifications, lags are possible and caused by boring or Epic_Shore-games.
- If you get over these specifications, the rest of the code would lag anyway.
- Unit ids:
- 1 to 500 (extreme cases like chicken games)
- Teams:
- 1-4 (extreme cases like FFA)
- Max shields per team:
- 250 shields *2 teams
- 125 shields *4 teams
- Worst case(s):
- 190 in the biggest group and 20 single groups with up to 3 entries each (per team)
- 250 shields in 150 groups
- ### Code structures ###
- Original code source: http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaRules/Gadgets/unit_shield_link.lua
- AdjustLinks() is called every Second from gadget:GameFrame
- ### Table structures ###
- shieldUnit = {
- -- shield unit created:
- capacity = max charge
- regen = charge+
- regenEfficiency = charge+ / energy-
- -- AdjustLinks() re-generates every second:
- link = { [unitID] = shieldUnit, ... } --each shieldUnit of a grid has the same table
- x, y, z = unit position
- linkable = not inbuild and not stunned and not active == false and valid unit position
- --[[
- --su = shieldUnit = customTable --every Spring unit which got a shield has one customTable
- --id = UnitID from Spring
- if su5 connects su(1&2) with su(3&4)
- then su(1..5).link == { id5=su5, id1=su1, id2=su2, id3=su3, id4=su4 }
- --]]
- }
- shieldConnections[teamID] = { --created by AdjustLinks()
- [unitID1]=(adjacent unitID2),
- --NEVER [unitID2]=unitID1,
- [unitID3]=(adjacent unitID4),
- ...
- }
- And lua-tables are not sorted in the order you added the entries if you don't assign values to incremental keys
- * It might get out as 3,1,5,2,4
Advertisement
Add Comment
Please, Sign In to add comment