Population Cap Gadget

Population Cap Gadget

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Population Cap Gadget

Post by Forboding Angel »

I've posted on this before, but basically here is what I want:

Per player supply cap (variable amount of course, preferably a modoption).

Per unit supply usage (using customparams)
So for example, with a supply cap of 100, in the unitdefs, I would define something like supply = 2, for that unit, so you could have 50 of them.

The ability to limit supply available using units (a la starcraft protoss pylons). In other words, lets say total supply cap is 100. I could designate units to be supply givers ( supplygranted = 8, ) which would grant more supply up to the total cap (but not over), or I could just turn that off and have all supply available from the start.

Chili widget visualizing it
In my mind, it would look like the resource bars, except, it would have a little icon and a number xx/yy next to it, and a bar with the current supply listed, and the bar would fill up depending on the total supply and would start flashing red when you get within X (variable number) of the supply cap. This would be it's own UI element, draggable and resizable.

Portability to other projects
It should be able to be used in any game that uses chili (for the gui portion)

I'm willing to donate some cash (50 bucks?) or other services, such as making CEGs, Maps, Videos, etc, to make this happen. I really really want this, and I'm tired of trying on my own and failing. I simply don't understand enough about lua to do it on my own (even hacking it together), and I honestly simply can't afford the time that it would take to learn how to do it (can't really afford the money either, but this is important enough to me that I'll do it). If I had unlimited time to throw at it, I would happily do that in order to learn, but I simply don't (I already feel guilty as hell about spending some hours playing games this weekend instead of working) , so I'm pretty much resorting to whatever I can to try to make it happen.

Anyone interested at all? I realize that there is some bias against people putting money bounties on features, and I understand that. That's why I say I will happily render other services (this would be far better for me anyway) if for whatever reason money is inappropriate.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Population Cap Gadget

Post by Google_Frog »

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

Sure, I'll happily donate it there if whoever does it wishes. In fact that would be excellent and help everyone all the way around.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

https://code.google.com/p/evolutionrts/ ... tail?r=645 Done!

Thanks GoogleFrog! Donation made!
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Population Cap Gadget

Post by jamerlan »

You donated - it's great! but will someone implement what you need?
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Population Cap Gadget

Post by gajop »

Can't you read commits? They have.
User avatar
pnöpel
XTA Developer
Posts: 50
Joined: 09 Feb 2013, 21:48

Re: Population Cap Gadget

Post by pnöpel »

I want big great armies. With zervers multithreading engine, there is a possibility for it and no need for any cap at all. Why have a gap when there is no need?
Last edited by gajop on 12 Nov 2013, 23:57, edited 1 time in total.
Reason: removed link: (points to a page with rtsmp links which are not allowed here)
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: Population Cap Gadget

Post by luckywaldo7 »

pnöpel wrote:I want big great armies. With zervers multithreading engine, there is a possibility for it and no need for any cap at all. Why have a gap when there is no need?
1) There can be gameplay reasons for population caps not related to hardware limitations.

2) Spamming random threads with snarky, off-topic remarks in an effort to plug zerver's engine reflects very poorly on whatever community you are trying to build.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Population Cap Gadget

Post by gajop »

luckywaldo7 wrote: 1) There can be gameplay reasons for population caps not related to hardware limitations.

2) Spamming random threads with snarky, off-topic remarks in an effort to plug zerver's engine reflects very poorly on whatever community you are trying to build.
This, although I'd emphasize 1). Have you heard of Starcraft?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

pnöpel wrote:I want big great armies. With zervers multithreading engine, there is a possibility for it and no need for any cap at all. Why have a gap when there is no need?
That's nice, but as waldo says, there are a lot of great reasons for population caps.

Wrt big armies, in sc2 a 200/200 army is very large. As zerg or terran, even larger than brotoss.

You may like spending 30 minutes to build a massive army, but I would much rather build and lose a massive army every 1.5 minutes, E.G. Evo. It's a lot more fun to have a bunch of massive armies won or lost in a shorter period of time, than spend forever building up one massive army, just to lose it in 1 minute or so.

I'm not going to bother to go into detail though.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

Hmm, as a result of the gui widget, I am getting this error occasionally.

I set max supply to 100 and intrinsic to 0, and I got the error message once when I got the supply count up to 100 then I didn't get it again.

Code: Select all

[f=0009001] Error: LuaRules::RunCallIn: error = 2, DrawScreen, [string "LuaRules/Gadgets/libs/FillModSpecific.lua"]:5: attempt to perform arithmetic on a nil value
Unfortunately it's such a generic message that I can't figure out what is causing it.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Population Cap Gadget

Post by Google_Frog »

Are you sure the widget causes that bug? It says luarules.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Population Cap Gadget

Post by zwzsg »

Hmm, this is a bug from my code: I have a line that tries to parse the version number of Spring, and because the format of the version changed, (and my code wasn't robust), it breaks.




Your error message mention the file: FillModSpecific.lua and the line number: 5

So open the file \LuaRules\Gadgets\libs\FillModSpecific.lua

Look at line 5. It goes:

Code: Select all

	local version=tonumber(string.match(Game.version,"^(%d+%.%d+)"))+(string.match(Game.version,"^[%d%.]+(%+)") and 0.009 or 0)
Replace it by:

Code: Select all

	local version=tonumber(string.match(Game.version,"^(%d+%.%d+)") or string.match(Game.version,"^(%d+)") or 100)+(string.match(Game.version,"^[%d%.]+(%+)") and 0.009 or 0)
Et voilà, fixed.



Yeah, my pattern to extract a version number out of the version string is a bit horrible. Then I suppose you don't really care about engine older than 0.8, so you could have fixed it by just removing the choice in the "if".
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

Awesome, thanks Z :-)
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

Found a bug.

When I give units to my enemies, the supply doesn't get removed from my used supply.

I need to remove sharing to enemies from evo anyway, but yeah, bug is a bug.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

Found a bug. If you give a unit that provides supply to an ally, you keep the supply, they get the unit and none of the supply.

Edit: So apparently giving units that provide supply is jsut plain borked.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Population Cap Gadget

Post by zwzsg »

I didn't even look at the code, and I do not know how it works, but from the sound of your description I can tell a fix would be to add at the end of the synced part of your gadget:

Code: Select all

function gadget:UnitTaken(u,ud,team,newteam)
	gadget:UnitDestroyed(u,ud,team)
end

function gadget:UnitGiven(u,ud,team,oldteam)
	-- Either one of the other, depending which exists in your gadget:
	gadget:UnitCreated(u,ud,team)
	gadget:UnitFinished(u,ud,team)
end
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: Population Cap Gadget

Post by NeonStorm »

Smart peoples automatically generate the supply cap.

It can already be annoying to set all wreckages manually to 100% hp, 50%m, etc. for 50+ units.
(Or energy=metal, time=metal, for build costs)

Each unit could cost 5+ metal/100 if you prefer bigger units (1* 1200m <-> 2* 100m).
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Population Cap Gadget

Post by Forboding Angel »

@neon
That would be relevant, if you knew what you were talking about, that is.

Edit: I just read your post 4 times... what are you talking about? DId you post in the wrong thread?
Post Reply

Return to “Lua Scripts”