Add mod support for alternate energy sources.

Ideas and suggestions for how to improve the Warzone 2100 base game only. Ideas for mods go in Mapping/Modding instead. Read sticky posts first!
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Add mod support for alternate energy sources.

Post by Shadow Wolf TJC »

While such things as alternate energy sources (such as uranium-fueled nuclear reactors, or solar/wind-powered generators that generate power without requiring any resources) may have been proposed before, and while it MIGHT not have been accepted in the general game, I'd still like to see mod support enabled for this in the near-future. I'm willing to work on implementing this myself IF I knew how to perform the necessary coding to achieve this. (If I could do this, then I'd probably want to work on implementing some of the features that are currently on the to-do list as well, such as designable defenses, being able to build in the water (so that naval units could be produced), spectator mode, and bridges to name a few.)
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Add mod support for alternate energy sources.

Post by Iluvalar »

there is that advancedPowerFun() in my NRS mod that manage :
1- Power producing building
2- Power producting units
3- Interest rate.
4- power producting lab.
5- Banking system
6- Command relay giving power reading for everyone

it's only 100 line long, so you should manage to undertand it i guess, just open rules.slo in my mod :)
Heretic 2.3 improver and proud of it.
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland

Re: Add mod support for alternate energy sources.

Post by Emdek »

Shadow Wolf TJC, well, why not.
For me it was strange in the campaign that there were some power related technologies which after researching real world would require complete redoing of generators, and those didn't required any work at all (except for power module available since very early mission anyway).
Also, in one we actually destroy nuclear reactor and got some power artifact too (probably something vapor related, well, technically it is related for both nuclear reactors and oil fueled ones).
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: Add mod support for alternate energy sources.

Post by Shadow Wolf TJC »

@Iluvalar: I see that you use setPowerLevel(playerPower(playnum) + some additional value) in order to add extra power. However, I've since switched to using version 3.1 as a base, and that uses Javascript instead. While there does seem to be a setPower() event, it doesn't seem to work at all when it's triggered during a custom event, which should've been called by setTimer().
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: Add mod support for alternate energy sources.

Post by aubergine »

the JS equivalent is playerPower() and setPower() functions: https://warzone.atlassian.net/wiki/display/jsapi/API <-- everything documented there (although some still with just basic docs currently)
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: Add mod support for alternate energy sources.

Post by Shadow Wolf TJC »

@aubergine: I already tried to use scripts like setPower(playerPower(playnum) + <some additional value>), and scripts like setTimer("<Name of Power Adding function>",100), but still, no dice. I did notice, on the top of the setPower() page, that it said, and I quote, "Don't use in multiplayer games. Bad things will happen." :(
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: Add mod support for alternate energy sources.

Post by aubergine »

Yup - in MP games unexpected power increases will be seen as cheating and thus rejected (or possibly even kick player). There is currently no way to alter power in MP games as far as I know. It might be that the currently exposed functions only really work in campaigns :s
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: Add mod support for alternate energy sources.

Post by Shadow Wolf TJC »

So, if, say, Iluvalar was willing to port NRS to 3.1, then he'd be unable to implement his banking system because of this?

Edit: If this is true, then I may have to port my mod back to version 2.3.9 in order to be able to develop such things as resource-independent power plants, which is something that I don't want to do given all the new things in 3.1 :annoyed: This is why I'd like to request the addition of mod support for being able to develop new means of generating additional power during multiplayer/skirmish matches.

For starters, I'd like to request the addition of an extra variable for structures that are defined as "Power Generators", in functions.txt: a RequiresDerricks variable. By default, this would be set to YES for regular Power Generators (in that case, they would still generate power equal to its base power-generation value times the amount of Derricks "assigned" to it), but if set to NO (as would likely be the case with a solar or wind-powered generator), then Derricks would not be assigned to them, while they would generate power equal to their base power generation value.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: Add mod support for alternate energy sources.

Post by aubergine »

One of the devs is prolly best suited to answer that, I only really know stuff from the perspective of someone writing an AI using the JS API.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
zany
Trained
Trained
Posts: 303
Joined: 20 Sep 2011, 07:04

Re: Add mod support for alternate energy sources.

Post by zany »

Shadow Wolf TJC wrote:So, if, say, Iluvalar was willing to port NRS to 3.1, then he'd be unable to implement his banking system because of this?

Edit: If this is true, then I may have to port my mod back to version 2.3.9 in order to be able to develop such things as resource-independent power plants, which is something that I don't want to do given all the new things in 3.1 :annoyed: This is why I'd like to request the addition of mod support for being able to develop new means of generating additional power during multiplayer/skirmish matches.

For starters, I'd like to request the addition of an extra variable for structures that are defined as "Power Generators", in functions.txt: a RequiresDerricks variable. By default, this would be set to YES for regular Power Generators (in that case, they would still generate power equal to its base power-generation value times the amount of Derricks "assigned" to it), but if set to NO (as would likely be the case with a solar or wind-powered generator), then Derricks would not be assigned to them, while they would generate power equal to their base power generation value.
what would the point of solar and wind be? so you don't have to hunt for oil spots?
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: Add mod support for alternate energy sources.

Post by aubergine »

Mmm, imagine if we could get a day/night mode in to the 3D engine - so at night the solar panels would stop working and droid headlights would get turned on, etc... Then add in random wind patterns (but really basic, it would ignore terrain, otherwise game would grind) so that not only could wind power be affected but also VTOLs could get blown off course...
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Add mod support for alternate energy sources.

Post by Iluvalar »

zany wrote: what would the point of solar and wind be? so you don't have to hunt for oil spots?
No, the players still at all cost capture the derricks because -you remember?- the oil derricks and pgen price is way under the "balanced" point.

However, the power producing buildings will have an higher price much more close to the research progression rate. which can be uniform in a mod. So the power producing buildings have an efficiency close to a power research upgrade.
Heretic 2.3 improver and proud of it.
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: Add mod support for alternate energy sources.

Post by Shadow Wolf TJC »

zany wrote:what would the point of solar and wind be? so you don't have to hunt for oil spots?
Have you ever played an rts game where there existed alternate resource-collection means (such as the Supply Drop, Hackers, and Black Market from Command & Conquer: Generals, or the Mass Fabricators from Supreme Commander) in addition to the traditional resource-gathering means (like the Tiberium/Ore Harvesters from the Command & Conquer series, or the Mineral/Vespene Gas collecting SCVs, Drones, and Probes from the Starcraft series), or the traditional resource-node-constructing means (such as Warzone 2100's very own Oil Derricks)? Basically, like these, they would be there in case no other resource nodes or fields could be accessed, though they'd ideally be far less efficient at generating new resources than the more traditional methods.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100