Page 1 of 1

Custom resource types

Posted: 09 Aug 2014, 04:44
by CliffracerX
I'm wondering if it's possible to add custom resource types, so instead of metal/energy, you'd have wood/stone/metal/food or something like that.

Is this possible without loads of fancy LUA or modding the Spring source? :?

Re: Custom resource types

Posted: 09 Aug 2014, 09:46
by LordMuffe
its possible, but fancy luaing is required

Re: Custom resource types

Posted: 09 Aug 2014, 09:58
by Silentwings
All you need here is a small-ish amount of lua. I don't have the gadgets to hand but others have already done this and it would likely not be difficult for you to re-use their code.

Re: Custom resource types

Posted: 09 Aug 2014, 17:30
by CliffracerX
Silentwings wrote:All you need here is a small-ish amount of lua. I don't have the gadgets to hand but others have already done this and it would likely not be difficult for you to re-use their code.
If you can point me in the direction of someone who's figured this out, I would be grateful!

Re: Custom resource types

Posted: 09 Aug 2014, 18:44
by smoth
Or you could do the work yourself and look at the already existing projects. There are only so many projects that exist in this engine.

You will need custom one made because you want more than one resource and you want it HARVESTED/based on farms or whatever. There are are a lot of assumptions in your post. Most spring projects use the same style resource system. That is resources/time. You can only want a warcraft-like resource system, which means harvesting and a custom resource system.

You don't really need a true 3 resource system as food could just be a number stored in lua-land.

I am not volunteering to do your grunt work but you are more than welcome to go through my svn and see all the code for a custom lua resource system. It is just 1 gadget and i fixed most of the bugs over the years.

The reason you are getting a response like "yep, you can" is because we are not interested in investing a bunch of time in a project that you may never even get off the ground! So we tell you, hey you can and it isn't THAT hard. So you know and can start on all the other easier but time consuming tasks. So get started on those, or ask the next question but don't expect anyone to drop everything and deliver you functioning code for a game project that has not even left the design phase in your own mind.

Re: Custom resource types

Posted: 09 Aug 2014, 19:00
by CliffracerX
smoth wrote:Or you could do the work yourself and look at the already existing projects. There are only so many projects that exist in this engine.

You will need custom one made because you want more than one resource and you want it HARVESTED/based on farms or whatever. There are are a lot of assumptions in your post. Most spring projects use the same style resource system. That is resources/time. You can only want a warcraft-like resource system, which means harvesting and a custom resource system.

You don't really need a true 3 resource system as food could just be a number stored in lua-land.

I am not volunteering to do your grunt work but you are more than welcome to go through my svn and see all the code for a custom lua resource system. It is just 1 gadget and i fixed most of the bugs over the years.

The reason you are getting a response like "yep, you can" is because we are not interested in investing a bunch of time in a project that you may never even get off the ground! So we tell you, hey you can and it isn't THAT hard. So you know and can start on all the other easier but time consuming tasks. So get started on those, or ask the next question but don't expect anyone to drop everything and deliver you functioning code for a game project that has not even left the design phase in your own mind.
I don't expect it to get off the ground, I just kind of mess around and make things sometimes. :P

I'm not asking for someone to drop in and build a whole project for me, just a little example of how to add other resources, I can probably do everything else myself. Thanks for the advice! (Is there a kudos/+1/thanks system on these forums?)

Re: Custom resource types

Posted: 09 Aug 2014, 19:11
by smoth
Lol if there was a karma system I would probably be -9001 by now.

http://springrts.com/phpbb/viewtopic.php?f=9&t=28265

this thread has a link to my project(taking a break from spring before I commit to making my tech part of an actual game). The resource system was around for years and has been tested pretty heavily in the past.

RTSCore.sdd\LuaRules\gadgets\GreenBean_resources.locals.lua It has a lot of bad things, hard coded names and the like but it should help to give you an understanding. It also does NOT support nano-assist, nano-reclaim etc because those are features I never wanted in my game.

Good luck have fun, if you have any question about any of it feel free to start a thread here in game dev for any questions about specific gadgets or widgets. Know that not all this code is polished and well documented.