| Power system discussion | |
|
+3Danice123 The Schmetterling fr0stbyte124 7 posters |
|
Author | Message |
---|
Buggy1997123 DEV
Posts : 394 Join date : 2011-10-18 Location : Somewhere, somewhen.
| Subject: Re: Power system discussion Tue Jan 17, 2012 7:16 pm | |
| - tonyri wrote:
- You could put a bottleneck in your wiring design to save power, like I did in Industrialcraft.
Wait, what? | |
|
| |
Apokalypse Newbie
Posts : 33 Join date : 2011-12-21
| Subject: Re: Power system discussion Tue Jan 17, 2012 8:07 pm | |
| I think the sending of packets (emulating ic2) would be the easiest to solve regarding loss since machines could call the power they need from the generator per tick. then you wouldnt have to be an electrical engineer to operate this mod. it would just be a mattter of simple math (needed power=total machine rate+loss). that way you could set up your generators accordingly and efficiently. | |
|
| |
ectrimble20 DEV
Posts : 441 Join date : 2011-11-07
| Subject: Re: Power system discussion Tue Jan 17, 2012 9:08 pm | |
| - Buggy1997123 wrote:
- tonyri wrote:
- You could put a bottleneck in your wiring design to save power, like I did in Industrialcraft.
Wait, what? I think he's talking about in game application, not 100% sure, but we're discussing (by we're I mean frost and dan) the technical and programmatic details of how the system needs to function. - Apokalypse wrote:
- I think the sending of packets (emulating ic2) would be the easiest to solve regarding loss since machines could call the power they need from the generator per tick. then you wouldnt have to be an electrical engineer to operate this mod. it would just be a mattter of simple math (needed power=total machine rate+loss). that way you could set up your generators accordingly and efficiently.
I believe they were planning on starting with a 'You have X amount' kind of system where the ultimate forumla is 'Energy Available - Energy Used = Extra Energy or Energy Shortfall'. Sending packets (I assume you mean packets of power and not data packets) would work on a per-tick basis calculation. Not sure what Dan or Frost will ultimately settle on though. ***300 posts*** I win! | |
|
| |
fr0stbyte124 Super Developrator
Posts : 1835 Join date : 2011-10-13
| Subject: Re: Power system discussion Tue Jan 17, 2012 9:25 pm | |
| I never liked the packet strategy. Just look at its implementation in IC2. You are limited in how much energy you can send in a single packet but you can send an infinite number of them at a time. And then there's the problem of trying to figure out how much current is running through a line. I would prefer modifying the rate of flow to devices rather than doing a song and dance to get a specific number of energy units from A to B. | |
|
| |
Danice123 DEV
Posts : 607 Join date : 2012-01-06 Age : 30 Location : The Dankins
| Subject: Re: Power system discussion Thu Jan 19, 2012 5:13 pm | |
| So what is the best way to check the number of instances of a block within a hashmap? From what I can see, I can't check the number of unique entries from the hashmap itself, so should I convert it to a collection and run an iterator through it? Or is there a better way? | |
|
| |
fr0stbyte124 Super Developrator
Posts : 1835 Join date : 2011-10-13
| Subject: Re: Power system discussion Thu Jan 19, 2012 7:07 pm | |
| - Danice123 wrote:
- So what is the best way to check the number of instances of a block within a hashmap? From what I can see, I can't check the number of unique entries from the hashmap itself, so should I convert it to a collection and run an iterator through it? Or is there a better way?
The best way is to just keep tally as you go. What do you want it for? | |
|
| |
Danice123 DEV
Posts : 607 Join date : 2012-01-06 Age : 30 Location : The Dankins
| Subject: Re: Power system discussion Thu Jan 19, 2012 8:11 pm | |
| Here's how I have rewrote the system. I have a list of hashmaps, which are created when a piece of wire is placed with no wire around it. the hashmap contains the positions as the keys and the block object as the value. When a piece of wire is placed next to another, it finds the hashmap that the other wire is within from the list and then adds itself and any machines near it to. When a new hashmap is created or added to it adds up all the inputs of the hashmap network, then subtracts the outputs (its simple now, but there is the ability for adding priority for what gets shutdown first and things like that). hashmaps are removed from the list when the last piece of wire is removed.
What do you think? | |
|
| |
ectrimble20 DEV
Posts : 441 Join date : 2011-11-07
| Subject: Re: Power system discussion Thu Jan 19, 2012 8:21 pm | |
| - Danice123 wrote:
- Here's how I have rewrote the system. I have a list of hashmaps, which are created when a piece of wire is placed with no wire around it. the hashmap contains the positions as the keys and the block object as the value. When a piece of wire is placed next to another, it finds the hashmap that the other wire is within from the list and then adds itself and any machines near it to. When a new hashmap is created or added to it adds up all the inputs of the hashmap network, then subtracts the outputs (its simple now, but there is the ability for adding priority for what gets shutdown first and things like that). hashmaps are removed from the list when the last piece of wire is removed.
What do you think? As a fan of hashmaps, I think that will work. I'd probably do it the same way as most stuff I program I try to keep track of it with hashmaps, they're just so much better at keeping track of stuff than an array (an unassociated array that is, since all a hash really is, is an associated array ) | |
|
| |
Danice123 DEV
Posts : 607 Join date : 2012-01-06 Age : 30 Location : The Dankins
| Subject: Re: Power system discussion Thu Jan 19, 2012 9:04 pm | |
| Does anyone know how to either return the key if given a value for a hashmap? Or how to return the x y and z of a block if given the object? | |
|
| |
fr0stbyte124 Super Developrator
Posts : 1835 Join date : 2011-10-13
| Subject: Re: Power system discussion Thu Jan 19, 2012 10:12 pm | |
| Hashmaps aren't designed to work like that. O(1) access using the key, O(N) with high overhead when iterating through. I assume this is to keep track of all the devices. I suggest making a separate container just for them. | |
|
| |
Danice123 DEV
Posts : 607 Join date : 2012-01-06 Age : 30 Location : The Dankins
| Subject: Re: Power system discussion Thu Jan 19, 2012 10:17 pm | |
| I figured that hashmaps wouldn't, but I don't understand how hard it is to find the coords when you have the block object. Its gotta be there somewhere... | |
|
| |
fr0stbyte124 Super Developrator
Posts : 1835 Join date : 2011-10-13
| Subject: Re: Power system discussion Thu Jan 19, 2012 10:42 pm | |
| Oh, if that's all you need, the position should be stored in the tileentity data. If you already have the block, you can generate the key...though I suspect things might be getting overcomplicated again. | |
|
| |
Danice123 DEV
Posts : 607 Join date : 2012-01-06 Age : 30 Location : The Dankins
| Subject: Re: Power system discussion Thu Jan 19, 2012 11:01 pm | |
| Yeah... Maybe. Unfortunately I tend to make things go that way. | |
|
| |
ectrimble20 DEV
Posts : 441 Join date : 2011-11-07
| Subject: Re: Power system discussion Fri Jan 20, 2012 2:45 am | |
| Just some insight into hashmaps. They're awesome cool fun times and all, but if I recall correctly, you need the key to access the value, so if you're trying to access the key... you have to do as Frost said and iterate the map. like: - Code:
-
Map<String, String> map = new HashMap<String, String>(); map.put("super_power", "OVER9000");
map.get("super_power"); // returns "OVER9000"
You have to... I think toss them into a set using the entrySet or maybe it was ketSet method... actually you know what, I can't remember how to pull the key, I'll have to google it sometime and see if I can't recall how to do it. For now, I'd follow Frost's advice lol. | |
|
| |
Sponsored content
| Subject: Re: Power system discussion | |
| |
|
| |
| Power system discussion | |
|