Creating Platformer Game Levels Using Scenario and Unity

Welcome to the captivating world of platformer level creation enhanced by the power of artificial intelligence!

Introduction

Untitled (34)Welcome to a comprehensive tutorial on creating platformer game levels using Scenario and Unity. This guide is designed to be clear and concise, suitable for enthusiasts, budding developers, and seasoned professionals alike.

Prerequisites

  • Ensure the Scenario plugin for Unity is installed.  Installation Guide
  • Authenticate with the Scenario platform to unlock all features and capabilities.

Step 1: Setting up Scenario Plugin in Unity

  1. Launch Unity and navigate to Window/Scenario.
  2. Open the necessary windows to generate images: Prompt Window and Prompt Images.

ezgif.com-optimize (10)

 

Step 2: Creating a Rectangular Grid and Drawing the Level Base

  1. In Unity, select GameObject > 2D Object > Tilemap from the top menu.
  2. With Tilemap selected, navigate to the "Tile Palette" window.
  3. Create a new palette in a rectangular format and name it.
  4. Import your tiles to the palette using the drag & drop feature.

This was the tile used to be the base of our platformer game stage:


tile1

 

5. Sketch your level directly on the grid using the Tile Palette brush tool.

ezgif.com-optimize (11)

Step 3: Taking a Screenshot of the Grid for Reference

  1. Create a grid that can be divided into two square images.

Untitled (35)

     2.   Take screenshots of each half in the viewport.

   - Windows: Use 'PrtScn' or 'Alt + PrtScn'. Use Paint to paste your capture or Shift+Windows+S to capture a screen area.

   - Mac: Use 'Command + Shift + 4' or 'Command + Shift + 3'. Adjust the Unity background to white for optimal results.



Step 4: Generating the Image:

  1. Go to the Prompt Window (Windows/Scenario/Prompt Window) and select the img2img feature.
  2. Add the Reference Image.
  3. Under "ControlNet Options", activate "Enable ControlNet".
  4. In "Advanced Settings", choose the "Lines" mode, adjusting the slider to 1.0.
  5. Input the prompt: "cell shaded style, a platform game level, a rocky mountain", and set:
    • Sampling Steps: 50
    • Guidance: 9.0
    • Influence: 0.70

ezgif.com-optimize (12)

Step 5: Image Enhancement Options

After generating the image, you're presented with valuable options:

  1. Upscale Image: Magnify the image while retaining its quality.ezgif.com-optimize (14)

  2. Pixelate Image: Add a retro, pixelated look.ezgif.com-video-to-gif (18)

  3. Remove Background: Create a transparent PNG.ezgif.com-optimize (13)

Step 6: Applying the Generated Image to the Game:

  1. Import the image into Unity's 'Assets' folder.

  2. Align the image with your previously designed grid in the viewport.

  3. Turn off the 'Tilemap Renderer' and introduce your character for gameplay testing.ezgif.com-optimize (15)

  4. Add the components 'Tilemap Collider 2D', 'Rigidbody', and 'Composite Collider 2D' to the Tilemap for smooth gameplay.Untitled (36)

Conclusion:

ezgif.com-resize (3) (1)

Congratulations! You've successfully integrated the power of AI with Unity to create a platformer game level. This guide is a stepping stone to developing dynamic, engaging worlds that captivate players. Continue to explore, learn, and innovate!

Additional Resources

- Scenario Knowledge Center

- Scenario Plugin for Unity Installation Guide