Hi guys. I am trying to get my head around how to make a power grid system like the game 'Mewnbase'.

0 favourites
  • 9 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • So my thoughts are to use a tilemap to create the level and put the tiles ID to an equal size array.

    The two will be linked to each other, so if I do changes to the array the tilemap will be updated and verse visa.

    So I want to make a power grid in the game to be able to power up torrents and so on, like in 'Mewnbase'.

    Video link to the game:


    Before I ask a whole lot of questions..

    Is there any tutorial or topic that already has been discussed this? I have been searching like hell but did not found any.

    Cheers mates. :-)

  • Well, a simplified version would be to not use individual tiles as power grid and just connect them in some other way (maybe distance?)

    If you want to use tiles, you might wanna take a look at recursive functions to determine if something is connected to the grid. This can get quite tricky, but iirc there is an example project in construct that showcases a recursive function.

  • The power grid system appears to be using variables and maths. Each generator object adds X amount of power, while other objects use X amount of power. Then you compare 2 totals, generated and used. If it's using more power than you are generating then it begins to deduct an amount from the battery.

  • Using distance could surely solve the problem, but I am hooked on the idea of using arrays as I want to master it.

    I was thinking that if I was to place a TileAt(curX /curY) - I would also have to check TileAT(curX-1,curY) / TileAT(curX+1,curY) / TileAT(curX,curY-1) / TileAT(curX,curY+1).

    If any comes up true, I would have to make a check on any if they are themselves connected true/false, and if they are powered true/false?

    Am I being too simple here?

  • Sure plinkie. That is the next logical step of course. But thanks. :-)

  • I'm not familiar with using tilemaps in that way but I imagine if you are tracking the cell in an array, then the status is going to have to be also tracked as I'm not sure how else you would check if a tile was both a generator and switched on/off. As the game becomes more complex it seems like it would be difficult to handle as you are putting what would be the entire game into an array. My approach would be to use sprite objects with instance variables, and they add to a global variable for power.

  • hmm, yes. It seems way easier that way. But I am keen on learning arrays. But yes i probably have to run each cell in the array every time i place a new tile.

  • It is possible to do this with tilemap and array but you'll have to track everything in an array and know what you're doing. If you are making a player and storage inventory similar to that game then that will use an array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I came to the same conclusion. Well i will give it a good try to figure it out then.

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