Roguelike map System untiled

0 favourites
  • 15 posts
From the Asset Store
A simple Map Editor that where you can edit a map with restriction or totally. You can save and load the map created.
  • Hey guys, what's up?

    I was wondering. Latelly I've been studying Game Design and the possibility of creating interesting mechanics. I've came to the realization that games are more interesting when they have either (or both) Customization and Randomic maps. Makes players think their tale in that little world is unique. I'm Okay with the movement mechanics, shoting, bombs and everything else. Although I must say one thing really troubles me.

    How would a rogue map generator work in C2? (Not tiled, I mean.)

    Say I have 300 layers, each of them with one template of map with enemies, chests, obstacles, etc. [The items out of the chests would be chosen by a random number generating event that triggers once you open it (with a key) and drop out a pre-defined "pack" of items.] Once you reach a door you'd get send to the map "below" (would acord to the minimap), meaning on the start of each floor the program would have to create a simple logic to put together adjacent maps (layers) so that the door A leads to B and B leads back to A in a chain of many other rooms.

    This is what I'm using as a reference (If you've ever played Binding of Isaac, it's become one of my favorite games)

    So, could someone that understands more of programming than me enlighten me about this system inside the Construct2 Event system logic ? :{

  • Bump for help please ? :{ I don't need the final thought, sugestions would already help alot, I'm just stuck and I can't think of anything else than templates of maps in diferent layers that connect eachother through door events...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That is an interesting idea. Get a map generator going first. Each room only needs to know in what direction the doors are. For simplicity the doors could always be at the same locations. Then have it pick a random designed room with the same exits.

    Instead of having each designed room on a separate layer, put them on a separate layout, it makes it a bit simpler for designing. In my example the first thing the game does is run each room layout and save each objects position and size into a global array per room. I did this so that I can pick at runtime a room according to the directions of it's exits.

    I didn't do this in my example but having the room data stored in an array makes it easy to implement loading/unloading of rooms all in the same layout, so you can have massive layouts and not have to worry about high object counts bogging down the framerate.

    Here is an implementation of my ideas:

    https://www.dropbox.com/s/h0biq6u3d1e3e ... .capx?dl=1

    /examples11/rooms2.capx

    The bare minimum amount of rooms is 15, I used 30 so that each possible room has 2 variations.

  • I use a simple random generator for my room maps that literally generates an array that represents the tiles int he room. This doesn't have to be limited to tiles necessarily as random generation isn't overly complicated.

    Your chest example would be something like Chest Clicked -> Rand Number 1-10 -> Load Array(#) value. If you have a sprite labeled reward with an animation strip (but no actual animation set) then you can use that instead of an array and reference the frame with the reward. If the chest is supposed to carry multiple objects just throw in another thing to randomly determine how many rewards from 1 to chest max size. So if the chest holds 4 things max the player will have the chance of opening it and getting 1-4 items from a pack of 1-# of frames. After that the tricky part is simply determining what those are exactly.

    This is just a suggestion as I'm new to C2 still (bout a week) and I haven't toyed with how the sprite frames work when multiple instances are loaded etc, but I imagine it would produce something like what you want. It would be ideal if you could get the particular instances current frame (again this can be there) and reference it to a dictionary that holds the identities of the particular item in that frame.

  • Ive done mine in a tiered generator.

    I start on the left side of the map then randomly gen a new space either right up or down and continue til I hit the edge of the layout or run outta rooms to add (a global I set on start)

    Then I have a basic shape for the level. Then I loop thru the rooms and check for rooms around it and use that to determine the bounds of the level (open space inside completely surrounded by walls).

    Then I loop thru each room AGAIN and based on what kinda room it became in the last step I replace it with a random room designed to fit in that section (if its a top left corner its replaced with a room with walls on the top and left)

    After thats done Ive basically created a random level MAP. Its not playable cause its just graphics of how the level looks. Then I use the rooms everything got assigned in the last step to actual generate playable rooms.

    It sounds overly complex but it makes it finely tuned to control exactly how I generate the finished level.

    I made this room editor to help me make the rooms I want and get the layout of the objects to be used to make the playable areas.

    anb.mooo.com/layouteditor

    I use the screenshot of it to make my visual layout (the objects the player collides with arent visible) and the string it generates to create the objects when that rooms generated.

    The project Im usin it for is a platformer with 160 different rooms it uses to generate the levels

  • -Snip-

    My browser was being retarded.

  • R0J0hound

    Hey, sorry to bump this old thread but I've been looking into map generation and I loved your code, it does exactly what I want. I've been studying it so I can update it to use tilemaps instead of saving every wall to an array, but some parts got me really confused, like this one:

    <img src="http://i.imgur.com/eXQXBib.png" border="0" />

    How are you adding booleans like that?? D:

    Also thanks for the help!

  • Do you mean why? It's just packing the four booleans into one number using one bit per boolean. I could have just as well packed each boolean to each decimal place like this:

    roominfo.exitE+10*roominfo.exitS+100*roominfo.exitW+1000*roominfo.exitN

    The idea was to use one variable comparison instead of four. Look in "Event sheet 1" events 5-11 for it's use.

  • R0J0hound

    Yeah, I meant why, sorry.

    It's just so hard to get my head around that, I understood most of your code but this part...

    I get how you're generating the map though;

    1. Event sheet "load rooms" is called, new array is created, saves every wall and each exit;

    2. Map is generated on "Event Sheet 1" and based on that generation, you get rooms based on the exits it has (random door that has the same number of exits of the square on the map you already generated).

    I understand now that you can use booleans as 0 or 1, I had no idea.. but still, let's say that we have a room with 4 doors. That picture I posted would give a result of:

    roominfo.exitE+2*roominfo.exitS+4*roominfo.exitW+8*roominfo.exitN

    1+2*1+4*1+8*1 ?

    If you add and multiply it like that how can you still know which exits exist in which room?

    Sorry if that's simple, I'm not a very good programmer haha!

  • It's just a unique number for each combination of doors. There are 16 combinations and with the formula you'll get a value from 0 to 15 depending on the exits.

    The only thing that matters with this is the same value will be calculated for rooms with the same exits. Which exits doesn't matter as long as they're the same.

  • R0J0hound

    Oh wow, I see it now. All this math is too much for me lol.

    Thanks!

  • R0J0hound Hi! I really like your code, and I was wondering if there was a way for it to generate a map, but it always includes a certain room in the map (a room that takes you to the next map/generates a new one).

  • R0J0hound hi how can i create different sizes room in this demo?thank a lot.

    like this,the A,C,D,F,G=1*room size,B=3*room sizes,E=4*room sizes

    B B C

    A B D

    E E F

    E E G

    I tried a number of ways ,but have many issue.

    thank a lot.

  • InvaderX

    I guess this is a very late reply, but you could pick a random map sprite and create stairs on that.

    corpvs2

    I don't think I fully understand, but this was designed to have each room be the same size (one screen). It make it able to do different size or even L shaped rooms would be a lot harder, and probably require a new approach.

  • thank you R0J0hound,i will try to make it.

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