Capping assistance

Capping assistance

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Capping assistance

Post by Jools »

Is it somehow possible to cap the number of units that can assist the building of stuff? I guess it can be handled by gadget, but what would be the best practise? There are lot's of things being built and handling them outside the object is silly. The property of "being assisted" should be an object property. handling it in a global gadget is silly imo...
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Capping assistance

Post by smoth »

why is handling it via a gadget silly?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Capping assistance

Post by Jools »

Because the propoerty of being assisted belongs to the unit in question and not to the gadget. It should be OO. But maybe it becomes OO if one stores the property in UnitRulesParams. Maybe I'm just writing to clear my thoughts :)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Capping assistance

Post by smoth »

Jools wrote:Because the propoerty of being assisted belongs to the unit in question and not to the gadget. It should be OO. But maybe it becomes OO if one stores the property in UnitRulesParams. Maybe I'm just writing to clear my thoughts :)
I am not sure what OO has to do with it.

The unit in question could have the thing as a tag in customparams.

Why should the engine enforce that property? A gadget utilizing rules param could reasonably handle it.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Capping assistance

Post by Jools »

I'm not saying that the engine necessarily should enforce it. I was asking about best practise.

It's OO because the unit is an object and the gadget is not.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Capping assistance

Post by smoth »

that isn't OO.

I would do it in a gadget but then again, I am with the camp we should move as much as we can to gadgets so it is more flexible.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Capping assistance

Post by Jools »

It needs then some kind of a callin that tells when an unit begins assisting another, and also conversely when the assisting stops. There is atm addon.UnitCommand, but there is no notification from that when it is cancelled, and also this is called when the order is given and not when assistance begins.

There is addon.UnitCmdDone, which is called when a project has been completed. But I don't think too catches abandoned commands.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Capping assistance

Post by FLOZi »

Checking in AllowCommand should be feasible
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Capping assistance

Post by Jools »

You can have units on the other side of the map given assist order. They should all receive the order, but only the first n number that reaches the construction site should be allowed to actually assist. How to check that? Units can also be moving and assisting. Would be easier to have a buildbegins callin or something.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Capping assistance

Post by FLOZi »

Jools wrote:You can have units on the other side of the map given assist order. They should all receive the order, but only the first n number that reaches the construction site should be allowed to actually assist. How to check that? Units can also be moving and assisting. Would be easier to have a buildbegins callin or something.
Catch StartBuilding in unitscript and communicate back. :twisted:
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Capping assistance

Post by Jools »

Hmm, yeah. It's not in the list: http://springrts.com/wiki/Lua:Callins
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Capping assistance

Post by knorke »

ugly but could work:
Get the buildprogress every second.
If the nanoframe is being built too fast, then set its progress to the maximum allowed growth per second. Give the extra resources back to team.
Periodically check if too many cons are trying to build and send them away. That can be a slow check since the actual limit is via tracking the buildprogress.

:shock: Also not for XTA please ;)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Capping assistance

Post by FLOZi »

Jools wrote:Hmm, yeah. It's not in the list: http://springrts.com/wiki/Lua:Callins
Wrong list (note unitscript not gadget);

http://springrts.com/wiki/Animation-LuaCallins
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Capping assistance

Post by Jools »

Oh, yeah, of course. Thank you!

I knew I had seen that callin somewhere, and it was in the unit script. How bad would it be to send the event to lua from an unitscript that is in cob? Better than buildprogress I think? It still says using GET variables is about 100 times faster...
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Capping assistance

Post by Google_Frog »

You can also use AllowUnitBuildStep if the script callins do not work for your purpose. Try the script first because AllowUnitBuildStep would be more resource intensive.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Capping assistance

Post by CarRepairer »

I already made a gadget that limits assisting units to 5. See Supreme Annihilation. It was long ago though.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Capping assistance

Post by Jools »

Yes, but this gets very complicated. Especially ince if it has to be a modoption, you have to communicate from lua to cob if the option is on/off.

Where did you handle the checking of allow condition? In AllowBuildStep?

Because if you do it in AllowCommand then what happens if 10 guys are assisting something and one dies? The extra one should be allowed to assist then. Bleh. It would be a nice modoption but not if it gets too taxing...
Post Reply

Return to “Game Development”