Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Because LumenLab is restricted to a single dimension composed of an array of LED
| **Title** | **Description** |
| --- | --- |
| **Recall** |*Recall* is an adaptation of Hasbro's fifty-year-old game [*Simon*](https://en.wikipedia.org/wiki/Simon_(game)), chosen for its familiarity and simplicity. Players easily recognize the format, making it a natural fit for LumenLab’s constraints. Similar to the original, the LED strip flashes a color, and the player must press the matching button on the PS3 controller. Each round adds another color to the sequence, which must be recalled in full and in order.|
| **Phase Evasion** | *Phase Evasion* is a game inspired by Google Chrome's [*Dinosaur Game*](https://en.wikipedia.org/wiki/Dinosaur_Game), replacing jumping and ducking obstacles with color-based evasion. You are a solid-colored specter pursued by incoming flares. To survive, you must phase shift to match each flare’s color and blend in to evade capture. As the game progresses, the flares accelerate, testing reflexes and timing.<br><br>*In development.* |
| **Phase Evasion** | *Phase Evasion* is a fast, colorful test of reflexes and hand-eye coordination. You are a color-shifting specter that is being pursued by colorful flares. You must match their color at the right moment to phase through them to evade. Gems are scattered throughout periodically. Quickly move over and grab them for bonus points if you dare. As the speed climbs and the screen fills with color, quick reactions and bold moves are the only way to stay in the game. |
| **Light Strike** | *Light Strike* combines the spirit of Atari's [*Space Invaders*](https://en.wikipedia.org/wiki/Space_Invaders) with elements of [*Asteroids*](https://en.wikipedia.org/wiki/Asteroids_(video_game)). As a lone agent in deep space, you enounter waves of predators approaching you from directions sides at varying speeds. Moving freely across the x-axis, and your survival requires defending yourself with your laser pistol. Conserve your ammunition however, your weapon can only fire so many rounds a minute!<br><br>*In development.* |
| **Reflex** | *Reflex* is a fast-moving inspired by the modern arcade game [*Pop the Lock*](https://www.baytekent.com/pop-the-lock/), testing precision and timing under pressure. A moving marker sweeps across the field toward a shifting target. Fire at the perfect moment to score a hit. Each success quickens the pace, reverses the marker's direction, and relocates the target to a new random location. Survive fifty flawless shots to win.<br><br>*In development.* |
| **Spectrum** | *Spectrum* tests your perception of color and precision of control. A random RGB color appears on one end of the display, and you must use the analog stick to recreate it as closely as possible. The closer your match, the higher your score.<br><br>*In development* |
Expand Down
2 changes: 0 additions & 2 deletions include/core/context-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "engine/layer.h"
#include "engine/state-manager.h"
#include "core/configuration.h"
#include "player/controller.h"
#include "lights/led-strip.h"
#include "display/display.h"
Expand All @@ -19,7 +18,6 @@ namespace SystemCore

Engine::Layer *application = nullptr;
Engine::StateManager stateManager;
SystemCore::Configuration config;
Player::Controller controller;
Lights::LedStrip leds;
Display::OledDisplay display;
Expand Down
6 changes: 2 additions & 4 deletions include/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@ namespace Engine
{
public:
GameEngine();
virtual ~GameEngine() = default;
GameEngine(const GameEngine &) = delete;
GameEngine &operator=(const GameEngine &) = delete;

void runApplication();
void standbyControllerConnection();

private:
SystemCore::ContextManager contextManager;
uint32_t lastRender = 0;
float disconnectedLedPhaseShift = 0;

void initializeEngine();
void renderLedStrip();
void displayMainMenuSelection();
void displayGameSelection();
void displaySceneSelection();
static void displayTask(void *param);
float disconnectedLedPhaseShift = 0;
};
}
1 change: 0 additions & 1 deletion include/engine/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace Engine
class Layer
{
public:
Layer() {};
virtual void nextEvent() = 0;
};
}
12 changes: 7 additions & 5 deletions include/engine/state-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ namespace Engine
StateManager() : systemState{SystemState::Initialize},
userMainMenuChoice{MainMenuSelection::Games},
userGameChoice{GameSelection::Recall} {}
bool isRunning() { return systemState != SystemState::Error; }

