Go Games

From Adam Colton
Jump to navigation Jump to search

Engines

DIY

Because of course. Then again, I've got my vec2d package that's pretty good and the stuff I built in Javascirpt I liked, redoing that in Go won't require a lot. I like a lot of what Oakmound did, I just don't like how they did it, so I can use a lot of their code. For screen management, use their shiny fork:

https://github.com/oakmound/shiny

It may be worth building this modularly. Not as a framework but as a set of tools that work well together. Actually, I should work from the beginning to make sure I can use both shiny windows and build to GopherJS and use a canvas. Going along those lines, it may be interesting to divide up "game logic" and "client logic". Then I can easily build the same game as stand alone or client/server. Further, the client could either be a shiny window or a gopherjs app.

Once webassmbly lands, I should try that.

Graphics

2D like JS. Layers of sprites. Each sprite knows how to draw itself to a layer. With Go, more layers will be useful because I can draw them in parallel.

A sprite interface needs a few things

  • BoudingBox: Determines if the sprite should be drawn
  • Draw

I'll have a camera which can be manually set, follow a path or follow a sprite. It should also be able to scale (zoom) and rotate.

Loading

I want everything packaged in a single file, so I can build a tool to read a resources directory and write everything to a byte slice in a generated file. Now there's no loading necessary.

Physics

I've already got vec2d started. I need to get a little further on shapes. I'd really like to be able to take two shapes and give them linear and rotational movement and check for collision.

Tile Map

Also built around vec2d.

Events

I need to think about how to handle this. I know I want to be able to do things like register a sprite as a click handler (with optional bubble). I'm not sure if it makes sense to have a single event type, a single event interface or just keep the events separate.

I know there will be mouse and keyboard events. I may also want timer events or game events. My initial thought was that I would want user to dispatch mouse and keyboard events for testing, but they should be able to call the methods directly for adequate testing.