lolpaca's Forum Posts

  • (Never even occurred to use For loops like that... that's going to be incredibly helpful in this project <img src="smileys/smiley4.gif" border="0" align="middle" /> )

  • Perfect, thank you very much!

  • Hi there,

    I'm using an array to generate a map for my game and there's something I can't figure out how to do - simply, at least. My array is 150 cells (X) by 114 (Y), and at the start of my layout, I want to set all cells where X < 25, Y < 19, X > 125 and Y > 95 to 4.

    4 is the reference number I'm using for a 'rock' tile, so hopefully this will generate an enclosed play area with rock tiles all around the edges. Feel like it should be quite simple to do, but I've been playing around with various expressions and I can't seem to figure out how - could anyone please help?

  • Hey all,

    I have my layout and window size both set to 800x600, and the scale set to 2.0 (double zoom). The problem is the camera isn't following my player character (I have it set to Scroll to Player).

    Is this because the scale doesn't affect the camera, ie Construct thinks there's no need to move the camera because layout & window size are already aligned? If so, is my only solution to make the layout bigger and put the play area in the middle so the camera can scroll, or is there another way?

  • If anyone's interested, I figured it out in the end - capx below. Might be useful for anyone who's working on a roguelike-style game. Next step: corridors!

    dl.dropboxusercontent.com/u/106247621/ProcGenDungeon.capx

  • OK, I think I have a solution to this, but I'm not quite sure how to make it happen. Here comes the pseudocode:

    Make a second array ("RoomTest") with the same properties as "Map" and run the room-generating algorithm through that instead.

    Once room is drawn, test whether any 1s on "RoomTest" are also currently present at the same position on "Map"

    If not, transfer all 1s on "Roomtest" to the same position on "Map"

    If so, clear "Roomtest" and start the loop again. This should keep generating new rooms at new positions until a valid room is found.

    That's how I think it would work, but I'm not sure how to code it exactly... any help? <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I just put everything in groups, which certainly helps organise my mind when I'm working on a specific aspect of a project. I rarely use comments but I probably should :P

  • [Hi - posted this in another thread, but thought I'd throw it out to the group!]

    As you can see with the capx below, I'm auto-generating rooms of random length and width using just a single map array, but I can't figure out a way to stop them overlapping.

    I tried making a function to test if the cells at Map.PositionX and Y + Roomsize X and Y etc, were anything other than zero before the rooms were drawn, but that didn't seem to work - I'm quite new to arrays though so I probably got something wrong.

    Ideally, I'd like each room to be spaced at least one 'earth' tile apart (walls included) so I can then connect them with corridors. If anyone could please give me a hand with this, I'd be really grateful!

    dl.dropboxusercontent.com/u/106247621/ProcGenDungeon.capx

  • I'm still using arrays, so I might be coming at a slightly different angle to you, although I reckon it can be done more or less the same way with sprites.

    So, once you've spawned your doors, you somehow pick two doors to link together. Set the walls of your rooms to solids, spawn a sprite with pathfinding (diagonals off) at the first door and plot a path to the second, using a pseudo-movement for the sprite (stepping one tile at a time, but every tick so it's as fast as possible) to go from node to node in order, leaving behind a trail of corridors as it goes.

    Alternatively, you could use the stretch function to draw lines from one node to the next, then generate corridors on every tile where there's a line (come to think of it, that's probably a much quicker way to do it...) Repeating this for a bunch of doors should give you a nice network of corridors with lots of branching paths.

    If anyone would like to help a brother out, there's a .capx below showing what I've been working on tonight. As you can see, I'm auto-generating rooms of random length and width just using a single map array, but I can't figure out a way to stop them overlapping. I tried making a function to test if the cells at Map.PositionX and Y + Roomsize X and Y were anything other than zero, but that didn't seem to work - I'm quite new to arrays though so I probably got something wrong.

    Ideally, I'd like each room to be spaced at least one tile apart (walls included) so they can always be connected by corridors - if anyone can tell me how to do this, I'd be really grateful!

    dl.dropboxusercontent.com/u/106247621/ProcGenDungeon.capx

  • Yttermayn, thanks for taking the time to explain that. It sounds a little bit like a method I was looking at(flipping & rotating sprites, at least) before I got sidetracked with arrays and miners, which I also didn't get too far with because I'm a bit of a noob with those things.

    Your method sounds really interesting, that's a clever way of making sure everything ends up connected. I wonder I might be able to place the rooms randomly without the initial connections, then generate doors at random points of the walls of each room after they've been placed. Then use 4-directional pathfinding nodes (starting at one random door, ending at another) as 'miners' to dig out natural-looking corridors connecting them. The corridors should then naturally criss-cross and end up with some interesting level designs.

    I might not be describing it too well but I'll have a play around with that later - anyway, thanks a lot, you've given me a lot to think about! <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Yttermayn, would you mind telling me a bit about how you're randomly generating dungeons in C2? It's something I've been trying to figure out for a while now without much luck, and I'd love to know more! If you have any example .capx or anything that would be super <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Personally, I think the best way to make this happen is to keep it simple and informal. Make a main thread for the game jam on this board once you have enough participants (minimum of 5 sounds about right), then entrants can outline what they have planned, post the occasional update and finally link to what they've made at the end of the month.

    Anyone who's interested can then +1 the game they like most, and the most +1s after a week (or whatever) wins. No prizes or anything, just adoration and ego-stroking :)

    Anyway, I'd love to see something like this go ahead, and even become an ongoing monthly thing that people can dip in and out of. The Construct 2 Monthly Game Jam!

  • I agree that something like this would help to raise the profile of C2 - there's a lot of talent on these here boards and it'd be nice to see what we're capable of doing in a month. I don't see a problem with it being a community-run thing rather than 'official', I'm sure Ashley & co are busy enough as it is!

    Anyway I'd definitely be up for joining in with one of these, let me know if it goes ahead.

  • Here you go:

    dl.dropboxusercontent.com/u/106247621/LinearPathfinding.capx

    Also works fine with diagonals turned off.

  • Thanks Ashley, yeah turns out I was just being lazy <img src="smileys/smiley4.gif" border="0" align="middle" />... think I've got it worked out now.