https://github.com/stwe/sgcity
Tile based 3D city builder maked from scratch with OpenGL.
https://github.com/stwe/sgcity
3d city-builder opengl tiles traffic
Last synced: 3 months ago
JSON representation
Tile based 3D city builder maked from scratch with OpenGL.
- Host: GitHub
- URL: https://github.com/stwe/sgcity
- Owner: stwe
- License: gpl-2.0
- Created: 2021-11-28T22:23:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-12T18:53:32.000Z (about 4 years ago)
- Last Synced: 2025-10-30T07:56:45.170Z (8 months ago)
- Topics: 3d, city-builder, opengl, tiles, traffic
- Language: C++
- Homepage:
- Size: 14.6 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SgCity
Tile based 3D city builder maked from scratch with OpenGL.
[](https://www.codacy.com/gh/stwe/SgCity/dashboard?utm_source=github.com&utm_medium=referral&utm_content=stwe/SgCity&utm_campaign=Badge_Grade)

## Current Features
* Runs on Windows and Linux
* A fixed time step game loop which process input events, update and render game objects
* Logging, Exceptions, Assertions
* OpenGL renderer
* Event system
* ImGui based menus
* Configurable with a config.ini
* A skybox for a nice background
* A camera that allows us to move freely
* Terrain manipulation (raise and lower)
* Tile selection
* Different tiles for residential, commercial, industrial and traffic zones
* The game determines if zones are connected, e.g. with a road.
* A road network can be built.
* Animated water surfaces
* Loads 3D models made in Blender (so we can load plants, trees, buildings etc.)
## Next
* Select buildings via menu
* Align game objects to the grid and highlights the tiles in color
* A complete city with simple gameplay
* Heightmap based terrain creation
* Load and save the city
## Build
### Requirements
* [GLFW](https://www.glfw.org/)
* [GLEW](http://glew.sourceforge.net/)
* [GLM](https://github.com/g-truc/glm)
* [spdlog](https://github.com/gabime/spdlog)
* [Dear ImGui](https://github.com/ocornut/imgui)
* [Assimp](https://github.com/assimp/assimp)
* C++ 17 Compiler
### Platforms
* Win
* Linux
### Build instructions
#### Win
First, [install](https://docs.conan.io/en/latest/installation.html) the Conan package manager locally.
As this project relies on multiple 3rd-Party Libs, I created a `conanfile.txt` with all the requirements.
```txt
[requires]
glfw/3.3.5
glew/2.2.0
glm/0.9.9.8
spdlog/1.9.2
imgui/1.86
assimp/5.1.0
[generators]
premake
```
My favor build configuration tool for Windows is Premake5. Premake5 can generate Makefiles and Visual Studio Solutions with a single description file for cross-platform projects.
Download [Premake5](https://premake.github.io/download) to your preferred location.
Complete the installation of requirements for the project running:
```bash
$ conan install conanfile_win.txt -s build_type=Debug
```
or
```bash
$ conan install conanfile_win.txt -s build_type=Release
```
followed by:
```bash
$ premake5 vs2019
```
#### Linux
First, [install](https://docs.conan.io/en/latest/installation.html) the Conan package manager locally.
If you are using GCC compiler >= 5.1, Conan will set the `compiler.libcxx` to the old ABI for backwards compatibility. You can change this with the following commands:
```bash
$ conan profile new default --detect # Generates default profile detecting GCC and sets old ABI
$ conan profile update settings.compiler.libcxx=libstdc++11 default # Sets libcxx to C++11 ABI
```
As this project relies on multiple 3rd-Party Libs, I created a `conanfile.txt` with all the requirements.
```txt
[requires]
glfw/3.3.5
glew/2.2.0
glm/0.9.9.8
spdlog/1.9.2
imgui/1.86
assimp/5.1.0
[generators]
cmake
```
Complete the installation of requirements for the project running:
```bash
$ conan install conanfile.txt -s build_type=Debug --build missing
```
or
```bash
$ conan install conanfile.txt -s build_type=Release --build missing
```
**If the following error occurs: `ERROR: opengl/system: Error in package_info() method, line 80`, then `pkg-config` must be installed first.**
```bash
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd src/bin
$ ./SgCity
```
## License
SgCity is licensed under the GPL-2.0 License, see [LICENSE](https://github.com/stwe/SgCity/blob/main/LICENSE) for more information.