GoHomeEngine

module
v0.0.0-...-5ecc521 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2019 License: Zlib

README

GoHomeEngine

godoc GitHub last commit
A Game Engine for 2D/3D Games written in go

Features

General
  • 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
3D
  • 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)
2D
  • Rendering 2D Sprites
  • Camera (Translating, Rotating and Zooming)
  • Sprite Animation
  • Rendering 2D Shapes (Point,Line,Rectangle,Polygon, etc.)
  • Physics
  • TiledMaps

Platforms

Windows Linux Mac Android iOS Browser
Tested Yes Yes No Yes No Yes
Implemented Yes Yes Yes Yes No Yes

Dependencies

Installation

  1. 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

  1. 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/PucklaMotzer09/mathgl/mgl32 github.com/PucklaMotzer09/tmx github.com/ByteArena/box2d github.com/PucklaMotzer09/GLSLGenerator github.com/go-gl/glfw/v3.2 github.com/PucklaMotzer09/go-openal/openal github.com/PucklaMotzer09/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/PucklaMotzer09/mathgl/mgl32 github.com/PucklaMotzer09/tmx github.com/ByteArena/box2d github.com/PucklaMotzer09/GLSLGenerator

	// For GLFW
	go get -u github.com/go-gl/glfw/v3.2 github.com/PucklaMotzer09/go-openal/openal github.com/PucklaMotzer09/go-wav github.com/hajimehoshi/go-mp3

	// For SDL2
	go get -u github.com/PucklaMotzer09/go-sdl2/sdl github.com/PucklaMotzer09/go-openal/openal github.com/PucklaMotzer09/go-wav github.com/hajimehoshi/go-mp3

	// For GTK
	go get -u github.com/PucklaMotzer09/go-openal/openal github.com/PucklaMotzer09/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/PucklaMotzer09/webgl

	// Android
	go get -u github.com/PucklaMotzer09/go-sdl2/sdl github.com/PucklaMotzer09/android-go/gles2

	// For OpenGLES2
	go get -u github.com/PucklaMotzer09/android-go/gles2

	// For OpenGLES3
	go get -u github.com/PucklaMotzer09/android-go/gles3

	// For OpenGLES31
	go get -u github.com/PucklaMotzer09/android-go/gles31
  1. Compile one of the examples to test:
	cd $GOPATH/src/github.com/PucklaMotzer09/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

Tutorial

The following code describes what is needed to write a game with GoHome

package main

import (
	"github.com/PucklaMotzer09/GoHomeEngine/src/frameworks/GLFW"
	"github.com/PucklaMotzer09/GoHomeEngine/src/gohome"
	"github.com/PucklaMotzer09/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

Build tool

There is a build tool available with which you can build your games easily for different platforms Read more here.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL