[Hive P v. S] Week 7-8 Progress: Serverless backend

in #gamedev4 years ago (edited)

Introduction

Open source arcade game with Hive blockchain support. Read the bottom about section for more information.

highscore.png

High score table ready. Actual submission to it is not.

Wrapping up menus and moving to the back

Finished the work with menus and user interface during the week after last post. There is more to be done, but the content depends on the final game so have to be considered finished for now. Feels good to have it done, would not call it the most exciting thing to work on.

manual.png

Good ol' manual.

The rest of the time has been spent in the back, preparing for adding high score submissions to the Hive blockchain. A great deal of time went to doing research on how to improve the workflow for the backend. I use Amazon AWS and specifically Lambda with a Gateway API access point. In the past I've only done shorter functions, like the mail sender for the contact form on my website, and doing that has been OK using the in-browser editor for Lambda. Would like to emphasize OK. The in-browser editor is not great, not good, but workable.

I found basically two options to choose from when setting up a local development flow for serverless programing. The first I found was serverless, but from the descriptions and site I interpreted it as a service mainly used using their site and solution. Yes there was an open source component, but the main drive is to use their paid service, which in itself is fine, but the addition of a third party dependency was not something I wanted.

Moving on, the second option was AWS SAM combined with AWS Toolkit for VSCode. This sounded like what I was looking for, a bit complicated and massive to setup only for doing a tiny bit of development, but really the only option I could find. Setting up the toolkit was a breeze, mainly as I already use some AWS stuff in my projects, the basic authentication etc is already configured. AWS SAM on the other hand... not complicated, but many steps of installing a ton of crap in order to get it all up and running. After doing it... it was clear in the first test that this was not for me. Painfully slow just to invoke a function to test the response to some data you sent it. This was a local invoke, I expected it to be near instant. Figuring well this could be an initial first run setup, I re-tried and continued working for a bit, but nope. Yes, it is faster after the first time, but no, not good at all.

Did the only sane thing and reverted everything back to pre-"AWS SAM" status. Went back and looked over the serverless option again, this time reading a bit more careful on how to get started. It seemed it might be OK after all. In fact setting it up seemed very straight forward.

Serverless comes as a regular npm package. "npm install serverless" and you are good to go after some configuration of AWS policies. It was surprisingly easy to get a test launched and working. It is near free from configuration, mainly because they have chosen the path of using defaults for just about anything. They do push a bit to get you to use their services, but I went with no and in the week that has been I have not encountered any issues. The CLI on its own works very well. I did some setup with npm-watch, configured the serverless launch and that gave me the desired behavior of "write some code, save and near instantly see the executed result".

lambda.png

Optimized code in Lambda as serverless put it there for me. 👍

If you ever do some serverless work, for AWS, Google, Azure or any of the other services, I can't recommend serverless enough. Makes cloud work as local as it can be!

Thanks for reading, keep buzzing.

About

Hive P v. S is a mashup of Pac Man and Snake. You fly around collecting stars, each star collected spawns a piece of a tail that gets longer and longer. Avoid the tail for as long as possible until you get a power up that gives you a limited time to eat the tail. If successful, the tail is destroyed and new stars are spawned. Rinse and repeat.

When the final score is high enough, you'll get the opportunity to submit the score to the high score table. The high score table is saved on Hive and is viewable on Hive as well as in-game for all users.

Game will be released for browsers, as a PWA and as native builds for mobile and computer platforms.

Check out the following links to get a closer look at the progress!

Project links: GitHub, website and playable build.


Game development using web technologies.

Spelmakare.se
Discord
GitHub

Try the latest development build of Hive P v. S
Try the latest development build of Purple & Eye

Sort:  

Following! @tipu curate

Thanks! 🤗