How do I make a dynamic connection between multiple objects?

Get help using Construct 2

Post » Thu Apr 03, 2014 4:06 pm

Hello,

I would like to make a game that takes place on board a space ship, the primary objective would be to keep the ship in good repair through a series of various catastrophes , such as hull breeches, invades, etc. Now there are two issues I am wondering about, and I think they might be related in how they are implemented. I am hoping maybe someone could share some input!

The first issue is the issue of a power/electricity system. I want the ship to have a central engine that supplies the power to the ship. I want wires to connect the main engine battery to the various consoles, lights, and so forth throughout the ship. If a wire is disconnected, cut, destroyed, whatever, then power stops going to whatever the wire was hooked up to, which could be a console, or an entire room if the wire is far enough back towards the main engine battery. So how would I make it so I can check if there is a connection of good wires between the engine and the various equipment of the ship?

In a similar vein, I want to simulate hull breeches, which remove the oxygen from the room(s) effected. Basically, all rooms are encased with floors and walls, and the dark vacuum of space exists outside of the walls and under the floors across the entire layout. If there is a breech in the floor or in a wall that is adjacent to space, I would like for the oxygen to be removed from the room (each room is an 'area' and keeps track of whether or not it alone has oxygen). However, if the breech extends through multiple rooms, or if there is a breech in one room and a door open to the next, how would I make it so that the oxygen is removed from all breeched/opened rooms?

Any ideas/thoughts/tips/input would be greatly appreciated!
Thanks!
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Thu Apr 03, 2014 5:08 pm

I actually tried making a prototype game kind of similar to what you are speaking of. However i never finished it and left it in a very early state. So its more a test how it could be done, so it doesn't include everything that you are talking about. However i did make a sort of energy distribution system, even though it doesn't use wires. It more a "creep" like feature if you know the game series Creeper world i think its called? Anyway the idea was that you have a power generator that will generate power over time and distribute it through out the ship.

And the player should be in charge of a spaceship, kind of like the game faster than light, but mixed with a sort of minecraft elements, where each block should be part of the space craft, and as you say when a block gets destroyed, power, air etc should leave the spaceship.

Anyway i didn't get so far with it, and its quite some time since i did it, so im not 100% sure how much of it works. But i found it and you can try to check it out and see if maybe you can alter or get some ideas of how to at least do the power thing. So it match what you need, i would assume that you could do something similar just by making "Wire tiles" able to transport power.

You can build different things using the keys 1-4. And spawn some enemy by pressing Q. (Just have to enable the group in the enemy event sheet first)

However want to underline that its a very early prototype!!, but if you can use some i guess it doesn't matter :D
You do not have the required permissions to view the files attached to this post.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Thu Apr 03, 2014 7:26 pm

Hey nimos100, I appreciate it! I am going to check out that Capx as soon as I can! Hopefully it will give some ideas on how to implement these systems. Thank you very much for sharing! :)

If anyone else has any further input, ideas, suggestions, etc, they would be greatly welcomed!
Thanks!
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Fri Apr 04, 2014 3:43 pm

I checked out the demo, it was enlightening in some ways :) I think some sort of modification to what is going on there could work - sort of just figuring out how to detect if a wire is connected to a powersource and if so then set it to 'have power' and if a wire is connected to that wire, do the same thing, and so on and so forth.

Still not quite sure about the whole space/hull breech thing though. If someone could weight in on it, it would be appreciated! Thanks :)
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Fri Apr 04, 2014 4:07 pm

I checked out the demo, it was enlightening in some ways :) I think some sort of modification to what is going on there could work - sort of just figuring out how to detect if a wire is connected to a powersource and if so then set it to 'have power' and if a wire is connected to that wire, do the same thing, and so on and so forth.

Still not quite sure about the whole space/hull breech thing though. If someone could weight in on it, it would be appreciated! Thanks :)


I guess you could do the same with wires, if you add another tilemap on top of the floor tilemap, and then the player put down wires themselves and just use these to check for power. In my example, I believe I just used a distance check to spread it, so those closest to the power source got energy first. You could do the same, but just increase the speed at which its done.

The hull breach gave me some headache as well, but from what I recall, I think I had two ideas how to do it, one was to make a room tracker that would define rooms, and then just check each tile in the room to see if there was a floor or wall tile if not then there must be a breach. The other was that the player should define the rooms themselves and check it same way for breaches. However if any of them are very effective I don't know :D
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Fri Apr 04, 2014 4:48 pm

After looking at your demo and looking at some source code for the BYOND game Space Station 13, I think this might be doable for power: basically each tile will have the variable for power, not the wire per-se. Having a wire on the tile will allow for the tile to be 'powered', assuming the wire is connected to a power source, or another wire that is connected to a power source (just gotta run checks to see if there is a wire to an applicable power source constantly). Perhaps not the most efficient way of handling this, but it's something for now...
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Sat Apr 05, 2014 4:47 pm

Giving this a bump - would still love some input regarding potential atmospherics! Thanks :)
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Tue Apr 08, 2014 5:18 pm

Giving another bump - no ideas?
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Tue Apr 08, 2014 6:39 pm

It's basically a flood fill. For the wires start at the power source and then power all the connected wires, then loop over those wires and power what is connected to them and repeat. To address wires being cut you can set everything to be not powered before spreading the power from the source.

The hull breach can be done similarly, only the fill starts from outside the ship.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Thu Apr 10, 2014 6:07 pm

Im working on my dynamic dungeon creator (A lot harder than I thought :?) So even though its not exactly the same, I think it involve some of the same issues that you need as well.

It is still very early in the process, but what it does at the moment is creating varies rooms of different sizes on a grid. That part is probably not very useful for you, however during the creation it uses checks to make sure that rooms doesn't overlap and creates boundaries for each room, to make sure they doesn't merge during creation, and uses a roll back system that make sure that if a room during creation collide with another room, it will rollback the part of the room that is already created. And I guess you could use something similar in your game. To figure out air being sucked out of some rooms which are damaged, power going out and so on.

However don't think you would be able to use my exact design for it, but with certain changes I would assume it could handle such thing as well.

But you can check it out might give you some ideas to how you can make one that suits your needs.
You do not have the required permissions to view the files attached to this post.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Next

Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 10 guests