-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Live" power system implementation #602
Comments
I think I prefer the "live" power system as I could be expanded on more easily later on. |
We could also take the advantage to make the system more generic then just power. It could be any stream requirement. For instance RAM or CPU usage. Some computer are producer of CPU power, some machine use it, etc.. |
I think the "live" solution could be more realistic: imagine a nuclear reactor that produces (x) Watt per hour, or a dam with an hydroelectric turbine. We could assume that the power they produce is constant through time, so we can average an amount of power available each second and apply the same approach to power-consumers. The power in excess could be stored in a backup battery (in case the generators are damaged). |
I was thinking to have this pattern for all furniture. It just should have |
@Grenkin1988 do we have to differntiate this? Why cant we just use a |
@Xeni91 My last comment was not about power. It was just thoughts about generic solution. Some objects could produce multiple things, and consume multiple things |
So like a generic resource system? We could have (say) IProducer and IConsumer interfaces which classes implement as needed. A consumer could then register a callback with a producer, or a producer manager class, saying that it wants to know any time a new unit of resource X is produced... Then the internal logic of the callbacks can be very simple. The trickiest thing would be to keep connections up to date as objects are built/destroyed. Is this the sort of thing you are thinking of? |
@mikejbrown Some kind of. But let's focus on power system right now :-) Producer/Consumer pattern is topic for another issue. Should I create one? |
@sboigelot I like the concept of a generic "stream" to/from resource consumers/producers. I also like the idea of it being "live". Unlike base Rimworld, I think it would be nice if things only consumed power while performing their task. This could lead to surges in demand, making batteries (and/or capacitors) very important parts of the network. |
It's possible that all consumers -- but really "spiky" ones in particular, like lasers -- should probably act as their own capacitor/battery. They will "consume" up to X power to charge their battery, but then stop consuming from the network while their battery is full. |
@quill18 definitely like needing power only when working & having a real need for batteries... but only as long as you don't have Rimworld's zzzzt event! :) |
For now most people is for "live' power system. But more feedback is needed. We should also remember that somebody going to implement Utility System - Pipes, Power Conduits, Air Ducts and so on |
@quill18 @sboigelot I opened another issue to discuss this #604 |
As with most I would agree that switching to a live system would probably be a good next stage for the power system. 👍 And yeah it will definitely need to keep that future Utility system in mind so it will be easier to put them together later. |
If nobody against I am going to do some prototyping for this. For "live" system with possibility for improvements with connections |
@quill18 I love the idea of batteries and capacitors. I think that they could provide a fun game mechanic. Like perhaps batteries should be good for storing power (i.e. store large amounts of charge for long periods of time) but bad for providing power (i.e. charge/discharge slowly or else they take some type of 'damage'). Capacitors on the other hand change and discharge very quickly (making them great for high power activities like laser weapons) but gradually lose charge over time, making them bad for storage. Maybe in a space fight between ships, being able to fire laser cannons more quickly depends on how many capacitors you can keep charged? Perhaps it's too early for this type of discussion, but I think it has potential. |
#761 More to be added soon |
After reading the code in #793 I realized that The new job system I'm working on is in a namespace |
@vogonistic All my new code is in PowerSystem folder. But I think there is no such thing as namespase in Unity? But I definitely could go for |
Unity has namespaces and it works fine in my tests. https://docs.unity3d.com/540/Documentation/Manual/Namespaces.html |
@Grenkin1988 You just need to put the classes in a namespace and you have a namespace. Unity doesn't care. |
Next iteration ready for review #968 |
New live power system is in place and all existing |
Added fully operating accumulator with placeholder image #1079 |
Next would be save/load but I would prefer to wait with it before we finished or data format discussion. P.S.: just interesting does anyone read my updates :-) |
I read everything :) |
Where is this on the save/load logic? This is currently assigned to v0.1. Are you close or do you want to bump the last step to v0.2? If you want to wait for the data format to settle it might be best to bump it in case it changes for v0.2. |
Alternately if anyone wants to claim "Implement save/load logic for system" please do so here and submit your own PR. |
Okay, bumping this. |
@mikejbrown neither @TheRiven or @Grenkin1988 have branches on their repos so I assume that any work that is not already merged into master is non-existent or is being implemented by someone else. as said by @Grenkin1988 he held of on saving b/c of the data format discussion |
what is meant by save/load here.. only current statuses of accumulators? If yes, then it should be covered by #1520 |
now that #1520 is merged, this can be closed, I guess.. unless there is still something missing... |
Closing as this seems to be addressed. |
Power system discussion
Currently, initially developed by @TheRiven , we have “static” power system:
Power level = sum of power generators – sum of power consumers.
It is already possible to change power level of objects on fly representing not operating objects.
But we need to solve issue () when generators are refueling. Right now generator stops working and all things that need power also. This could be solved by refueling generator earlier that it has absolute zero.
Another solution is to have “live” power system:
This looks a little bit more realistic but this would involve implementation of this produce/consume logic.
We need to decide what we what now. Later this would be very difficult to change. Lets discuss this and find out all drawbacks of both types.
@quill18 just to make sure quill is involved in core discussion :-)
As decided, implementation of “Live” power system is going on.
New power system is in place
Connection
is used to represent thatFurniture
has connection to power system.System
can contain multipleGrid
.In the future logic for new Grid generation depending on wires could be added.
In XML – new tag:
<PowerConnection inputRate="" outputRate="5" capacity=""/>
inputRate
– power consumptionoutputRate
– power productioncapacity
– maximum accumulated powerImplementation iterations:
The text was updated successfully, but these errors were encountered: