Skip to content

matula/example-godot-rpg

Repository files navigation

Example RPG Template

This is a starter template for creating 2D RPG games with Godot Engine 4.4. It includes basic structures and systems commonly used in RPG games.

Features

  • Player System: Character movement, stats, combat, and interactions
  • Dialogue System: NPC conversations with branching options and conditions
  • Inventory System: Item management, equipment, and usage
  • Quest System: Quest tracking with objectives, rewards, and state management
  • Enemy AI: Basic enemy behavior with patrolling, chasing, and attacking
  • Level Management: Scene transitions and state preservation
  • UI System: Menus, dialogue panels, inventory screens, and more

Project Structure

  • /scenes: Game scenes
    • /Player.tscn: The main player character
    • /UI: UI-related scenes
    • /levels: Game levels (Village, Forest, etc.)
  • /scripts: GDScript code
    • /entities: Character scripts (Player, NPC, Enemy)
    • /ui: UI scripts
    • /levels: Level-specific scripts
    • /autoload: Global scripts (GameManager, DialogueManager, InventoryManager)
  • /data: JSON data files
    • /dialogue.json: NPC conversation data
    • /items.json: Item definitions
    • /quests.json: Quest definitions

Getting Started

  1. Open the project in Godot Engine 4.4 or higher
  2. Run the project (F5) to start from the Main Menu
  3. Click "New Game" to start a new game
  4. Use WASD or arrow keys to move the player
  5. Press E to interact with NPCs and objects
  6. Press SPACE to attack
  7. Press I to open the inventory

Customization

This template uses placeholder graphics (colored rectangles), making it easy to replace with your own assets:

  1. Replace the ColorRect nodes with Sprite nodes
  2. Add your own images to each Sprite
  3. Create animations in the AnimationPlayer nodes
  4. Update the TileMap with your own tiles for the environment

Systems Overview

Game Manager

The GameManager (scripts/autoload/GameManager.gd) handles:

  • Global game state
  • Player stats and progression
  • Quest tracking
  • Game flags for story progress
  • Save/load functionality

Dialogue System

The DialogueManager (scripts/autoload/DialogueManager.gd) provides:

  • Loading dialogue data from JSON
  • Handling NPC conversations
  • Branching dialogue options
  • Conditional responses based on game state
  • Dialogue-triggered actions (giving items, updating quests)

Inventory System

The InventoryManager (scripts/autoload/InventoryManager.gd) manages:

  • Player inventory
  • Item database
  • Equipment system
  • Item usage
  • Item effects

Extending the Template

Adding New Items

  1. Add item definitions to data/items.json
  2. Create item sprites (if needed)
  3. Update InventoryManager._load_item_database() if needed

Adding New NPCs

  1. Add NPC dialogue to data/dialogue.json
  2. Create a new CharacterBody2D with the NPC script
  3. Set the npc_id to match the dialogue data key

Adding New Quests

  1. Add quest definitions to data/quests.json
  2. Connect to NPC dialogue in data/dialogue.json
  3. Create quest-specific events in level scripts

Adding New Enemies

  1. Create a new CharacterBody2D with the Enemy script
  2. Configure enemy stats and behavior
  3. Add to the appropriate level scene

Adding New Levels

  1. Create a new scene with the necessary components (TileMap, YSort, etc.)
  2. Create a script that extends the level functionality
  3. Add level transitions in connected level scripts

License

This template is provided as-is for educational purposes. Feel free to use it as a base for your own projects.

Credits

Created with Godot Engine 4.4.

About

Generated from Claude Desktop MCP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors