GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

2D Minecraft type game? PLEASE REPLY

I know that there is already a post about this but i just rewrote this because no-one answers the other one. I was planning to make a LEGIT Minecraft game just 2D. Like terraria (a little less advanced) or Pixel Junk. But the thing is that i do not think is possible is the world generator, i mean that is going to be really hard to make. So please reply if that is possible and a method.

Comments

  • TheGabfatherTheGabfather Posts: 633Member
    What do you mean by "LEGIT?"

    0011 0010 0011 0010 0010 0000 0110 1101 0010 0000 0111 0011 0110 1001 0110 1110 0110 0111 0110 1100 0110 0101

  • marplumarplu Posts: 412Member, PRO
    edited November 2013
    I hope you do not mean copying art & music when you say legit...
    Anyways: You need to generate layers based on it's Y-position and need to add a semi-random generating rule (or rules) with probabilities added to them. For example: The probability of a dirt block in a layer above Y=64 (or whatever) is 90%, the probability for a stone is 5%, for iron it's 1% and so on. Then you create a lot of random rules to spawn these semi-random actors into the layer. The most important thing is to make the right amount of probability-rules; if random(0,100) is < or = to 90: spawn dirt; if random(0,100) is larger than 90 and smaller than 95 then spawn stone; and so on and so on. It's not that hard really, since you're not creating a 3D-terrain (but even then, it is not THAT difficult).
  • KevinCrossKevinCross London, UKPosts: 1,893Member
    edited November 2013
    In terms of speed issues GameSalad may not be the best tool for this, especially if you're thinking of spawning 1000's of squares/tiles to create a random world/scene. There's no quick way of spawning that many blocks. I'm only spawning about 80 blocks on the screen and there's a noticeable delay.

    I have found that the loop behaviour works almost twice as fast as the timer behaviour for looping but it's still too slow and needs fixing by the GameSalad team
  • marplumarplu Posts: 412Member, PRO
    The loop is extremely useful, and as you already said, really fast. In terms of speed issues, I would generate most of the world while first booting; this may take a minute but it would be convenient afterwards. Then, if you are 100 blocks away from a loading zone, the generator could create another 200 blocks, to make the world bigger and bigger without huge lags. That's just a theory, I haven't tried it yet.
  • KevinCrossKevinCross London, UKPosts: 1,893Member
    edited November 2013
    Just make sure you cover the whole screen when or a portion of it when you generate the grid because it looks rubbish watching blocks spawn 1 at a time.

    You could fill the screen with a 100 or so blocks and recycle them as you move around, this means you'll be using the same 100 or so blocks. I've got an endless scrolling grid of a 100+ tiles, and when it scrolls it fakes the appearance of a grid of any size
  • marplumarplu Posts: 412Member, PRO
    Yeah, that's why they should be generated when you're off-screen. Recycling them is actually a nice idea, for big biomes it could be very useful to randomly spawn/move a set of 100 tiles at a time!
  • SocksSocks London, UK.Posts: 12,822Member

    In terms of speed issues GameSalad may not be the best tool for this, especially if you're thinking of spawning 1000's of squares/tiles to create a random world/scene. There's no quick way of spawning that many blocks. I'm only spawning about 80 blocks on the screen and there's a noticeable delay.

    @KevinCross
    Have you tried any of the fast loop methods, with these you can spawn hundreds of actors very very quickly, using one of these methods 80 actors would appear pretty much instantaneously.
  • KevinCrossKevinCross London, UKPosts: 1,893Member
    Socks said:

    Have you tried any of the fast loop methods, with these you can spawn hundreds of actors very very quickly, using one of these methods 80 actors would appear pretty much instantaneously.

    I briefly looked at the fast loop post before and think I found quite a few dead links. I'll have another look.

    I'd prefer not to add a load of code to create a quick loop though, and certainly don't want to go the route I had to take for my jewel templates which required a loop for each row as that makes it hard to change the size of the grid anytime. Especially not when GS said it would be a quick fix for them to do, and something I was hoping would be fixed in the last two versions of the nightly builds
  • Fejuko GamesFejuko Games Posts: 6Member
    Ok thanks guys i will try looping, then spawning. Allthough i tested looping before i already know it's better then spawning, either way i will just test spawning.
    By "legit" i mean like not like that little Minecraft X time of thing
    I do not mean to copy art and sounds.
  • MantoManto Posts: 791Member
    edited November 2013
    I posted this to another thread too.

    http://www.youtube.com/watch?feature=player_embedded&v=58QQw_KjP2k

    It has 170 actors placed on the scene. World is generated to a table and the blocks load their values from it. Runs at 60 fps on iPad 2.

    I think performance-wise it's better not to spawn any actors. Just recycle them. When the blocks go outside the screen move them to the other side and load new values from a table.
Sign In or Register to comment.