Vast Platformer Side Scroller (VPSS)
This project features a comprehensive movement and state management system built for the Niantic Studio engine using Niantic VPS (Visual Positioning System). It includes modular components for input handling, vertical and horizontal player movement, and robust game progression logic, creating an engaging platforming experience.
Project Info
The code is fully commented and modular, making it easy to clone, customize, and integrate into your own projects. The system combines responsive movement mechanics with features like collision handling, coyote time, and a structured game state flow.
Custom Component Overview
Input Controller
The input-controller component manages all player inputs, supporting both:
- UI Buttons: For touch-based directional and jump controls.
- Keyboard Input: For directional (left/right) and action (jump) commands.
It dispatches events such as LeftDown, RightDown, and JumpDown for other components to respond to.
Player Vertical Movement
The player-vertical-movement component handles vertical movement and jumping logic with advanced features:
- Coyote Time: Allows the player to jump for a short grace period after leaving the ground.
- Double Jump: Optional feature enabling an additional jump mid-air.
- Jump Buffering: Ensures jump inputs made just before landing are executed upon touching the ground.
- Grounded Threshold: Fine-tunes the sensitivity for detecting when the player is grounded.
Key states include:
- Grounded: Player is on the ground and can jump.
- In Air: Player is airborne.
- Coyote Time: A short period after leaving the ground where jumping is still allowed.
Player Horizontal Movement
The player-horizontal-movement component handles smooth horizontal player movement with:
- Acceleration and Deceleration: For natural movement transitions.
- Speed Clamping: Limits horizontal speed on the ground and in the air.
- Angle Integration: Applies slight diagonal movement, aligning with the platformer angle.
This component works in tandem with the vertical movement system to adjust movement behavior based on whether the player is grounded or airborne.
Game Controller
The game-controller component manages game progression across multiple levels or parts. It handles:
- Spawn Points: Tracks specific player positions for respawning after collisions.
- Goal Detection: Transitions the game to the next level when goals are reached.
- Collision Logic: Resets the player to the current spawn point when obstacles are hit.
- State Management: Implements a flow where players progress through levels (Save One, Save Two, Save Three) and reach a final win condition.
Tags
The project uses a tagging system to simplify collision and entity identification:
- Ground Tag: Identifies ground entities for vertical movement logic.
- Obstacle Tag: Marks entities that trigger collisions, resetting the player.
- Goal Tag: Marks entities that signal the end of a level or progression point.
These tags are lightweight components that allow other systems to detect and respond to entity interactions.
Key Features
Game State Progression
The game is structured into multiple states (Save One, Save Two, Save Three) managed by the game-controller. Players respawn at the correct spawn point after collisions and progress toward the final goal.
Responsive Jumping
Combines coyote time and jump buffering to ensure precise and forgiving jump mechanics, enhancing gameplay responsiveness.
Collision-Based Logic
The vertical movement and game controller components use tagged entities (Ground, Obstacle, Goal) to trigger actions such as:
- Resetting the player’s position.
- Progressing to the next game state.
Usage
Input Controller Setup:
- Attach the input-controller component to an entity responsible for managing inputs.
- Connect UI buttons and configure keyboard bindings for directional and jump inputs.
Vertical Movement:
- Attach the player-vertical-movement component to the player entity.
- Customize parameters like jumpHeight, coyoteTime, and jumpBufferingTime for precise jumping.
Horizontal Movement:
- Attach the player-horizontal-movement component to the player entity.
- Adjust settings like moveSpeed, acceleration, and maxAirSpeed to fine-tune movement behavior.
Game Controller:
- Attach the game-controller to manage game states, spawn points, and progression.
- Configure spawn points, goals, and UI entities in the schema.
Tagging System:
- Add ground-tag, obstacle-tag, or goal-tag components to relevant entities.
- Ground entities enable jump logic, obstacles trigger respawns, and goals advance the game.
Tips
- Modular Design: Each component is independent and can be reused or extended for future projects.
- Customizability: Adjust the schema parameters (e.g., jumpHeight, moveSpeed) to match the desired gameplay feel.
- Game States: Use the game controller to create additional levels or challenges by defining new spawn points and goals.
Feedback
If you have questions or need assistance customizing or integrating these components, feel free to reach out. Let’s create something amazing! 🚀
Happy platforming! 🎮
Other Work by DCLN