Inspiration

Remember the classic lane defense games we all played in our childhood like Plants vs Zombies? We wanted to bring that exact addictive gameplay back but give it a fresh cyberpunk pixel art coat of paint. Instead of just making a solo web game we rebuilt that nostalgic formula from the ground up for Reddit. We wanted to see what happens when an entire subreddit faces the exact same daily invasion together.

What it does

The Outpost is a daily lane defense strategy game played directly inside a Reddit feed. Every day a new challenge drops featuring a unique monster faction a rule altering mutator like acid rain or enemy frenzy and a predefined map with immovable obstacles.

Players spend gears (the unit currency used in the game) building walls, traps, and turrets to survive progressively tougher waves of enemies culminating in a massive boss fight. The best part is that everyone in the community gets the exact same layout. When you finish your run you submit your score to the daily leaderboard and see if you can beat the top players!

How we built it

Outpost is built using a modern serverless webview stack. The frontend is built using the Phaser 3 game engine for high performance 2D rendering paired with Vite for optimized assets and client compilation. The serverless backend is a sandboxed Node js server powered by Devvit and Hono to manage API endpoints for getting challenges retrieving leaderboards and posting automated comments. For state and storage Redis is used as the primary database managing key value stores for community kills active daily buffs player personal bests and sorted sets for high scores. In terms of architecture we implemented strict module separation where the game simulation state logic is written in pure TypeScript in a shared directory. It operates purely on mathematical arrays and ticks allowing identical execution on both client and server while Phaser strictly reads the state to render visual assets

Challenges we ran into

Achieving complete determinism to ensure the simulation played out identically regardless of browser framerates or fast forward speeds up to 10x was a major hurdle. We solved this by running a fixed delta time accumulator logic in the shared engine. Another challenge was programming obstacle detours and creating pathing AI where flying units fly over obstacles but get blocked by walls while ground units detour around rocks into adjacent lanes. This required writing look ahead collision checkers to prevent enemies from phasing through walls when redirecting. Finally for score validation and anti cheat measures we needed to prevent players from bypassing the client and spoofing scores. We built a server side simulator validator that re runs the exact placements and matches the final wave state to reject illegitimate high scores.

Accomplishments that we're proud of

We are incredibly proud of our 10x speed accumulator which achieves flawless execution at high speeds where projectile collisions factory gear production and damage ticks evaluate perfectly with zero precision drift. We are also proud of achieving zero scope Reddit interaction by setting up automated post recap comments and user comment flex shares seamlessly without requiring players to authorize invasive account write scopes. Finally we successfully implemented an automated daily rotation using a scheduled cron job that creates the daily challenge post sticky posts it and automatically writes the recap report detailing yesterday leaderboard champions and buff statuses.

What we learned

It was clear that we got a much clearer idea of how Devvit's web app works as a whole, being composed of a sandboxed Hono server, a Phaser client in an iframe, and Redis acting as the only database and with no persistence layer available at all. Furthermore, we were able to appreciate in practice what difference a little bit of strategy patterns can make once there is more than one status effect in a game, because having a separate little class for each enemy and turret helped to keep the code tidy and not turn into a conditional block nightmare.

What's next for The Outpost

Our next goal would be to add more turrets and enemies, make sure there is some sort of tower upgrades for better performance, and also add more types of bosses other than one that recurs in the same way. We are also interested in improving score validation with server-side validation and also work on visual part of the game because the main mechanics are already done. In addition, it would be nice to introduce skill trees and in-game updates to make the games more varied and unique.

Built With

Share this project:

Updates