Skip to content

AbdulrahmanEl-Bedewy/2-D-Sandbox-Game

Repository files navigation

2-D Sandbox Game

This is a sandbox 2-D game inspired by Terraria made almost from scratch. It is written in C++ utilizing Raylib 4.0.

About

World Generation

The terrain generation is done by generating psuedo random values at each block position and then processing the values to decide whether or not to add blocks/walls. Above a certain height 1-D perlin noise is used to determine the height of blocks at each column and thus create surface hills. Below a certain height we switch to using 2-D perlin noise, the value returned is compared to a threshold if its above that threshold a block is placed otherwise it is left empty creating underground caves.

Surface

Surface

Cave

Cave

Colision Resolution

A basic grid system and AABB collision detection method are used to resolve any collisions.

Collisions GIF

Gameplay

A showcase of gameplay.

GamePlay.mp4

Day/Night cycle Day_Night

Weapons

Bow

Bow

Sword

Sword

Pickaxe

Pickaxe

Controls

  • WASD for movement
  • Space to jump
  • Enter to expand storage
  • Mouse left click to use selected item
  • Scroll wheel to change selected item in hotbar
  • R to reset player position to spawn point
  • P to pause

Task List

  • Improve collisions
  • Add world save/load functionality
  • Improve memory usage by loading chunks of the world
  • Add moving enemies
  • Add ores
  • Add trees
  • Add health bar
  • Add clouds

Credits

About

2-D Sandbox game written in C++

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages