I’m building a simple engine using mono game, in order to port our game. Quick reasoning behind this, is that it’d be easier to write a simple api similar to the one the game is written in, to make porting easier. Currently I’ve gotten so far as implementing the scene graph, and next I’d like to move onto writing a renderer and batcher class before I begin actually porting.
A bit of background, the game is a racing game using a custom psuedo 3d engine, which uses projected quads to create a 3d like world, similar to outrun but with textured quads. The current engine is able to draw the whole gamescene in 3 draw calls, but this is a bit ambitious and I’d be happy enough breaking that into more batches. We did some hacks there to get spine files, sprites and textured quads to all batch together.
Initially I had in mind what I now think is a somewhat naive solution. I figured I’d simply setup a spritebatch, a spinebatch, and use drawuserindices (can’t remember exact api) to handle drawing the quads. Then, when traversing the scene graph, I’d keep store a state for the type of batch we are currently running, and then if I hit something that was not the current batch type, id stop that batch, and start the appropriate batch.
I figured this would probably be good enough for my purposes, but thought I’d better read through the relevant source code in both extended and Nez. But in these frameworks they decided to do a more “proper” solution, for want of a better word. By proper I mean like other implementations I have seen. Seems to me from a quick read of both that they are combining vertices into batches, upto max sprites, where its then flushed.
Where this worries me is that I need to handle these three types, spine, sprite and quad, and how I would actually go about batching all of these (particularly spine worries me here). Are there real flaws in my original approach? and if so are there any examples of other frameworks that include the batching of spine / quad / sprite together ?
Any help much appreciated, and I hope my description of the problem was clear.