Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Color Based Level Generator

Discussion in 'Made With Unity' started by mathiassoeholm, Nov 14, 2010.

  1. mathiassoeholm

    mathiassoeholm

    Joined:
    Jul 20, 2010
    Posts:
    104
    THIS IS RELEASED HERE:
    http://forum.unity3d.com/threads/69192-FREE-Color-Based-Level-Generator-Release

    Hi there

    I'm working on a level generator, which reads every pixel color from an image and generate Gameobjects based on each color.
    This could be used for a lot of games such as:

    - Pacman and other maze games
    - Breakout
    - Top down shooters
    - Puzzle games
    ...

    You make an image in Photoshop or anything similar, it have to be 8x8, 16x16, 32x32 and so on ...
    You can assign each color to instantiate different gameobjects, as an example you could have colors representing enemies, the player and walls.
    Level design is suddenley a lot easier.

    Here's a video that demonstrates with breakout:


    This is still WIP, but i will give it for free when done..
    If you got any ideas, for use, features anything please tell me. C&C is appreciated :)
     
    Last edited: Dec 1, 2010
  2. windexglow

    windexglow

    Joined:
    Jun 18, 2010
    Posts:
    378
    This could be a fun party game - series of minigames players compete against each other with, while another set of minigames decide which image is used for each minigame.
     
  3. Darkhazard

    Darkhazard

    Joined:
    Oct 4, 2010
    Posts:
    105
    Oh wow! That is freaking awesome!

    Can't wait to get my hands on that!
     
  4. mathiassoeholm

    mathiassoeholm

    Joined:
    Jul 20, 2010
    Posts:
    104
    Thanks :)

    Here's a Pacman example:

    Image used:


    To generate:
     
  5. LamentConfig

    LamentConfig

    Joined:
    Sep 28, 2010
    Posts:
    292
    That is a really great idea :)
     
  6. adriaanza

    adriaanza

    Joined:
    Jun 24, 2010
    Posts:
    41
    Yeah, good idea for allowing players to create custom maps. Can either use Flash or Unity itself to make a mini paint program, much like how you did in Photoshop, and then save that image out to your server.

    Easy to then store different levels as bitmap images, and then generate the levels (gameobjects) client side by just loading up an image.
     
  7. mathiassoeholm

    mathiassoeholm

    Joined:
    Jul 20, 2010
    Posts:
    104
    I'll see if i get the time to make a tool for the purpose, also when releasing it I will bundle some example games like Pacman and Breakout.

    Thanks for the replies :)
     
  8. melmonkey

    melmonkey

    Joined:
    Mar 31, 2009
    Posts:
    373
    Looking forward to this. Great work so far.
     
  9. mathiassoeholm

    mathiassoeholm

    Joined:
    Jul 20, 2010
    Posts:
    104
    Here's how the inspector would look like for a Pacman level:



    if a pixel color is blue, it will instantiate the wall prefab.
    If "Is Pixel Color" is set to true, the gameobjects color will have the color of the pixel.
     
  10. theBrandonWu

    theBrandonWu

    Joined:
    Sep 3, 2009
    Posts:
    244
    This is really cool. Great job!
     
  11. melmonkey

    melmonkey

    Joined:
    Mar 31, 2009
    Posts:
    373
  12. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    This looks like a pretty decent bit of code you've cooked up. Thinking about making a 3D pacman game? ;)
     
  13. mathiassoeholm

    mathiassoeholm

    Joined:
    Jul 20, 2010
    Posts:
    104
    It's not much code i know, but that's not what counts.
    I'm not making a Pacman game, but if anyone is, they now got something to generate the levels :)
     
  14. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    Well, the thing about this code, is that it's in practice not different from heightmap technology, or even the way unity stores tree and foliage data. You've just taken it a step further.

    It also seems flexible enough, that you could, say, assign a color for game-objects such as mission objectives, enemies, ally NPCs, etc. Just as long as the colors can be discerned by eye, you're good.
     
  15. melmonkey

    melmonkey

    Joined:
    Mar 31, 2009
    Posts:
    373