Monthly Report - July 2017

Aug 1, 2017

Here comes July report.

I slightly changed to present projects-hour spent in bar chart instead of pie chart as before for this report (and likely to continue for next one). It's clearer to present in this way if there are lots of projects to show.

Total hours spent

Summary

Most of the time in this month has been spent on asteroids project both in terms of research and programming. I've done releasing open source version of it, but continued to adding features I want for commercial one in which hopefully soon that I can release to the wild.

Also few hours spent on fixing and configuring my servers to be ready for deploying company website (https://abzi.co), but you will see only "Underconstruction" for now.

asteroids

It is initially a port project from ForeignGuyMike, then I added bunch of new improvements, and support over control scheme seamlessly for PC and mobile platform, better error and resource management handling, and featured ful Kotlin language switched with more utilization of lambda functions.

Mobile control support via Touchpad

Controller support for Desktop

After porting effort is complete, I want to monetize it.

Thus I diverge from it and in the progress of adding multiplayer mode (could I call it PvP?). This is a turning point for streaks I've done on github. Since then, I switched to use gitlab for private repository. As much as I want to keep being on Github ecosystem, but private repository needs you to pay premium for $7/month. So it's no go for me during this time.

Back to the game. Major feature I'm building right now is multiplayer mode.
Allowing player to play with each other in the death match is definitely cool. So I try. Below is the result I got so far.

Behind that hours accumulated done in research for networking model and approach I should be doing with the following aims

Resource consumption needed on server should be as minimum as much as possible (thus peer-to-peer via relay server on UDP protocol is an answer)

Up for the game in real-time pace (TCP is no no, only option is UDP)

Server is implemented in NodeJS with no extra libraries in used, the same goes for client in pure Java code as of now. The result you see in the gifs above is smooth and good due to the fact that client sends only commands to server, server will relay them to another player. This goes for 2 ways for both players. Sending command-updates to server is at 30 times per second (or 30 packets per second). Client simulates the game smoothly at 60 fps.

It uses minimal bandwidth in which the game like Starcraft, and Supreme Commander also use this techniqueRef. Anyway, i'm not done yet as what I need more is

Reliable + Ordered UDP messaging

TCP offers this capability, but using TCP is no option due to lagging in time wait when packet dropped, it needs to wait double of the RTT (Round-trip-time) or 2*RTT. Input packets sent are critical that it needs to make sure it makes its way to another client. Sometimes UDP packets also arrive out of order. Implement such feature to ensure reliability and orderness on top of UDP protocol is a way to go and I found it very hard to implement, although there's a great resource outlining what to do in concept, or code to look at.

Ensure deterministic

As client simulates the game on their own, each input sent from another side needs to produce the same result on both end even no matter which platform the game is played on. As research, this problem related to Floating-point calculation error, thus to solve that we need Floating-point Determinism.

I expect that I cannot control the same set of compiler, OS, and deterministic nature of every library I used, thus I saw that I definitely need to try making floating-point calculation to produce same result with no error even tiny on all platforms the game runs on. This means in Java term either using BigDecimal or using technique of fixed-point calcultion to round it to decimal part.

As a side note, Raknet has such features of reliability and ordered of UDP message as per requirement and it's open source (although 3 years with no updates). And for Java implementation, I discovered jRakNet which might be worth to take a look.

If you're interested in networking in games, I recommend to read all articles written by Glenn Fiedler listed here, but better to start with this article.

For the time being, I will push effort and try solutions I've found.

OMO

Early this month, I also released OMO as you can see its gifs in action from previous report. I added background music with knowledge gained from learning milkytracker.

aseprite-macos-buildsh

I use aseprite, and really feel in love with it. When there's a new features introduced in new build version, it would take some times for you to manually build it yourself. Thus I create an automated build tool just in case you need to build it to get those new features ready; on-demand.

It will help you with everything from fetching source code til packaging into an app bundle ready to be double click and use.

It's tested and aimed to be used on macOS, but I guess you can modify it to cover your platform as need by taking a look at its official build manual.

Opensource Contribution

I contributed to libgdx to make it fully 100% Kotlin + fixed a bug of building on iOS-MOE. It's this PR but unfortunately didn't get merged yet as of this writing.

Also for Potatso in which I've started porting to Swift3 around 8 months ago, now passed 200 stars and 200 forks, and still counting. Also during this time, due to Chinese government intensely engages in regulating of un-approved VPN services or software, I experienced a spike of people giving star, and forking. I saw this tweet from original developer of the project. Apple asked him to take the app down. Not only that, but major VPN service providers like Express also affected. I understand that Apple has to obey law in each country the app would be sold. But it seems like it only happens against China as major news reported. It's getting serious and by February 2018, government plans to completely block and take down all of VPN service.

Anyway ..., late in this month, I got this from someone who uses Potatso.

That's right. It's 2 RMB donation from someone benefits from using Potatso. Thank you to you again!
Safe to say it's the first Chinese Yuan money I made here after switched to fully focus on my own projects. Hooraayyy!

WeChat Mini-Program

I played around with it with objective to test its API. I didn't spent much time yet as I decided to focus on asteroids project first.

As far as I can tell from testing, you cannot use jQuery. For other stuff to convert, transpile your code, you have to route and set it up yourself. Also, API is in Chinese, be prepare to always use Google Translator Chrome Plugin for full page translation.

QR Scanning ecosystem also applies here from setting up process through development process. Account owner permits linked developer account either for logging in, configuring something regarding to the app, etc via QR Scanning. I recommend to check this article out too.

Its IDE is powerful enough that it makes me feel the old day of using Visual Studio. Its intellisense is fast in popping up to show you code hint. Result shows and can be refresh right away after code changed. Pretty much as it relies on Chrome Debugging Tool for developer.

The preview feature is powerful as you click the button on IDE, scan QR code to preview it on your mobile phone right away. That debug version will stay there in Mini Program section on WeChat application in case you need to take a look again. So time needed in testing in real device is minimal, and still in WeChat ecosystem.

company-serv, and personal-serv

I switched to use nginx for my company server now. It feels much more cleaner, and shorter to edit config file. I try to avoid relying on any western service out there as much as possible. This is with objective to be able to serve users within mainland without a worry that the site will be partial, or even worse blocked and they cannot access. I went far to configure DNS server served within the same instance. Configured namecheap.com to point directly to such server. But it's pretty hard to quickly force update your domain towards root server (from what I did), it takes too long. So I ended up using it as a backup and use one of another of my server to have those DNS records (via service provider's convenient web interface) then point it to that server instead.

Again surely I have an option to just use Alibaba cloud or VPS solution, but its pricing scheme seems to be expensive after a year later. And the way to work with such solution, I'm totally not familar and it's un-tapped way for me for now. I might be wrong but yeah I want to try pushing out a first service out there which served on company server which is in Hong Kong first, then see further from there.

A tip I found about configuring certbot to automatically renew certificates on Ubuntu sever is via using webroot, properly use parameters of certbot, and correctly setup crontab.

First execute this command to obtain and let system (let's encrypt) knows what domain/sub-domain you have so that it will operate on that later in consecutive times

Use --webroot-path to update certificate for webserver without restart the instance of it. The first three domains/sub-domain will be served at /var/www/your-path/html. The last one will be served at /var/www/your-path2/html.

Then you should have this line in your crontab (freely modify how frequently it should update).

I blog about projects I'm working on. Mostly about mobile games, tech, web service, little tiny things I built for myself or for public, and tech/game industry-wide. Currently I'm living in Shenzhen, China. I'm running a small creative company with my girlfriend here.