- Reaction score
- 960
> I tried to spawn 1000 footman and my pc laggy.
Well, if you instantly spawn 1k footmen right where the camera is...
Well, if you instantly spawn 1k footmen right where the camera is...
Leads to conclusion...I tried to spawn 1000 footman and my pc laggy.
See, kingking... I suppose this is why I don't trust your testing. Spawning 1000 of an intense type of unit which you would never spawn 1000 of to test the effects of spawning 1000 units... I don't get it. =/A map with 1000 units is unplayable, actually.. You will suffer low fps in this status.
You have to find the unit first, doing that the complexity is massive in this type of indexation.I fail to see how you could hit op limit, considering none of my functions cycle through all the units. Each function call is O(1) complexity.
Please explain in better detail?
Each function call is O(1) complexity. :thup:
I'm not sure if you've read my code. This code contains no "loops" at all, except for the player 1-16 on initialisation. (And a fixed 16 loop is O(1) complexity.)Your system has to go through and search and compare from [0] until it finds [998].
struct Aggro extends array
//! runtextmacro AIDS()
unit source // registered unit
unit currenttarget // source's current target
real threat // or a hastable etc.
private static method AIDS_filter takes unit u returns boolean
// Filter the units
endmethod
// can this method take arguments? For defining source for example? Or is it the filters that define source?
private method AIDS_onCreate takes nothing returns nothing
set .source = ?
set .currenttarget = null
call SetupAggro(.source)
endmethod
private method AIDS_onDestroy takes nothing returns nothing
call RemoveAggro(.source)
set .source = null
set .currenttarget = null
endmethod
endstruct
Ok tested, and we can put an unit outside the entire map without a crash, strange ...grim001 said:if you want to stop this bug, you have to prevent it from assigning an index to any unit that already has an index. Even if you use GetWorldBounds, units that exit the entire map and re-enter will wind up with a new index.
In your struct, put [LJASS]//! runtextmacro PUI()[/LJASS]Hmm I wanted to use this for simply attaching a struct to a unit.
But is it even possible to attach a struct that has variable arrays at any time to a unit and not just on creation with AIDS?
With HSAS I just did s.th. like AttachStructBlablabla(unit,struct)
If it is possible may you give an easy example?^^
then your regular struct instance limits apply. If you use "AIDS structs", then you may not use array members at all.In your struct, put [LJASS]//! runtextmacro PUI()[/LJASS]
Read the PUI documentation for more help with this. PUI is a different system written by Cohadar, but AIDS supports all of its features (because you cannot run both).
Alternatively, just use [LJASS]set SomeStructArray[GetUnitId(myUnit)]=myStruct[/LJASS] etc. This is not a bad idea either. GetUnitId returns a value for that unit between 1 and 8191. :thup: