#35 Shared Character Control Prototype
I’ve completed a new prototype that allows the player to switch control between the default player character and a villager.
Until now, villagers were treated only as NPCs. However, one of the main ideas behind the project is that any character in the world may eventually become playable.
To support this, I introduced a shared BaseCharacter structure and separated the character itself from the system controlling it.
The current structure is:
BaseCharacter └─ BaseNPC ├─ Villager └─ King
Characters can now be controlled by different controllers:
AI Controller Player Controller
Current Prototype
Pressing the C key switches control between the default player and Villager01.
Default Player Mode
- The default player receives movement input
- Villager01 is controlled by a simple AI
- The villager moves at a slower AI speed
Villager Control Mode
- The default player stops receiving manual input
- Villager01 receives player movement input
- The villager uses the same movement speed as the default player
- Pressing C again returns control to the original player
Only one character receives player input at a time.
Shared Character Movement
BaseCharacter is now based on CharacterBody2D.
The character is responsible for:
- Movement direction
- Movement speed
- Velocity
- Collision movement
- Visual facing direction
Controllers are responsible only for producing movement intent.
Controller - Reads player input or makes an AI decision - Sends a movement direction to the character Character - Calculates velocity - Calls move_and_slide() - Handles collision - Updates the visual direction
This means the same villager can use both AI movement and player movement without implementing separate physics systems.
Collision and Interaction
The previous static NPC collision was moved to the shared character body.
The following elements now move together:
- Character drawing
- Physical collision
- Interaction detection area
- Interaction label
- Y-sorting position
The existing King, other villagers, interaction areas, and character appearances remain compatible with the new structure.
Current Limitations
This is still a control-switching prototype rather than the final character system.
The camera and player UI still follow the original player character.
The next major tasks include:
- Switching camera follow targets
- Switching UI references to the active character
- Supporting more than two playable characters
- Creating a proper character selection system
- Replacing debug controllers with production controllers
- Integrating combat, dodge rolls, knockback, and other player abilities
- Gradually replacing NPC-specific concepts with shared Character systems
The important result is that a villager is no longer permanently limited to being an NPC.
The same world character can now alternate between AI control and player control.
SORA - The Lost Kingdom of the Magic Sword - Prototype Ver-
A small indie action game focused on exploration and combat.
| Status | In development |
| Author | GOZOHO |
| Genre | Action, Adventure |
| Tags | 2D, Casual, Indie, Pixel Art, Retro, Singleplayer |
More posts
- #37 Party System, Mobile Switching, Dialogue Pause, and Speech Bubbles15 hours ago
- #36 Character Switching, Party AI, and Major Mobile Control Improvements1 day ago
- #34 Procedural Characters Are Now Working as Village NPCs3 days ago
- #33 # Character Hair Direction Update3 days ago
- #32 Character Front / Back Direction Update8 days ago
- #31 Generating 10 Villagers from a Shared Character Base11 days ago
- #30 Character Hair Drawing Update14 days ago
- #29 Village Area System16 days ago
- #28 Terrain System Update17 days ago
Leave a comment
Log in with itch.io to leave a comment.