A Game Engine for 2D/3D Games written in go
- Multiple Platform support: Windows, Linux, Mac, Android, Browser
- Loading Shaders
- Dynamic Shader Generation
- Multiple Viewports/Cameras
- Tweens
- Audio (.wav and .mp3)
- GUI with GTK
- Simple OnScreen GUI
- Instancing
- Rendering 3D Models
- Camera
- Loading 3D Models (.obj)
- Materials
- SpecularMaps
- NormalMaps
- PointLights
- DirectionalLights
- SpotLights
- Shadows of DirectionalLight and SpotLight
- Ray Casting
- Level Editor (in development)
- Rendering 2D Sprites
- Camera (Translating, Rotating and Zooming)
- Sprite Animation
- Rendering 2D Shapes (Point,Line,Rectangle,Polygon, etc.)
- Physics
- TiledMaps
Windows | Linux | Mac | Android | iOS | Browser | |
---|---|---|---|---|---|---|
Tested | Yes | Yes | No | Yes | No | Yes |
Implemented | Yes | Yes | Yes | Yes | No | Yes |
- mathgl (Forked from here)(License)
- tga (License)
- go-openal (Forked from here) (License)
- go-wav (Forked from here) (License)
- go-mp3 (License)
- box2d (License)
- tmx (Forked from here) (License)
- glfw (License)
- gtk (License)
- go-sdl2 (Forked from here) (License)
- gopherjs (License)
- go-gl/gl (License)
- android-go (Forked from here) (License)
- webgl (Forked from here) (License)
- Install the c-Dependencies:
// For Desktop (Most of them should already be installed)
sudo apt-get install libx11-dev libxrandr-dev libxcursor-dev libxinerama-dev libpthread-stubs0-dev zlib1g-dev libgl1-mesa-dev libxi-dev
// For GTK
sudo apt-get install libgtk-3-dev
// On Windows use msys and execute one of the following commands
pacman -S mingw-w64-x86_64-gtk3 // for 64-Bit
pacman -S mingw-w64-i686-gtk3 // for 32-Bit
// For SDL2
sudo apt-get install libsdl2-dev
// On Windows use msys and execute one of the following commands
pacman -S mingw-w64-x86_64-sdl2 // for 64-Bit
pacman -S mingw-w64-i686-sdl2 // for 32-Bit
- Install the go-Dependencies:
// Desktop
// Default (GLFW,OpenGL) if you only want to build desktop applications only execute this command
go get -u github.com/PucklaJ/mathgl/mgl32 github.com/PucklaJ/tmx github.com/ByteArena/box2d github.com/PucklaJ/GLSLGenerator github.com/go-gl/glfw/v3.2 github.com/PucklaJ/go-openal/openal github.com/PucklaJ/go-wav github.com/hajimehoshi/go-mp3 github.com/go-gl/gl/all-core/gl
// Use some of the following commands to build for a different platform or if you want to use
// a different Framework or Renderer
// Always Needed
go get -u github.com/PucklaJ/mathgl/mgl32 github.com/PucklaJ/tmx github.com/ByteArena/box2d github.com/PucklaJ/GLSLGenerator
// For GLFW
go get -u github.com/go-gl/glfw/v3.2 github.com/PucklaJ/go-openal/openal github.com/PucklaJ/go-wav github.com/hajimehoshi/go-mp3
// For SDL2
go get -u github.com/PucklaJ/go-sdl2/sdl github.com/PucklaJ/go-openal/openal github.com/PucklaJ/go-wav github.com/hajimehoshi/go-mp3
// For GTK
go get -u github.com/PucklaJ/go-openal/openal github.com/PucklaJ/go-wav github.com/hajimehoshi/go-mp3
// For OpenGL
go get -u github.com/go-gl/gl/all-core/gl
// Browser
go get -u github.com/gopherjs/gopherjs github.com/PucklaJ/webgl
// Android
go get -u github.com/PucklaJ/go-sdl2/sdl github.com/PucklaJ/android-go/gles2
// For OpenGLES2
go get -u github.com/PucklaJ/android-go/gles2
// For OpenGLES3
go get -u github.com/PucklaJ/android-go/gles3
// For OpenGLES31
go get -u github.com/PucklaJ/android-go/gles31
- Compile one of the examples to test:
cd $GOPATH/src/github.com/PucklaJ/GoHomeEngine/src/examples/basic
go build && ./basic
// You should see a gopher in the middle
Optional: Install libraries for audio on android
// If you want to use audio on android you first have to install SDL_mixer with mp3 and ogg support
// This guide is only for linux ubuntu and debian. For other platforms it should be similiar or the
// default precompiled binaries already include mp3 and ogg support.
// go to some directory where you want to store the respositories
cd $GIT_HOME
// clone and install mpg123
git clone https://github.com/kepstin/mpg123.git
cd mpg123
./configure
make -j4
sudo make install
cd ..
// install libvorbis
sudo apt-get install libvorbis-dev
// clone and install SDL_mixer
git clone https://github.com/SDL-mirror/SDL_mixer.git
cd SDL_mixer
./configure --enable-music-mp3 --enable-music-ogg
make -j4
sudo make install
// Now you are ready to use audio on android
The following code describes what is needed to write a game with GoHome
package main
import (
"github.com/PucklaJ/GoHomeEngine/src/frameworks/GLFW"
"github.com/PucklaJ/GoHomeEngine/src/gohome"
"github.com/PucklaJ/GoHomeEngine/src/renderers/OpenGL"
)
type StartScene struct {
}
func (*StartScene) Init() {
}
func (*StartScene) Update(delta_time float32) {
}
func (*StartScene) Terminate() {
}
func main() {
gohome.MainLop.Run(&framework.GLFWFramework{},&renderer.OpenGLRenderer{},1280,720,"Example",&StartScene{})
}
This program opens a window with a black background. To learn more you can look at the examples in src/examples
There is a build tool available with which you can build your games easily for different platforms Read more here.