KAUSHIK SARKARBlogs
Game Prompts

Shadow Realm: Echoes of Valor - A Dark Fantasy Role Playing Game game with Dynamic Lighting Effects

By Kaushik Sarkar · · 10 min read
Hero screenshot of the finished Role Playing Game game

This tutorial shows you how to build a classic role playing game using AI tools. The idea comes from .NET Console Games' project that inspired this prompt. You'll create a polished browser-based RPG with modern UI, smooth animations, keyboard and touch controls, sound toggles, and persistent score tracking. Using tools like ChatGPT, Claude, Gemini, Cursor, Lovable, Bolt, or v0, you'll generate the full game in one HTML file that runs directly in any modern browser. This guide covers everything from initial setup to deployment.

What you need

  • A modern web browser (Chrome, Firefox, Edge)
  • An AI coding assistant like ChatGPT, Claude, or Cursor
  • Text editor for reviewing and tweaking code
  • Basic understanding of HTML, CSS, and JavaScript
  • A GitHub account for deployment (optional but recommended)
  • Optional: Sound files for audio effects

The full prompt

Build Shadow Realm: Echoes of Valor - A classic role playing game in a single HTML file using HTML5 Canvas and JavaScript

Tech Stack: Single index.html file with embedded CSS and JavaScript, HTML5 Canvas for rendering, keyboard and touch controls, localStorage for score persistence

- Player character with smooth movement animation, health bar display, and level progression system
- Enemy AI with pathfinding, collision detection, and varied attack patterns
- Inventory system with item collection, equipment management, and stat bonuses
- Turn-based combat mechanics with visual attack animations and damage effects
- Dynamic lighting effects and particle systems for magical spells and environmental elements
- Progressive difficulty curve with increasing enemy strength and spawn rates
- Complete sound system with music toggle, SFX for actions, and ambient background audio
- Score tracking with high score persistence using localStorage and game over screen
- Keyboard controls (WASD/arrow keys) with touch controls for mobile devices
- Character progression system with experience points, level ups, and skill trees
- Multiple game states: menu, playing, paused, game over, and victory screens
- Responsive design that works on desktop, tablet, and mobile browsers
- Accessibility features including keyboard navigation, screen reader support, and colorblind modes
- Data persistence for player progress, high scores, and settings across sessions

Visual Design: Dark fantasy theme with deep blues, purples, and gold accents. Clean sans-serif typography with large readable text. Centered game canvas with intuitive UI panels. Smooth animations for character movement, combat effects, and menu transitions. Consistent pixel art style with modern rendering techniques.

Controls: WASD or arrow keys for movement, mouse click for attack, spacebar to pause, enter to confirm selections. Touch controls include virtual joystick and action buttons for mobile play.

Data Handling: Player state stored in localStorage, game progress saved between sessions, high scores maintained across restarts, settings persistence for sound toggle and difficulty.

Responsive Requirements: Adapts to different screen sizes with scalable UI elements, touch-friendly controls, and optimized performance on all devices. Accessibility compliance with proper semantic HTML structure.

Output: Single index.html file containing complete game functionality with embedded CSS, JavaScript, and assets. Run by opening the file directly in any modern browser. No external dependencies or build steps required.

1Choose an AI Tool and Paste the Prompt

Start by selecting one of the AI coding tools mentioned in the prompt. Tools like ChatGPT, Claude, Gemini, Cursor, Lovable, Bolt, or v0 work well for this task.

Open your chosen tool and paste the full prompt exactly as it appears on this page into the input field. The prompt includes all necessary details:

Build Shadow Realm: Echoes of Valor - A classic role playing game in a single HTML file using HTML5 Canvas and JavaScript

Wait for the AI to generate the code output. Make sure you're pasting the full prompt from this page, not any variation or summary.

After generating, review the output to ensure it matches your requirements.

AI coding assistant generating the Role Playing Game game code
AI coding assistant generating the Role Playing Game game code

Pro tip: Always paste the exact prompt from our site into your AI tool to avoid deviations in functionality.

2Review and Save the Generated Code

Once you get the output, carefully check that it follows all requirements from the prompt above. It should include:

  • A single index.html file with embedded CSS and JavaScript
  • HTML5 Canvas rendering for gameplay
  • Keyboard and touch controls
  • localStorage for high scores and settings persistence

Save this code into a new file named index.html. Ensure no external dependencies or build steps are required.

If the output is missing features, like inventory or sound toggle, use follow-up prompts to correct them.

Open the file in your browser to test basic functionality before moving forward. The game should load and show at least a player character with movement controls.

Pro tip: Use a text editor that highlights syntax errors to catch issues early.

3Run the Game Locally

Open your saved index.html file directly in a browser. The game should load with:

  • Player character on screen
  • Controls for movement (WASD or arrow keys)
  • Basic UI elements like health bar or score display

If you see errors, check the browser console for JavaScript issues.

Test basic controls:

  • Move player using WASD or arrow keys
  • Click to attack enemies
  • Press spacebar to pause
  • Press enter to confirm selections

Verify that the game state transitions work correctly between menu, playing, paused, and game over screens.

Pro tip: Use DevTools in Chrome or Firefox to debug any rendering or control issues.

4Test Core Gameplay Features

Focus on the core mechanics of the RPG:

  • Player movement with smooth animation
  • Enemy AI with pathfinding and attacks
  • Turn-based combat system with visual effects
  • Health and level progression systems
  • Inventory collection and equipment management

Ensure enemies spawn and move toward player. Check that attacks cause damage and show visual feedback.

Test the following:

  • Sound toggle works (music/sfx)
  • High score is saved in localStorage
  • Pause/resume functionality
  • Game over screen appears when health reaches zero

If any feature is missing, proceed to fix it with follow-up prompts.

Role Playing Game game main gameplay view with HUD
Role Playing Game game main gameplay view with HUD

Pro tip: Use the browser console to test if localStorage is saving and loading correctly.

5Fix Bugs and Add Missing Features

If you notice issues like enemies not moving or sound not playing, use follow-up prompts.

Example prompt for fixing audio:

Add proper audio support with play/pause toggle for background music and SFX. Ensure sounds are loaded via HTML5 Audio API.

For inventory bugs:

Implement an item collection system where player gains items on collision, and these items appear in a UI panel with stats.

Make sure to run the game after each fix to verify functionality. Keep testing until all core features work as described in the full prompt.

Pro tip: Ask for specific fixes one at a time to avoid overwhelming AI or breaking existing code.

6Optimize Performance and Responsiveness

Check how the game performs on different devices. If it feels sluggish, optimize:

  • Canvas rendering (limit unnecessary redraws)
  • Enemy spawn rate and update logic
  • Use requestAnimationFrame for smooth animations
  • Ensure touch controls work well on mobile

For responsiveness:

  • Adjust UI panels based on screen size
  • Scale canvas and elements properly
  • Add virtual joystick for mobile users

Test the game across desktop, tablet, and phone to ensure all features are functional. If performance is poor, simplify animations or reduce enemy count.

Pro tip: Use browser DevTools to monitor FPS and CPU usage during gameplay.

7Add Accessibility and Visual Polish

Improve accessibility by:

  • Adding keyboard navigation support for menus
  • Including screen reader-friendly labels
  • Supporting colorblind modes via CSS filters
  • Using semantic HTML structure

Enhance visual design with:

  • Consistent pixel art style
  • Smooth transitions between game states
  • Clean sans-serif fonts for UI text
  • Visual effects for spells and attacks

Ensure all UI elements are clearly visible against the dark fantasy theme. Test how color contrasts work on different screens.

Pro tip: Use the browser's accessibility tools to verify screen reader compatibility.

8Test All Game States and Controls

Verify that all game states work:

  • Main menu with start button
  • Active gameplay with controls
  • Pause screen with resume option
  • Game over screen showing final score
  • Victory screen after defeating boss

Confirm touch controls work on mobile:

  • Virtual joystick for movement
  • Action buttons for attack and pause

Ensure all keyboard controls function properly:

  • WASD or arrow keys for movement
  • Spacebar to pause
  • Enter to confirm selections

Test each control in different game modes to ensure consistency.

Pro tip: Use a mobile emulator or test on an actual device for full touch control validation.

9Deploy Free with GitHub Pages or Netlify

To share your RPG with others:

  1. Push your project to GitHub:
  • Create a new repo
  • Add index.html file
  • Commit and push
  1. Deploy using GitHub Pages:
  • Go to repo settings
  • Enable GitHub Pages
  • Select main branch as source
  1. Or deploy on Netlify or Vercel:
  • Drag and drop folder into tool
  • Configure build settings if needed

Make sure all assets (images, sounds) are referenced correctly in the HTML file.

Once deployed, share your live preview link with friends or community.

Pro tip: Use a custom domain for more professional presentation.

10Customize and Extend Your RPG

After completing the base game:

  • Change the theme (e.g., sci-fi or medieval)
  • Add new character classes or races
  • Include multiple levels or maps
  • Expand combat with more spells or weapons
  • Add achievements or unlockable content
  • Modify difficulty curves for different player skill levels

You can also adapt the game to specific branding needs by changing:

  • Color schemes and visual styles
  • Character names and lore
  • Soundtracks and ambient effects

This flexibility allows you to tailor the RPG to fit any business or creative project.

Pro tip: Use version control early to track changes when customizing features.

11Share Your Finished Game

Once everything works, share your completed role playing game. The AI-generated code is a great starting point for further development or personal projects.

Consider submitting it to browser game showcases or open source repositories. You’ve created something fully functional that runs in any modern browser, no build tools required.

This tutorial demonstrates how powerful AI coding tools can be for rapid prototyping and full project creation, especially with clear prompts like the one used here.

Pro tip: Document your process or create a short video walkthrough to showcase your work.

Adapt it to your own brand

  • Modify visual theme to match branding (colors, fonts, art style)
  • Change game mechanics to suit different genres (action, strategy, puzzle)
  • Adjust difficulty curves for casual or hardcore players
  • Add new character classes or races with unique abilities
  • Include language localization support for global audiences
  • Integrate social sharing features like leaderboards
  • Replace default assets with custom sprites and sounds

Common mistakes and fixes

  • Forgetting to paste the full prompt, leads to missing features
  • Not testing controls locally before deployment, causes broken gameplay
  • Misplacing assets or using incorrect paths, breaks visual elements
  • Overcomplicating code with unnecessary features instead of focusing on core mechanics
  • Ignoring browser compatibility issues, especially on older browsers
  • Failing to optimize performance for mobile devices, results in laggy gameplay

Frequently asked questions

Which AI tools work best for this kind of project?

Tools like ChatGPT, Claude, Gemini, Cursor, Lovable, Bolt, and v0 are all effective for building browser games. Each has strengths in code generation or refinement.

Do I need to install anything else to run this game?

No. The game is self-contained in one HTML file with no external dependencies. Just open it in any modern browser.

How do I fix audio not playing?

Ensure you're using the HTML5 Audio API correctly, and that sound files are referenced properly in your code. Test in a local server if needed.

Can I add more enemies or levels later?

Yes. The base game is modular enough to allow expansion with new enemies, items, or maps without rewriting the entire system.

Final thoughts

You now have a working role playing game built using AI tools and the prompt from .NET Console Games. This guide walks you through every step from code generation to deployment, ensuring a functional and polished experience. Try copying the full prompt above and building your own version, it's an excellent way to learn game development with modern AI assistance.

Originally published on PromptGrabber.com — find thousands more AI prompts there.