A Mario-style HTML5 game with player name collection and MongoDB storage.
- 🎮 Classic Mario-style gameplay
- 📝 Player name input popup before starting
- 🗄️ MongoDB integration for storing player names
- 🎨 Modern, responsive UI
- ⚡ Real-time code execution for controlling Mario
- Node.js (v14 or higher)
- MongoDB Atlas account (or local MongoDB instance)
-
Clone or download this repository
-
Install dependencies:
npm install
-
The MongoDB connection string is already configured in
server.js:mongodb+srv://sahil:[email protected]/?retryWrites=true&w=majority&appName=Cluster0
-
Start the server:
npm start
-
Open your browser and go to:
http://localhost:3005 -
The game will load and show a name input popup
-
Enter your name and click "Start Game"
-
Your name will be stored in MongoDB and displayed on the title screen
-
Press 'S' to start playing!
For development with auto-restart:
npm run dev- S - Start game from title screen
- Arrow Keys - Move Mario
- Space - Jump
- Code Editor - Write JavaScript commands to control Mario
POST /api/player- Store player nameGET /api/players- Get all players (for debugging)
├── code/ # Game logic files
├── Enjine/ # Game engine
├── images/ # Game assets
├── sounds/ # Audio files
├── server.js # Express server with MongoDB
├── index.html # Main game page
└── package.json # Dependencies
Player documents are stored with the following structure:
{
"_id": "ObjectId",
"name": "Player Name",
"timestamp": "2024-01-01T00:00:00.000Z",
"createdAt": "2024-01-01T00:00:00.000Z"
}- Make sure MongoDB connection string is correct
- Check that all dependencies are installed
- Ensure port 3005 is available
- Check browser console for any JavaScript errors
MIT License