Welcome to the captivating world of platformer level creation enhanced by the power of artificial intelligence!
Introduction
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
- Launch Unity and navigate to Window/Scenario.
- Open the necessary windows to generate images: Prompt Window and Prompt Images.
Step 2: Creating a Rectangular Grid and Drawing the Level Base
- In Unity, select GameObject > 2D Object > Tilemap from the top menu.
- With Tilemap selected, navigate to the "Tile Palette" window.
- Create a new palette in a rectangular format and name it.
- 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:
5. Sketch your level directly on the grid using the Tile Palette brush tool.
Step 3: Taking a Screenshot of the Grid for Reference
- Create a grid that can be divided into two square images.
- 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:
- Go to the Prompt Window (Windows/Scenario/Prompt Window) and select the img2img feature.
- Add the Reference Image.
- Under "ControlNet Options", activate "Enable ControlNet".
- In "Advanced Settings", choose the "Lines" mode, adjusting the slider to 1.0.
- Input the prompt: "cell shaded style, a platform game level, a rocky mountain", and set:
- Sampling Steps: 50
- Guidance: 9.0
- Influence: 0.70
Step 5: Image Enhancement Options
After generating the image, you're presented with valuable options:
-
Upscale Image: Magnify the image while retaining its quality.
-
Pixelate Image: Add a retro, pixelated look.
-
Remove Background: Create a transparent PNG.
Step 6: Applying the Generated Image to the Game:
-
Import the image into Unity's 'Assets' folder.
-
Align the image with your previously designed grid in the viewport.
-
Turn off the 'Tilemap Renderer' and introduce your character for gameplay testing.
-
Add the components 'Tilemap Collider 2D', 'Rigidbody', and 'Composite Collider 2D' to the Tilemap for smooth gameplay.
Conclusion:
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 Plugin for Unity Installation Guide