[Feature Request] SPADS Plugin for Lobby to Game communications
Posted: 25 Mar 2018, 09:14
Unfortunately, this seems to be the only way to contact Bibim. So ban-dodging, against my nature for the hopeful betterment of whatever. (edit: viewtopic.php?f=10&t=36782 - Silentwings)
Now that that is out of the way. I will try to nutshell what I need.
I've been playing a lot of sc2 recently. As you may know, sc2 is a game that is laser focused on meaningless tasks, doing them fast and in the right order. I happen to be pretty skilled at the game. This causes issues when trying to introduce friends to the game as if they play vs me, even with 2 or 3 of them, they get steamrolled.
But sc2 has a feature that works REALLY well to even the gap... Handicap. You can handicap a player, and at player's units take an HP cut equal to the handicap. I.E. unitHP = unitHP * handicapAmount * 0.01 (making the handicap number a percentage). To clarify, maximum and normal handicap is 100%. 100% is the normal handicap level for every player. It cannot be increased over 100%
It works so well that I am in awe of its simplicity. The reason it works so well is because it doesn't change game balance overall in the same way that manipulating resources or weapon damage would. As a handicapped player at 50 or 60%, I play the game exactly the same way that I would as if I were at 100%, just with the knowledge that my units and buildings are significantly weaker. In the realm of sc2, this means that my 200/200 army, could break even with my opponents 100/200 army. It is an absolutely fantastic solution and it works extremely well. Better than any other handicap system that I have used in any other rts. Moreover, it allows me to play games vs my gaming group friends who aren't remotely as skilled, and they can even win sometimes (we usually do 2v1 at 50 or 60% handicap).
But how to implement in spring? How to set a handicap on a specific player? How to feed that info from the lobby to the game? Is this something that would have to be done in game? Would you have to have a gadget listening for UnitCreated per teamID and then setting maxhealth that way? Is there any feasible and simplistic way that this could be done?
Having asked that question, yes there is (thanks to sprung for helping).
As I see it, I am in need of a plugin that can pass parameters to the game via TeamRulesParam (GetTeamInfo?). At which point, a gadget containing the above snippet just listens, waits for unitcreated on a specific teamID (teamID vs playerID because you have to account for commsharing) and sets hp, EzPZ.
As I see it, a generic plugin that can be tailored to send info to the game from the lobby could have a myriad of uses, this only being a small example of a use case scenario. Bibim, could you add this ability to spads?
P.S. Directed at he who shall not be named: I expected that you would do something silly, and so I preemptively pastebinned it accordingly. I was hoping that I would be wrong, but sadly, I was right.
Now that that is out of the way. I will try to nutshell what I need.
I've been playing a lot of sc2 recently. As you may know, sc2 is a game that is laser focused on meaningless tasks, doing them fast and in the right order. I happen to be pretty skilled at the game. This causes issues when trying to introduce friends to the game as if they play vs me, even with 2 or 3 of them, they get steamrolled.
But sc2 has a feature that works REALLY well to even the gap... Handicap. You can handicap a player, and at player's units take an HP cut equal to the handicap. I.E. unitHP = unitHP * handicapAmount * 0.01 (making the handicap number a percentage). To clarify, maximum and normal handicap is 100%. 100% is the normal handicap level for every player. It cannot be increased over 100%
It works so well that I am in awe of its simplicity. The reason it works so well is because it doesn't change game balance overall in the same way that manipulating resources or weapon damage would. As a handicapped player at 50 or 60%, I play the game exactly the same way that I would as if I were at 100%, just with the knowledge that my units and buildings are significantly weaker. In the realm of sc2, this means that my 200/200 army, could break even with my opponents 100/200 army. It is an absolutely fantastic solution and it works extremely well. Better than any other handicap system that I have used in any other rts. Moreover, it allows me to play games vs my gaming group friends who aren't remotely as skilled, and they can even win sometimes (we usually do 2v1 at 50 or 60% handicap).
But how to implement in spring? How to set a handicap on a specific player? How to feed that info from the lobby to the game? Is this something that would have to be done in game? Would you have to have a gadget listening for UnitCreated per teamID and then setting maxhealth that way? Is there any feasible and simplistic way that this could be done?
Having asked that question, yes there is (thanks to sprung for helping).
Code: Select all
function gadget:UnitCreated(unitID, unitdefid, unitTeam)
local customKeys = select(7, Spring.GetTeamInfo(unitTeam))
local mult = customKeys.handicap or 1 -- (0; 1]
Spring.SetUnitMaxHealth(unitID, select(2, Spring.GetUnitHealth(unitID) * mult)
end
As I see it, a generic plugin that can be tailored to send info to the game from the lobby could have a myriad of uses, this only being a small example of a use case scenario. Bibim, could you add this ability to spads?
P.S. Directed at he who shall not be named: I expected that you would do something silly, and so I preemptively pastebinned it accordingly. I was hoping that I would be wrong, but sadly, I was right.