bool displayShouldUpdate = true;
bool displayIsVisible = true;

bool isRunning() const { return systemState != SystemState::Error; }

const SystemState current() const { return systemState; }
void setNext(SystemState state);

Expand All @@ -83,11 +85,11 @@ namespace Engine
Scenes::Canvas::SceneState &getCanvasSceneState() { return canvasSceneState; }

private:
SystemState systemState = SystemState::MenuHome;
SystemState systemState;

MainMenuSelection userMainMenuChoice = MainMenuSelection::Games;
GameSelection userGameChoice = GameSelection::Demo;
SceneSelection userSceneChoice = SceneSelection::Canvas;
MainMenuSelection userMainMenuChoice;
GameSelection userGameChoice;
SceneSelection userSceneChoice;

Games::Recall::GameState recallGameState;
Games::PhaseEvasion::GameState phaseEvasionGameState;
Expand Down
5 changes: 1 addition & 4 deletions include/engine/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ namespace Engine
class Timer
{
public:
Timer() = default;
virtual ~Timer() = default;

void wait(uint32_t futureTime);
const bool isReady() const;
uint32_t nextOccurrence() { return next; }
uint32_t nextOccurrence() const { return next; }

private:
uint32_t next{millis()};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

namespace Games::Demo
{
class Controller : public Engine::Layer
class Driver : public Engine::Layer
{
public:
Controller(SystemCore::ContextManager *ctx) : Engine::Layer{}, contextManager{ctx}, player1{Player{ctx}}, player2{Player{ctx}}
Driver(SystemCore::ContextManager *ctx) : Engine::Layer{}, contextManager{ctx}, player1{Player{ctx, width}}, player2{Player{ctx, width}}
{
contextManager->stateManager.getDemoGameState().reset();
}
Expand All @@ -25,5 +25,6 @@ namespace Games::Demo
Player player1;
Player player2;
static constexpr float speed = 4.0f;
static constexpr uint16_t width = 7;
};
}
8 changes: 2 additions & 6 deletions include/games/demo/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@

namespace Games::Demo
{
class Player : public ::Player::Player
class Player : public ::Player::BasePlayer
{
public:
Player(SystemCore::ContextManager *ctx) : contextManager{ctx}, ::Player::Player{ctx} {};
Player(SystemCore::ContextManager *ctx, const uint16_t width) : ::Player::BasePlayer{ctx, width} {};
void updatePlayer1LedBuffer();
void updatePlayer2LedBuffer();

private:
SystemCore::ContextManager *contextManager;
static constexpr uint16_t width = 7;
};
}
31 changes: 0 additions & 31 deletions include/games/phase-evasion/controller.h

This file was deleted.

54 changes: 54 additions & 0 deletions include/games/phase-evasion/driver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#pragma once

#include "engine/layer.h"
#include "engine/timer.h"
#include "core/context-manager.h"
#include "games/phase-evasion/player.h"
#include "games/phase-evasion/flare.h"
#include "games/phase-evasion/flare-manager.h"
#include "games/phase-evasion/gem.h"

namespace Games::PhaseEvasion
{
class Driver : public Engine::Layer, private Engine::Timer
{
public:
Driver(SystemCore::ContextManager *ctx);
void nextEvent() override;
static constexpr uint16_t playerOffset = 25;
static constexpr uint16_t playerWidth = 5;
static constexpr uint32_t windDownLength = 20'000;

private:
SystemCore::ContextManager *contextManager;
GameState &state = contextManager->stateManager.getPhaseEvasionGameState();

Player player;
FlareManager flareManager;
Gem gem;

Engine::Timer windDownTimer;
Engine::Timer gemTimeoutTimer;

float interval;
float gap;
float speed;

uint32_t gemRespawnDelay = 5000;
uint32_t gemCaptureDelay = 15000;

float gameOverPhaseShift = 0.0f;
float gameOverPhaseOffset = 0.0f;

void getUpdates();
void renderPlayer();
void renderFlare();
void renderGem();
void checkCollision();
void checkGemCapture();
void assessDifficulty();
void muzzleFlash();
void gameOver();
void reset();
};
}
7 changes: 5 additions & 2 deletions include/games/phase-evasion/flare-manager.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#pragma once

#include "core/context-manager.h"
#include "games/phase-evasion/flare.h"

namespace Games::PhaseEvasion
{
class FlareManager : public Engine::Timer
{
public:
FlareManager() = default;
FlareManager(SystemCore::ContextManager *ctx) : contextManager{ctx} {}
FlareManager(const FlareManager &) = delete;
FlareManager &operator=(const FlareManager &) = delete;

Expand All @@ -22,9 +23,11 @@ namespace Games::PhaseEvasion
const size_t size() const;

void updatePositions();
void dispatch();
void dispatch(float speed);
void reset();

private:
SystemCore::ContextManager *contextManager;
std::array<Flare, 10> flarePool;
};
}
8 changes: 4 additions & 4 deletions include/games/phase-evasion/flare.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ namespace Games::PhaseEvasion
class Flare : public Engine::Timer
{
public:
Flare() : active{false},
color{Lights::Color::WhiteSmoke},
speed{0.0f},
positionFloat{SystemCore::Configuration::numLeds + width} {};
Flare() { reset(); };

static constexpr uint16_t width = 10;
void updatePosition();
Expand All @@ -26,6 +23,9 @@ namespace Games::PhaseEvasion
bool isActive() const { return active; }
void activate(Lights::Color color, float speed);
void deactivate();
bool completedCycle = false;
bool impacted = false;
void reset();

private:
bool active;
Expand Down
37 changes: 37 additions & 0 deletions include/games/phase-evasion/gem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once

#include <cstdint>

#include "core/configuration.h"

namespace Games::PhaseEvasion
{

class Gem : public Engine::Timer
{
public:
Gem() : active{false} { spawn(0); }

static constexpr uint16_t width = 3;
uint16_t getPosition() { return position; }
bool isActive() { return active; }

Lights::Color getColor() { return Lights::Color::NavajoWhite; }

void capture() { active = false; }
void spawn(const uint16_t pos)
{
bool isOutsideLeftRegion = pos < (width - 1);
bool isOutsideRightRegion = pos > SystemCore::Configuration::numLeds + (width - 1);
if (isOutsideLeftRegion || isOutsideRightRegion)
return;

position = pos;
active = true;
}

private:
uint16_t position;
bool active;
};
}
11 changes: 2 additions & 9 deletions include/games/phase-evasion/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@

namespace Games::PhaseEvasion
{
class Player : public ::Player::Player
class Player : public ::Player::BasePlayer
{
public:
Player(SystemCore::ContextManager *ctx) : contextManager{ctx}, ::Player::Player{ctx} {};
Player(SystemCore::ContextManager *ctx, uint16_t width) : ::Player::BasePlayer{ctx, width} {};
void checkColorChangeRequest();
Lights::Color getColor() { return currentColor; }
static constexpr uint16_t width = 10;

private:
SystemCore::ContextManager *contextManager;
Lights::Color currentColor;
static constexpr ::Player::ControllerButton availableGameplayButtons[] = {
::Player::ControllerButton::Cross,
::Player::ControllerButton::Square,
::Player::ControllerButton::Triangle,
::Player::ControllerButton::Circle};
};
}
9 changes: 6 additions & 3 deletions include/games/phase-evasion/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ namespace Games::PhaseEvasion
{
Startup,
ActiveGame,
WindDown,
MuzzleFlash,
GameOver
};

class GameState
{
public:
GameState() : highScore{0}, spectersDodged{0} {}
GameState() : highScore{0}, flaresEvaded{0}, gemsCaptured{0} {}
uint16_t flaresEvaded;
uint16_t gemsCaptured;
uint16_t highScore;
uint16_t spectersDodged;
Actions current = Actions::Startup;
void reset() { highScore = spectersDodged = 0; }
void reset() { highScore = flaresEvaded = gemsCaptured = 0; }
};
}
Loading