Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Generate noise for random levels?

Author
Message
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 25th Dec 2012 03:43
Hello and Merry Christmas.

I've spent the last hours creating a noise generating function that I thought I might be able to use as a random level generator for a scorched earth type game.

What I've got now is a function that generates a two-dimensional array with perlin noise type values and creating sprites with color values based on this noise creates a noisy picture as expected.

But I'm not sure how I should proceed to create a level with this information. How can I assign a nice image to each pixel in my array? Does anybody have any suggestions on how to proceed?
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 28th Dec 2012 02:55 Edited at: 28th Dec 2012 02:59
Not entirly sure what you mean, but is this somthing like what you want?


This will array a set of sprites size 10x10, over a screen size of 100x100

There are 10 types of people, those who understand binary and those who don't
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 28th Dec 2012 17:39 Edited at: 28th Dec 2012 17:40
There are a few ways, and there are problems with each. I kinda tried this but put it on the shelf (see link) but I might pick it up later. For now I'll share my view on how to do this, which is just my uneducated opinion

Link to similar level creation: http://forum.thegamecreators.com/?m=forum_view&t=201869&b=48

So, one issue is having that many sprites on a screen and accessing each one in a "for loop" each frame of the game, I don't know what resoluton you were thinking of but the smallest sprite I did with the above example was 4x4 pixels, under that even my pc slowed down not to mention a phone.

Methods using box2d
One way is to make each sprite in your level a physical static sprite, quite unimaginable with pixel sized tiles.

Another way is to each frame (or when a change is done, i.e an explosion) loop through your existing level sprites and check which one are "surface" tiles and setting those to static physical sprites.

Not using box2d well then you still have the issue of having a great big loop to check the status of all your tiles.

Once the memblock commands are in (are they? haven't checked in a few weeks) you can have your map drawn on a bitmap and check each pixel for maybe color to decide if they are ground or air.

Food for thought perhaps. I'd love to see some ideas to solve the issues I myself found when doing this type of level.

My hovercraft is full of eels

Login to post a reply

Server time is: 2024-11-24 06:46:33
Your offset time is: 2024-11-24 06:46:33