Randomly Generated Worlds?

AppsterDudeAppsterDude Member Posts: 84
edited February 2012 in Working with GS (Mac)
Ok, i have a game were you walk around and all and the ground is grass/dirt blocks and i dont want to have to place each and every block out one by one beacause i want a random and big world so i was wondering if there was any way to make Randomly Generated Worlds that place random blocks in the ground like Dirt/Gravel/Stone and stuff?

Comments

  • AppsterDudeAppsterDude Member Posts: 84
    Anyone?
  • simo103simo103 Member, PRO Posts: 1,331
    Is there any reason your using small blocks for the ground? Is it a top down game or side-platformer?

    If top down why not make a few variations of a 1024x768 ground image by dropping the grass/dirt blocks in, then you would have fewer images to place (assuming that your blocks are small and not 1024x768 ... and/or you could work out when to move an out of scene image to a position that was coming into scene.
  • AppsterDudeAppsterDude Member Posts: 84
    the blocks are small because you can dig them up and go under ground and stuff in the game so if it was one big block and i made it "if touch is pressed" "destroy actor" then it would destroy the whole ground.
  • OskarDeveloperOskarDeveloper Member Posts: 533
    Lol u are trying to make a minecarft clone.. And plz use impolartate size for destroy its more awesome..
  • AppsterDudeAppsterDude Member Posts: 84
    Kinda :) Its called "Stan the Stickman"! Whats impolartate?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    The random genterated stuff is the easy part, its getting it to run on the device thats gonna be extremly difficult. If you want any sort of big world, its not gonna run on an iphone.

    But to randomly place blocks like that you can have a spawn actor. Give it a self attribute called spawn type.

    Then have every 0.1 seconds, then another timer in it for hwoever long you want, change the self position x and y to random, and change the attribute spawn type to random(1,4) change the 4 out for however many block types you have

    then you have another rule in the spawn actor when spawntype=1 spawn brick, when spawn type=2 spawn dirt, ect.
  • simo103simo103 Member, PRO Posts: 1,331
    @ryguy140 ... I'm assuming this is a side-scroller so you could try moving the blocks when they go off screen on one side .. to the other side just before they come on-screen perhaps using a change image and random function each time it moves so you get the effect you are looking for. I would also do that with the dug up actions rather than destroying them as I am concerned you may hit performance issues with a large scene and so many actors. I would start with just one line of blocks on the X axis and work out when you can trigger the first block out of scene to move to the end of the X axis line of blocks and see it you can get that to work first. Then look at random change image and copy down the rows of blocks because the x axis info will be teh same once you have figured it out. Hope that helps some?
  • AppsterDudeAppsterDude Member Posts: 84
    i don't want a "BIG" world i just want a randomly generated ground.
  • AppsterDudeAppsterDude Member Posts: 84
    the size i have right now is 10,00 by 320, is that to big?
  • simo103simo103 Member, PRO Posts: 1,331
    edited February 2012
    @ryguy140 .... 10,000 x 320 ... is not too big IF (big IF) what you are doing in that space is well designed and accommodates the capabilities of the device. I'm not quite getting if you will be wanting 1. an organized row and columns of ground blocks ... the type being random .... or 2. random positions of random blocks, some overlapping.
    If 1. organized rows and columns I think you can use my above suggestion of moving offscreen blocks. If 2 then that's going to be a lot of spawn and destroy that I believe will kill the device.
  • AppsterDudeAppsterDude Member Posts: 84
    organized
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    if the blocks are small, then 10,000 is too big. Say there 50x50, thats over 200 actors in one scene just for the ground alone.
  • old_kipperold_kipper Member Posts: 1,420
    edited February 2012
    With writable tables you could 'spew' the table full at the start of a level then move on screen blocks to cover the space the player was moving into while storing the old position state for the block if you had to move it back. If you don't mind 'no coming back' then your blocks could leapfrog ahead to a position off camera, and if they had all the states a block could be within them they could then be randomised to be whatever. Might be fun. If you knew the tricks some of the early game programmers got up to this would seem a total luxury. Things like switch a colour to turn a 8 pixel tree into someones legs...
  • AppsterDudeAppsterDude Member Posts: 84
    @old_kipper yea i have no idea how to use tables and make the blocks move to a position off screen so i guess I'm stuck...
  • AppsterDudeAppsterDude Member Posts: 84
    is there any way i can make an "Eraser" actor that covers up the ground and you can walk threw it to make it look like your underground? Maybe make it like a brown tint so it looks like a hole in a way?
Sign In or Register to comment.