Example #1
0
func main() {
	base.SetDatadir("../data")
	g := game.MakeGame()
	engine, err := cgf.NewHostEngine(g, 17, "", 20007, nil, nil)
	if err != nil {
		fmt.Printf("Unable to create engine: %v\n", err)
		return
	}
	err = cgf.Host(20007, "thunderball")
	if err != nil {
		fmt.Printf("Unable to host: %v\n", err)
		return
	}
	fmt.Printf("%v\n", engine)
	select {}
}
Example #2
0
func debugHookup(version string) *cgf.Engine {
	var err error
	for false && len(sys.GetActiveDevices()[gin.DeviceTypeController]) < 2 {
		time.Sleep(time.Millisecond * 100)
		sys.Think()
	}

	var engine *cgf.Engine
	if version != "host" {
		engine, err = cgf.NewClientEngine(17, "thunderingvictory.dyndns.org", 20007, base.EmailCrashReport, base.Log())
		if err != nil {
			base.Log().Printf("Unable to connect: %v", err)
			base.Error().Fatalf("%v", err.Error())
		}
	} else {
		sys.Think()
		g := game.MakeGame()
		if version == "host" {
			engine, err = cgf.NewHostEngine(g, 17, "", 20007, base.EmailCrashReport, base.Log())
			if err != nil {
				panic(err)
			}
			err = cgf.Host(20007, "thunderball")
			if err != nil {
				panic(err)
			}
		} else {
			engine, err = cgf.NewLocalEngine(g, 17, base.EmailCrashReport, base.Log())
		}
		if err != nil {
			base.Error().Fatalf("%v", err.Error())
		}
	}
	engine.Pause()
	engine.GetState().(*game.Game).SetSystem(sys)
	engine.Unpause()

	base.Log().Printf("Engine Id: %v", engine.Id())
	base.Log().Printf("All Ids: %v", engine.Ids())
	return engine
}