The Sprite Generator API

The Sprite Generator API

So the next thing I want to do before I get into the dreaded test writing is build my Sprite Generator API. Good news is I found the one I wrote a couple years ago on my office server.

Test Upload Success

I've got it wired up to the object store now and the next thing I need to do is rewrite it's payload handler to accept the new data format.

It's working.

So, the slime will have... a lot of things I will have to account for. I need to deal with each part of the slime individually from the tail up. When I add the facing away half of the sprite I will have to reverse it.

Before I start decoding the JSON and fetching the sprite parts, I have to sort out my retrieval function. Have to be able to fetch the sprite parts, don't I?

So far, so good. I can read my README.MD file I use to test with.

Next step is having the main API call the sprite generator after it's saved a new slime and have it generate the new sprites.

Day Two.

So I have started on a custom serializer for the Sprite Generator API. While I could be lazy and use a URL serializer and just follow links with requests and process the JSON from each of them it would be very inefficient. There would be so many requests per each sprite generation and so many database queries... it would get problematic rather quickly I expect.

So I have to go the long route in my code, which likely looks like custom serializers for each part of the slime unless I can find a way around it... I do have one idea I will try first, though I am not sure if I have access to the instance inside the serializer. Time to sift through the DRF docs.


Well, that looks overly complex for something only the Sprite Generator API will ever see. Hmm, I suppose I have a few options here but I think I could just write a custom JSON serializer without all the DRF bits being involved here. It's really not necessary in this case and would just over-complicate things for me.

So after saving, retrieve the data, get only the required fields in the related tables from the DB (Image URLS), package them up and send them over. This way we don't have more data than is required being sent to the Sprite Generator.

Alright, after much trial and error and the separation of highlights and shadows into their own layer, I have an abomination.

I'm coming to your house after school!
Generated and Uploaded
API for Image Generation

Welp, that's all for this week. Back to it Monday. Happy Weekend.