Infinite resource amount and storage

Infinite resource amount and storage

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

gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Infinite resource amount and storage

Post by gajop »

Is it possible to allow for a way to set metal/energy resources and/or their storage amount to infinity?
If it doesn't exist, can it be added? Something that would look like this:

Code: Select all

Spring.SetTeamResourceInfinite(number teamId, string res, boolean infinite)
Spring.SetTeamResourceStorageInfinite(number teamId, string res, boolean infinite)
Rationale: It would be useful for custom games where you don't want a resource (or it's storage) to be something that players should concern themselves with. The main difference between setting it to infinite and setting it to a large value is that widgets/gadgets can look better (no need to display unit cost of a resource that you have an infinite amount of, no need to display the current / max_storage bar if max_storage is infinite).
Other examples could be skirmish game examples, f.e building a "elibom muutepreP" building, you would have infinite energy while it 's not destroyed.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Infinite resource amount and storage

Post by smoth »

lua it.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Infinite resource amount and storage

Post by Beherith »

Superspeedmetal
/nocost
Or use lua
Or make a custom map or mutator .

This isn't really a feature request, since it is already easily implementable in many ways. If you want it in a specific game, post to their subforum.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Infinite resource amount and storage

Post by Jools »

Try:

Code: Select all

Spring.SetTeamResource (number teamID, string res, number amount)
, and use amount = 1/0 
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Infinite resource amount and storage

Post by knorke »

The main difference between setting it to infinite and setting it to a large value is that widgets/gadgets can look better (no need to display unit cost of a resource that you have an infinite amount of, no need to display the current / max_storage bar if max_storage is infinite).
Imo much better to decide such things on things other than if sotrage==inifinite

It is only really relevant if the wupdget is supposed to work with multiple games (eg when making a widget for kernel panic you know that displying metal cost is useless)
but even then you would not know how exactly to display ressources. (maybe res are used in yet another way than widget creator asumes)
If you make a widget for a game with infinite/no storage/whatever, you can decide to simply not display that information because you already know what the game is like.
no need to display unit cost of a resource that you have an infinite amount of
Can do that, tooltip of KP only shows buildtime (metal & energy are not used) and iirc in zeroK it only shows metalcost.
and use amount = 1/0
won't that just be "error: division by zero"?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Infinite resource amount and storage

Post by Jools »

and use amount = 1/0
won't that just be "error: division by zero"?
Yes, because lua can't handle the singularity or infinity.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Infinite resource amount and storage

Post by smoth »

Jools wrote:Try:

Code: Select all

Spring.SetTeamResource (number teamID, string res, number amount)
, and use amount = 1/0 
this code has amazing results...
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Infinite resource amount and storage

Post by Jools »

What is a singularity in the real plane may be a very explicable phenomenon on the complex plane. What the reason of the singularity is can be very case specific, but we will not see that until we look at the function on the complex plane.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Infinite resource amount and storage

Post by zwzsg »

Dividing by zero does not give a complex number, and Lua handle division by zero much more nicely than C.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Infinite resource amount and storage

Post by Jools »

No, but investigating the function in the complex plane can reveal what happens around the point where denominator becomes 0.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Infinite resource amount and storage

Post by zwzsg »

There's plenty of calculus to do with limits of functions without using the complex plane. You can use both at once if you fancy, but one won't help the other.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Infinite resource amount and storage

Post by Forboding Angel »

I still don't understand why divisions by zero don't just return 0 and be done with it. A little bit more friendly than causing the universe to spontaneously implode.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Infinite resource amount and storage

Post by knorke »

Forboding Angel wrote:I still don't understand why divisions by zero don't just return 0 and be done with it.
because trollmath!

a:b=c
:arrow:
a=b*c

100:20=5
:arrow:
100=20*5

100:0=0 (if this was to be)
:arrow:
100=0*0
wat
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Infinite resource amount and storage

Post by zwzsg »

Surreptitiously performing a division by zero is the usual way to prove anything.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Infinite resource amount and storage

Post by Forboding Angel »

Knorke, I know that it doesn't make sense mathematically. What I am saying is, returning 0 is a lot more friendly and helpful than OMGCRASHWORLDIMPLODE!
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Infinite resource amount and storage

Post by smoth »

Not true. Esp if it is a number you need the result of. things would be going all kinds of haywire.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Infinite resource amount and storage

Post by Jools »

Forboding Angel wrote:Knorke, I know that it doesn't make sense mathematically. What I am saying is, returning 0 is a lot more friendly and helpful than OMGCRASHWORLDIMPLODE!
Because dividing by 0 yields infinity and not 0. Dividing by infinity yields 0.

Edit: but we don't know whether the division by 0 yields +inf or -inf.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Infinite resource amount and storage

Post by Jools »

zwzsg wrote:There's plenty of calculus to do with limits of functions without using the complex plane. You can use both at once if you fancy, but one won't help the other.
If we take e.g. f(x) = 1/x. Then we have:

Code: Select all

f(0+), x->0 = inf, but
f(0-), x-> 0 = -inf.
So the limit provides no useful information.
User avatar
Karl
Panzerstahl Developer
Posts: 746
Joined: 01 Apr 2010, 21:05

Re: Infinite resource amount and storage

Post by Karl »

Why so complex?
Just give your self an unit that got ridiculously high amount of storage
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Infinite resource amount and storage

Post by gajop »

Notice: please read the entire post before posting an answer to this, and sorry it's so long! Also thread derailment

Why is this thing in Content Creation -> Games & Mods forum? I recall posting it in the Feature Requests, as it was and still is a genuine engine feature request.
I'm not satisfied with the proposed solutions as they all look hacky, and I don't think lua should be used just because you can, as it either unnecessary complicates the game or wrongly models (f.e unit with large amount of storage, large real value amount of storage) the desired effect (infinite storage in this example).

Now since the thread has already derailed, I'd like to whine about this and a couple of other things (such as the Invulnerable units thread, or changing Unit Defs runtime and changing players/teams runtime):

Even though you can normally work around some of these things, it is still a problem when you get to more complex things such as f.e scenario(mission) editors in which you'd like to allow users an easy way to edit stuff, and you don't want to annoy yourself by doing game restarts (for teams/players/unitdefs changes), or hacky things that may/may not work depending on the mod you are using (no idea if bullethits or economy changes would conflict with existing mod mechanics).

Also, the more of these core concepts that you have out of the engine, the harder it will be for new people to create content for Spring, and the harder it will be for AI creators to work with Spring - simply due to the lack of a proper, well known interface.

My current aim with Spring is twofold:
1. To assist in creation of non-skirmish games, such as f.e multiplayer competitive/cooperative games (think WC3: footmen frenzy, risk, tower defenses, hero arenas/sieges, etc.), as well as single/multi-player storytelling games with a (linear/non-linear) campaign. I believe in order to facilitate that we need to widen the range of people that can create that content (which they will most likely base on existing skirmish mods/games). I also believe this should be done by creating graphical tools (such as the existing ZK mission editor, but better), and I believe those tools should be built on top of the engine, since WYSIWYG tools ease the start for people familiar with the game they'd base their work on (which they probably played a lot and got their motivation from), but not with lua or the spring engine interface.

2. Create a good environment to develop AI in multiple languages, with the ability to easily test, compare and compete with other AIs. For this I'm working on springgrid, a site that allows people to queue AI games, create AI leagues and whatnot. I'd also like to see AIs that can solve scenario based games (and not just skirmish ones), which I think would be a great thing for AI research as well as AI gaming.

The problem I see with Lua is that it complicates creation of new content by independent developers. If someone were to implement some feature (such as f.e infinite storage or invulnerable units) in the engine, it would be easily used by any of the target groups: mod/game devs, AI devs (such a small community), widget devs (sorry! i believe they still exist), scenario devs (indirectly, by using a scenario editor), etc.
However, if someone were to do it in Lua, and say he were to also create an library-like interface, how would we be able to use it in our independent widgets/scenario editors/AIs - i.e how can we know of it's existence (programmatically).

The AI problem.
Sending messages to lua sucks, I want a clean interface (with doc) to work with.
F.e in a Java AI, how am I to know that a certain unit can be invulnerable (or any other Lua game/unit property)? I would probably need to have an additional library (an additional .jar) from that mod that supports the notion of invulnerability (and what happens if a scenario supports that concept while the mod on which it's based on does not? the creator of the scenario would need to supply it).
Now if we don't want those content developers to spend their time creating java libraries that expose the features they're using, we would most likely want some sort of a parser that would create an interface automagically (yes, that interface may send messages to lua all it wants, but that should be hidden from the developer). I'm worried that this is a hard problem, seeing as how we're still struggling to create basic (spring engine) AI interfaces for other non C++/Java languages.

The Scenario Editor problem.
So what extra stuff does your mod support? What can the users configure? What values does it take, etc.?
In the process of creating the Scenario Editor, I've reached a point where I'd like to allow users to configure/test properties, and based on that make some changes to the game/have some sort of notifications (f.e: if hp% of trigger unit < 50% send message "the base is under heavy fire!"). The problem is with the idea that I'd like to support all mods with this - which in theory should be possible since it's based on the same engine, however, while I could define properties such as this:

Code: Select all

		{
			humanName = "Unit HP%",
			name = "unitHP%",
			data = { "unit" },
			output = "number",			
		},
I have no idea how to do this for mod-specific properties outside of writing custom files for those mods that should hold those properties, (imagined) example:

Code: Select all

		{
			humanName = "Unit Neutrino Capacity",
			name = "unitNeutrinoCapacity",
			data = { "unit" },
			output = "number",			
		},
It gets more complex with infinite storage and other stuff that isn't just simply properties, but rather game options.
The problem boils down to the same thing like with the AI, can lua feature creators specify stuff that they created in a way that allows usage on the same level of quality like it would be with the official Spring engine documentation? And how can we expose that stuff in a pleasant manner to other (independent) devs?
Post Reply

Return to “Game Development”