How do I make a dynamic connection between multiple objects?

0 favourites
  • 13 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • 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!

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

  • 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

  • [quote:1hzx6t3z]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

  • 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...

  • Giving this a bump - would still love some input regarding potential atmospherics! Thanks

  • Giving another bump - no ideas?

  • 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.

  • 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.

  • There is a lot of really great stuff in these examples. I thank you both tremendously! Thank you guys very much. You rock!

  • So I expanded my dungeon generator so now it can build a whole dungeon....most of the times

    Anyway I made it so it will connect doors in such way, that it will never leave rooms unreachable, and thought you could make benefit from something similar in your game regarding maybe how your repair ideas are working. So if something in one room breaks and is connected to something in another room, that machine could break as well or whatever, so the player would have several things to look out for and maybe in some cases start some nasty chain reactions, fires breaking out in other rooms and so on. Think that could make some intense situations

    In my case its the doors or actually the tile(s) next to them that works as connectors and gets connected using path finding. So you could see the doors as outlets, and the corridors as connections(Wires) to whatever they are connected to.

    https://dl.dropboxusercontent.com/u/109921357/Dungeon_generator_Alpha/index.html

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)