Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[MMF2] Terrain Generation Help


Recommended Posts

Hey all.

So I'm making an infinite runner game and its going along pretty well. But I've hit an issue with the terrain generation that has just driven me into a brick wall. I've been trying to get it to work the way I want for the past week now with no luck.

The way how it currently works is by randomly creating platforms from one green square. It does this REALLY well but the problem is that its nearly impossible to apply any kind of graphics to it or make it more diverse with different platform types.

So I've been trying to re-write it to work more like how Canabalt makes its stuff (which I have no idea on a technical level). So what I want is instead of generating from one object and making only one kind of platform, I want to make it generate a bunch of different platforms, like buildings, cranes, etc.

here's a pic of the generation code so far:

fpqy.png

I've been trying to look up similar programs to look at their code to maybe get an idea for how to go about this (since one of the best ways to learn code is look at a LOT of code) but I've had no luck. If anyone knows something like this that I can take a look at or has an idea for how to go about this I would be srsly grateful.

Link to comment
Share on other sites

Here's how I would go about this in Java.

For each different platform you want to make, you need a different object for it, and then you'd code out a chooser for the world generation. So say you got Platform and SpecialPlatform. SpecialPlatform is a group of action platforms that you would create. FallingPlatform, RisingPlatform, etc.

"Platform" would be the platform you have now, stable and regular.

"Falling Platform" would start to crumble and fall after the player stands on it for X amount of time.

"RisingPlatform" would do the opposite of the FallingPlatform.

Now the main chooser would choose between generating a Platform and a SpecialPlatform. Now, to pick which Special Platform that would generate, you need another chooser that picks between the RisingPlatform and FallingPlatfrom.

You don't want all the Platforms under one chooser because then you would have a possibility of all the Platforms being one type. If you have 2 choosers, you can limit how many SpecialPlatforms generate.

Link to comment
Share on other sites

So let me see if I understand you.

So I'd have two groups of platforms with their own group associated events that can only be activated by a randomizer that chooses between the two groups everytime it needs to spawn a new platform and once its chosen the platform, it spawns that platform in accordance with the rules specified for platform spawining randomization?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...