Not logged inOpenClonk Forum
Up Topic Fixing and improving the power system

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Maikel
Currently I am attempting to improve the power system based on the current system and trying to address some flaws. It seems to be harder than I thought and it is messing up the master branch significantly. So I have moved my progress to a new branch which you can pull from my github.

Github power branch

The system will still be the same where all structures (either power producers, consumers and storage) within the same ownership area are connected, that is they form a network. Within this network all power is shared in one big pool and distributed among the consumers, according to priority. Moreover, which is new, the producers also have a priority such that for example a steam engine would not start delivering power when only a windmill is needed. I don't want to detail the full structure of the set-up here, since most of it can be found in the code of the libraries.

Test cases


To ease the testing I have set up a testing scenario which consists of a set of unit tests of the power system. These tests run automatically and tell the user at the end whether all tests succeeded, this can be useful as a unit test for the release. Currently these unit tests are rather simple and I have summarized them below. It would be helpful if some suggestions would be made for different tests.

Case 1: A steady power source (wind generator) supplying an on-demand consumer (workshop).
Case 2: An on-demand power source (steam engine) supplying a few on-demand power consumers (sawmill, armory).
Case 3: An on-demand power source (steam engine) supplying a few steady power consumers (pumps).
Case 4: A steady power source (wind generator) supplying a steady power consumer (pump), while an on-demand consumer (elevator) is turned on and should be prioritized.
Case 5: A steady power source (wind generator) supplying a steady power consumer (pump), while an on-demand consumer (double elevator) is turned on and should be prioritized.
Case 6: A steady power source (wind generator) connected to a power storage (compensator) which are both needed to supply a steady consumer (workshop).
Case 7: An on-demand power source (steam engine) whose over-production gets stored by power storage (compensators) which should provide a steady consumer (workshop).
Case 8: An on-demand producer (steam engine) as back-up for a steady producer (wind generator) with for steady consumers (pumps).
Case 9: An on-demand producer (steam engine) always provides power to an reduced on-demand consumer (wind mill).
Case 10: Network 1 (steady producer (wind generator) supplying steady consumers (pumps) connected to network 2 where steady producers (pumps) supply an on-demand consumer (sawmill).
Case 11: Two connected networks by different allied players with the elimination of one of the two players.
Case 12: No power need rule and no power need script functionality tested for a simple network.
Case 13: Flagpole which connects two networks is removed and created again to test network merging.
Case 14: Massive amount of power structures to test the performance of the power system.
Case 15: A supported (wind generator) infinite pump loop, with two pumps pumping in opposite directions.

 

List of Issues


* Power system stopped working in a save game (#1158).
* Battery does not work in corner case (#1103).
* Wind mill should only provide power for itself (#979).
* Give scripter an interface to give no power need to a structure and fix the no-power-need rule.
* Energy symbol visible through fog (#1229).
* Remove all the if (!link) checks, they are not needed in principle but errors arise when they are removed.
* Fix overproduction if a request is not met, e.g. compensator trying to supply a workshop alone (partially fixed).
* Implement network separation on hostility changes.
* Check savegames and multiplayer save games and player removal.

More reports on issues with the current power system or unexpected behavior are appreciated!

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill