antibert / Hoard_Mode

4 stars 4 forks source link

sometimes gold bags wont be registered by the gold bag handler #168

Open DankBudd opened 6 years ago

DankBudd commented 6 years ago

this usually happens when there are a lot of bags being spawned at once. because theres a varying delay for how long the datadriven CreateItem function takes to actually spawn them its impossible to determine exactly when we should be checking for the bags.

the only solution i can think of it to just check for bags around the drop location several times for a long time, and it would keep checking for until bags are found, or until some long time has passed. say 10 seconds.

SirPannbiff commented 6 years ago

I'm actually planning to move all gold bag drops to bosses and to increase their value to 200, so that would limit the number of spawned bags to 12 per boss, 5 for the two minibosses from waves 2 and 3, and 1 per money creep. Do you think that might help the issue a bit?

The reason for the change is that right now there's a huge discrepancy in the average amount of gold awarded from gold bags depending on the waves spawned and on the map chosen. For example, on the 5p map players will on average earn around 4500 gold less from the spider wave than from the golem wave. Furthermore, since there are 3 lanes spawning creeps that drop bags on the 4p/5p maps and only one on the 2p map, wave 2 in itself can award 10k gold less on the 2p map.

DankBudd commented 6 years ago

i suppose it could help. but i've never actually seen the money creeps' bags not get registered though.

i imagine the issue actually stems from many bags being dropped from one creep (like the big lighting birds i think?), rather than a few bags being dropped by many creeps (current money creeps). because it seems like valve tries to pre-spawn all the bags before starting launch loot, like they do with neutral creep camps.

if that ^ is in fact the cause it could be dealt with by spawning large numbers of bags in small intervals rather than all at once.

SirPannbiff commented 6 years ago

Perhaps we could simply try spawning a single bag per enemy and just have three different gold values reflected by the bags' model sizes (200g for money creeps, 1000g for minibosses, 2500g for bosses). I already gave it some thought some time ago, but I was a bit worried that a high-value bag might end up in a place where it would either not be visible or be impossible to collect. Now that I think about it again, though, I guess it can be easily fixed by setting the bag fountain's radius to zero and significantly increasing bag collection radius.

DankBudd commented 6 years ago

sounds like a good plan. it would in theory fix the problem, lets see how it plays out.

SirPannbiff commented 6 years ago

Alright, I've now pushed an update with these changes. During testing I noticed that it was possible for some bags to spawn a tiny bit outside the bag handler's search range, which would explain why some bags were not registered. This was due to the spawn radius being set to 10, which meant that a small number of bags could land between 351-360 units away from the caster's location, while the handler only searched up to 350 units away.

SirPannbiff commented 6 years ago

Oh, and I've increased the handler's interval to 0.5s, since now there will be just a few coins/bags/chests (I had to use different models, because model size cannot be easily changed in datadriven item definitions) spawned throughout the game