Skip to content

mentaman/GarageEngine

 
 

Repository files navigation

GarageEngine

This is an educational project, I'm learning as I go, I cannot promise backwards compatibility at this point.
the name will be probably changed.

Install:

Windows: To avoid installing mingw and downloading libraries in windows I have added the .a files.
go get github.com/vova616/garageEngine
go get github.com/vova616/chipmunk
go get github.com/vova616/gl
go get github.com/go-gl/glfw
(just to make sure you got all the sources, ignore all the erroes)

go to GarageEngine source folder and copy the pkg folder to your golang folder. (override) now you can try to compile Garageengine.

Other: You need to download glfw/gl/glew libraries.
sudo apt-get update
sudo apt-get install build-essential binutils-gold freeglut3 freeglut3-dev libglew-dev libglfw-dev libxrandr2 libxrandr-dev libglew libglew1.8

go get github.com/vova616/garageEngine

To-Do list

Clean project:
Name changing Engine -> engine etc...
Function changing -> SetWorldPositionf -> SetWorldPosition2d etc...

Atlas - Make functions return id, LoadImage should not use id and clean whatever we can.
Font - Clean the hell out of it, clever atlas creating.
Material - Think of design that does not require lots of work when creating custom shaders.
Physics - Code interpolation and think of a better design for arbiter and clean & polish stuff.
Scene - Do less work when coding scenes also get scene by name.
Tree Behaviours - Clean & polish & new features.
Camera - support multiple cameras, make the camera look at center or other point.
Rendering - support auto-batching, only render objects close to camera(make it smarter), render by Z and not by layers.
Coroutine - try to fix the bug that you cannot access to textures in Coroutines.
Transform - Do not brake Z coord when using functions.
Readme - explain Tree Behaviours.
Learn from - https://github.com/runningwild/haunts .
Comments - lacks tons of it.

Dependencies

github.com/vova616/gl
github.com/vova616/chipmunk
github.com/go-gl/glfw

Coroutines(they might be deprecated):

The useage is same as unity coroutines.
Use Behaviour Trees, its better and faster.

Behaviour Trees:

Example in SpaceCookies/game/EnemeyAI.go

SpaceCookies

Mini game to test the engine, it will host server on port 123 then you connect to it. Make sure your executable file is in the same folder with the data folder.

Videos:

http://www.youtube.com/watch?v=iMMbf6SRb9Q
http://www.youtube.com/watch?v=BMRlY9dFVLg

Coroutines Example:

func (sp *PlayerController) Start() {
	as := StartCoroutine(func() { sp.AutoShoot() })
	
	StartCoroutine(func() {
		CoSleep(3)
		YieldCoroutine(as) //wait for as to finish
		for i := 0; i < 10; i++ {
			CoCoYieldSkip()
			CoYieldSkip()
			CoYieldSkip()
			sp.Shoot()
		}
	})
}

func (sp *PlayerController) AutoShoot() {
	for i := 0; i < 3; i++ {
		CoSleep(3)
		sp.Shoot()
	}
}

func (sp *PlayerController) AutoShoot2() {
	for i := 0; i < 3; i++ {
		for i:=0;i<3*60;i++ {
			CoYieldSkip() //Frame skip
		}
		sp.Shoot()
	}
}

func (sp *PlayerController) AutoShoot3() {
	for i := 0; i < 3; i++ {
		Signal := NewSignal()
		go func() {
			<-time.After(time.Second * 3)
			Signal.SendEnd()
		}() 
		Yield(Signal)
		sp.Shoot()
	}
} 

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%