Randomly Generated World

0 favourites
  • 14 posts
From the Asset Store
A procedurally generated infinite runner in 3D for Construct 3!
  • is there a way to have a world randomly generated when the game starts, and then to keep that world and its info around (yes a save game)? The way I imagine my game is in a manner not that unsimilar to Civilization, a scrolling flat world.

    Also can I use construct to port the game from HTML5 to say C++ easily?

  • You could use something like:

    floor(random(1,4) to generate a number that would relate to your world.

    For example, If you called your worlds:

    world1

    world2

    world3

    world4

    You could do this to capture the name of the world:

    "world" & floor(random(1,4))

    The result would be something like world1, world2, world3, world4. You can then concatenate that to a URL like this:

    http://localhost/" & object.property

    If you were to stuff the value in a text box, you could do something like this using the Browser object:

    Go to "http://localhost" & Text.Text in a new window("NewWindow")

    The result of the above would be something like this:

    localhost/world2

    Just make sure you have a corresponding directory on your server. In this case, a directory called world2 with the index file in there.

    You would need a way to fire that event, for example a button. It cold be anything. Even a portal or something.

    In terms of storing the variables, you could use an Array object.

  • So what you're saying is that I have to have world's premade and can set some events so that a specific world spawns when specific variables are chosen? At like a load up screen?

  • So what you're saying is that I have to have world's premade and can set some events so that a specific world spawns when specific variables are chosen? At like a load up screen?

    This is one way of doing it and yes a premade world. Unless you've got some crazy algorithm that will automatically create your worlds on-the-fly, which would be pretty cool.

    The load up screen could be where the random event gets fired.

  • OK Shoot. I was hoping someone had already figured out some kind of crazy algorithm to create a random world ;)

    I guess for now I will stick with premade worlds.

    I have plans to eventually move this over to a C++ coded game to make it a bit more inclusive because I have this really great idea that I think would sell well. but I think for the indev stage I will keep it as an HTML5 game.

  • In full disclosure, I am by no means an expert with Construct 2, I just finished the tutorial a couple of hours ago. So someone out there may have created an random level generator or something.

  • Well I will mess with it when I don't have to devide my attention between the game and class!

    Thanks for the help though, I think that premade worlds would be easiest for now. I can set up a menu system where each variable sets up a chain of events and a map is created in the end.

  • is there a way to have a world randomly generated when the game starts

    Your generating events will have to be in the "Start of layout" event of the "world layout".

    and then to keep that world and its info around (yes a save game)?

    You could have used webstorage, but the plugin is broken/not up to date apparently.

    One solution might be to export your datas to a website, but this might be too complicated for a beginner.

    The way I imagine my game is in a manner not that unsimilar to Civilization, a scrolling flat world.

    Tiles, right ?

    Have a square sprite containing your textures in a single animation.

    Create instances of this sprite, covering your layout.

    You can use the random function to set which animation frame to display.

    Check the capx

    Also can I use construct to port the game from HTML5 to say C++ easily?

    I doubt it.

    HTML5 is based on Javascript. Your project is done as xml/JS. There's no "easy" way to convert to C++ as those languages has nothing to see one with the other.

    In this case, use Construct-Classic which exports .exe. (but still you won't obtain C++ sources).

    In the end, if you want to use C++ than you are defeating Construct's purpose, so I'd suggest you to make sure of what you really want to do and documentate yourself about what JS and C++ really are.

    Anyway, for you and Genghis, I'd suggest starting with easier projects (to get used to C2), and reading some more tutorials/practicing more with C2/CC.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alright that is incredibly helpful. I just found this tutorial on here about making the tile sprites show up randomly everytime so OI am going to follow that. Otherwise, I think what I want to do is eventually have it so that you can use this without a web browser, in a .exe format (though I would settle for Java if it was easier). And I can't seem to find a good development studio for it (Unity is too complicated for what I want to do at this point). I just want to know if there is an easy way to bring a game which was created in Construct and convert it to say C++ or Java or something.

  • I just want to know if there is an easy way to bring a game which was created in Construct and convert it to say C++ or Java or something.

    No.

    Construct-Classic will export to exe. Construct2 will export to HTML5 (for now).

    That's all.

    If you want to use C++, you'll have to program the whole thing in C++.

    If you want to use java, you'll have to program the whole thing in java.

  • Bummer. Well thank you for your help.

  • While there are algorithms and plugins in Construct Classic that allow for randomized world creation, I am not sure if Construct 2 has any such capabilities yet.

  • While there are algorithms and plugins in Construct Classic that allow for randomized world creation, I am not sure if Construct 2 has any such capabilities yet.

    If CC's algorithms (event sheet) doesn't rely on custom plugin, than it is fully usable in C2 (and probably could be done cleaner codewise).

    And if indeed, methods rely on custom plugins than it would be required to have a port of the plugin to C2 first.

    Anyway, check page 1 I provided the first steps of a solution.

  • Sorry to bump an old topic, but I wanted to know how I could make some modifications to this tile generation example.

    For one, I already figured how to get it to spawn a giant map of one tile type randomly.

    Next step, how do I get it to spawn each tile type in semi-random connected chunks/group, akin to a biome or zone?

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