Any way to give a CRPL core ore?

Started by Nicant, October 25, 2015, 01:00:19 PM

Previous topic - Next topic

Nicant

I have a question. Is there any way at all to have oremines produce ore and send it directly to a CRPL core? I am trying to make a refinery unit that doubles the production of ore. Thanks for anyone you could help as much as they could!
CW4 hype!!

driesemol

Can't find a unit constant for that one... i'm not that experienced, but i'm good at finding things in the CRPL reference sheet. I think it isn't available because it would interfere with the command nodes.

Not saying it isn't there just because i can't find it, but i think it is very unlikely.
If somebody can fix this, be my guest :)

Nicant

Quote from: driesemol on October 25, 2015, 07:06:23 PM
Can't find a unit constant for that one... i'm not that experienced, but i'm good at finding things in the CRPL reference sheet. I think it isn't available because it would interfere with the command nodes.

Not saying it isn't there just because i can't find it, but i think it is very unlikely.
If somebody can fix this, be my guest :)
Thanks for trying! i knew there was not a constant for it but i thought it would be possible in some other way!
CW4 hype!!

warren

You would have to go as far as to make fake packets to make that work. You can send AC to crpl cores.

Nicant

Quote from: warren on October 26, 2015, 02:11:36 AM
You would have to go as far as to make fake packets to make that work. You can send AC to crpl cores.
Really, i have to make fake packets? Well then IT SHALL BE DONE! in my next map  :P  :P  :P
CW4 hype!!

RrR

you could create an ore crystal(s) and siphon(s) immediately below the  CN. Lots of small crystals would be depleted before creeper could destroy the siphon. only a problem is someone tries to move and replace the CN

Nicant

Quote from: RrR on October 26, 2015, 02:33:44 PM
you could create an ore crystal(s) and siphon(s) immediately below the  CN. Lots of small crystals would be depleted before creeper could destroy the siphon. only a problem is someone tries to move and replace the CN
Thanks, but i want to try to have minimum problems, so i want to try making fake packets. If that fails, then ill do what you said.  ;D
CW4 hype!!

warren

Fake packets is really hard. I did however realize there is another way to do this. Put a guppy that accepts ore under another tower. One problem, if there are any other guppies that accept ore or a commandnode that accepts ore on the same network, they may steal packets. If you do want to create fake packets, you will probably want to replace any built oremine with a custom CRPL core.

Asbestos

Has anyone ever actually used fake packets in a map before? I don't think it's been done yet.

Nicant

Quote from: Asbestos on October 28, 2015, 06:53:07 PM
Has anyone ever actually used fake packets in a map before? I don't think it's been done yet.
Not sure, but i'll try! (Should be fairly easy as i can just make it find collectors and see if they are in range if not then destory) If it works out, then it will go into my map that i'm currently working on! Here's a link of the map that i'm working on btw https://knucklecracker.com/forums/index.php?topic=19490.0
CW4 hype!!

Hubs

It shouldn't be too hard if you've done pathfinding work before. Just get the coordinates of all network objects that connect, then determine which ones are connected. I would use Dijkstra's algorithm or something similar for pathfinding, then just move the packet through the shortest path determined each frame. The packet core mechanics are alot more advanced than this, but you should be able to implement a fairly simple way do to this without a ton of overhead.

Nicant

Quote from: Hubs on November 03, 2015, 02:55:00 PM
It shouldn't be too hard if you've done pathfinding work before. Just get the coordinates of all network objects that connect, then determine which ones are connected. I would use Dijkstra's algorithm or something similar for pathfinding, then just move the packet through the shortest path determined each frame. The packet core mechanics are alot more advanced than this, but you should be able to implement a fairly simple way do to this without a ton of overhead.
Working on it, kinda tricky actually, is there a way just to find the "power line" that connects to collectors and stuff? If there is a way then this will be much easier.
CW4 hype!!

Nicant

#12
Actually, I'm not doing the fake ore packet idea as it is beyond my ability to code it in crpl. (I big noob in crpl) Sorry.  :( Someone else could probably do it though.
CW4 hype!!

Hubs

Quote from: Nicant on November 07, 2015, 09:47:05 PM
Quote from: Hubs on November 03, 2015, 02:55:00 PM
It shouldn't be too hard if you've done pathfinding work before. Just get the coordinates of all network objects that connect, then determine which ones are connected. I would use Dijkstra's algorithm or something similar for pathfinding, then just move the packet through the shortest path determined each frame. The packet core mechanics are alot more advanced than this, but you should be able to implement a fairly simple way do to this without a ton of overhead.
Working on it, kinda tricky actually, is there a way just to find the "power line" that connects to collectors and stuff? If there is a way then this will be much easier.

This can be done by getting all units on the maps, then cycling through them to find the collectors and relays (nodes). Then from each node, look at each other node to get the distance. If a collector is within 10 units of a collector or relay, they're connected. If a relay is within 20 units or another relay they're connected. So make a list of the connected objects. I think the original PAC map done by stewbasic did something like this to only try to rebuild units near the network, so you (or someone willing to try this) can reference that.

Dijkstra's algorithm is what's used to find the shortest path in a network. You can use it to find the path from the CN to a particular node in the network the most optimal way. And for the double speed packets moving between relays, you would just treat the distance as half of actual. The algorithm is pretty efficient. In a network with 40 nodes, it should only take about 100 iterations of a loop to find the shortest distance to all nodes, so you could have it run only with nodes are added/removed from the network (instead of running every time a packet needs to be sent).

Nicant

#14
Quote from: Hubs on November 09, 2015, 09:44:35 AM
Quote from: Nicant on November 07, 2015, 09:47:05 PM
Quote from: Hubs on November 03, 2015, 02:55:00 PM
It shouldn't be too hard if you've done pathfinding work before. Just get the coordinates of all network objects that connect, then determine which ones are connected. I would use Dijkstra's algorithm or something similar for pathfinding, then just move the packet through the shortest path determined each frame. The packet core mechanics are alot more advanced than this, but you should be able to implement a fairly simple way do to this without a ton of overhead.
Working on it, kinda tricky actually, is there a way just to find the "power line" that connects to collectors and stuff? If there is a way then this will be much easier.

This can be done by getting all units on the maps, then cycling through them to find the collectors and relays (nodes). Then from each node, look at each other node to get the distance. If a collector is within 10 units of a collector or relay, they're connected. If a relay is within 20 units or another relay they're connected. So make a list of the connected objects. I think the original PAC map done by stewbasic did something like this to only try to rebuild units near the network, so you (or someone willing to try this) can reference that.

Dijkstra's algorithm is what's used to find the shortest path in a network. You can use it to find the path from the CN to a particular node in the network the most optimal way. And for the double speed packets moving between relays, you would just treat the distance as half of actual. The algorithm is pretty efficient. In a network with 40 nodes, it should only take about 100 iterations of a loop to find the shortest distance to all nodes, so you could have it run only with nodes are added/removed from the network (instead of running every time a packet needs to be sent).
I'll give it one more try. I guess. The only problem i ran into was the packet checking if there was a wire it could cross.
Edit: Actually i don't need it to check if there is a wire, after reading what you said more clearly i understand what you mean. So It shall be done as i said before!  :)
CW4 hype!!