RSSAmplifier

Blog

Ruoyu Sun's Thoughts on design and code

ruoyusun.comRSS feed ↗45 posts

Latest posts

How (Not) to Make a Game Sequel

I have recently started to work on my third Steam game: Spaceship Idle , which is a sequel to CivIdle , which itself is a sequel to Industry Idle . CivIdle is my first sequel game, and I’ve learned a lot during its development: some worked well, others not so much. I’ve decided to write down all the lessons learned for my own sake, and hopefully, they are an interesting read as well. What Works…

Squeezing Last Bit Of JavaScript Performance For My Automation Game

Shortly after I released Industry Idle , I did a big round of optimization which I wrote about . For those of you who’ve never played Industry Idle, it is a factory automation and economy simulation game. The main performance issue I ran into is actually on the rendering side, which is surprising given its minimalist graphics. Why TypeScript /JavsScript Again? When I decided to work on its…

One Game, By One Man, On Six Platforms: The Good, The Bad and The Ugly

Recently, Valve announced that Counter-Strike 2 would no longer support macOS . As a one-man indie developer who has released a game supporting macOS , I find myself at first surprised at Valve’s decision. But after looking back at my own journey of supporting six platforms, I feel I can understand Valve’s perspective. I feel it is beneficial to write down some of my “lessons learned”, hopefully,…

Modern Operating System and Vertical Space Efficiency

While working on Industry Idle ’s spiritual successor CivIdle , I’ve decided to use Windows 9x/2000’s UI style as the in-game UI and spent a lot of time in Windows 2000 in a Virtual Machine. After a trip down memory lane, I suddenly realized how much vertical space is wasted on my modern Operating System (Windows 11) Just look at a side-by-side comparison of Windows Explorer on Windows 2000 and…

Using Zig As Cross Platform C Toolchain

I like to learn at least one new programming language every year - it’s mostly for fun - they are rarely useful for projects that I actually have to ship . This year, I’ve decided to look at Zig. After skimming through the official documentation and finishing the ray tracing in one weekend exercise, I realize that Zig can help with my game even though it has zero lines of Zig code. A little…

Game Performance Optimization - A Practical Example From Industry Idle

Game performance is hard, maybe not as hard as making a game deterministic . Both require disciplines , which do not come out of the box with programming language and tooling. It’s generally a good idea not to worry too much about performance while adding new game features. Because trying to kill two birds with one stone usually leads to bad decisions - over-engineering, premature optimization and…

A Poor Indie's Journey To Developing And Running A Multiplayer Game

Industry Idle is a resource management game inspired by lots of great games in this genre: Factorio, Satisfactory, Offworld Trading Company, you name it. There are two nice additions: idle game prestige mechanism and player-driven trading system. The former earns the “idle” in the game’s title, although the core gameplay is not “idle” at all. The latter opens a whole can of worms - especially for…

Kotlin is A Good Java Glue

Almost 8 years ago, after working with Scala in a large Java codebase, I wrote Scala is Not Java Glue . Scala was the “hype language” at that time and that article inevitably triggered some discussions. To be fair, Scala is not designed to be a glue language for Java and using it as one will of course backfire. Recently, I needed to do an Android port for my game Industry Idle . The platform…

Game Programming Anti Patterns

I have written quite some code for games in different settings: commercial games/engines, my own games /frameworks and some consulting work (mostly netcode related). Although I’d like to work with clean code, oftentimes I end up working with spaghetti - even for my own games. There are several reasons behind this which I might talk about later. But for this article, I’d like to document some of…

Lua Game Development And Type Safety

I am working on my next game project: Idle Space Factory . It’s a game combining resource management, factory building and trading. I have been using TypeScript for all my games for a while and I couldn’t be more happier. The gradual and structural typing system, plus the powerful type inference make TypeScript a great fit for game development. In the early prototyping phase, I don’t have to…

A Guide To Full Screen WebView And Notch / Cutout

I am currently using an Android phone with regular-ish screen which is also my development device. So when I tested my game on a friend’s Android phone with a notch, I realized that I had more work to do. Just as a background, my game runs in a WebView: the gameplay itself is rendered using WebGL and most of the UI is written in HTML. So if you are on the same boat (i.e. making a full screen app…

Beginner's Guide to Making a Multiplayer Game

Ever since I have written a series articles on game networking , I have received quite a few emails asking me more or less the same question: I want to make a multiplayer game, where do I start? This prompts me to write a beginner’s guide to making a multiplayer game, to answer this exact question. Do I Need Multiplayer From Day 1? Here are three common wisdoms regarding game net code: It is easy…

Game Networking Demystified, Part VI: Game Genres and FAQ

Part I: State vs. Input Part II: Deterministic Part III: Lockstep Part IV: Server and Network Topology Part V: Interpolation and Rollback Part VI: Game Genres and FAQ There’s no silver bullet when it comes to game networking. The solution depends a lot on game genres and game play design. RTS A player usually controls lots of units in RTS. Therefore, sending state is almost impossible since the…

Game Networking Demystified, Part V: Interpolation and Rollback

Part I: State vs. Input Part II: Deterministic Part III: Lockstep Part IV: Server and Network Topology Part V: Interpolation and Rollback Part VI: Game Genres and FAQ Hiding Network Latency Even though network bandwidth has improved a lot in recent years, the speed of light has remained constant. Therefore, the network latency has remained a problem. Just like real-time rendering is about…

Game Networking Demystified, Part IV: Server and Network Topology

Part I: State vs. Input Part II: Deterministic Part III: Lockstep Part IV: Server and Network Topology Part V: Interpolation and Rollback Part VI: Game Genres and FAQ Physical Server Let’s first be clear with the terminology. The server referred to in this post means “physical server”. Please do not confuse with the commonly used “client/server” term – that describes a game synchronization model…

Game Networking Demystified, Part III: Lockstep

Part I: State vs. Input Part II: Deterministic Part III: Lockstep Part IV: Server and Network Topology Part V: Interpolation and Rollback Part VI: Game Genres and FAQ The previous post discusses “ deterministic ”, now let’s talk about its close sibling: lockstep. What is Lockstep? In essence, lockstep means game logic will only advance when inputs from all clients are collected, hence guarantees…

Game Networking Demystified, Part II: Deterministic

Part I: State vs. Input Part II: Deterministic Part III: Lockstep Part IV: Server and Network Topology Part V: Interpolation and Rollback Part VI: Game Genres and FAQ Deterministic often appears together with lockstep but really they are two separate concept. In the previous part of the series, I state that if you want to “send only input”, then your game logic needs to be deterministic. However,…

Game Networking Demystified, Part I: State vs. Input

Part I: State vs. Input Part II: Deterministic Part III: Lockstep Part IV: Server and Network Topology Part V: Interpolation and Rollback Part VI: Game Genres and FAQ Reading discussions on game networking is often confusing. People use different “terms” to describe a game’s networking architecture but most of the terms only describe part of the architecture. So in one article, people might…

C#: 6 Years Later

6 years ago, I wrote a post titled “6 Months with C#” to summarize my experience with the language. Since then, I haven’t programmed in C# professionally (I did do quite a few C# programming with my own hobby games using Unity and Godot). Recently, I’ve picked up C# again for a work related project. The language (and its ecosystem) has changed a lot during the past 6 years and I’ve dropped down…

What I've Learnt After Making My First Hobby Game

Why A lot of people (myself included) get into software development because of computer games — as a kid, I was amazed at computer games and always curious about how it was made. However, after finally getting into the industry, most people (myself included) end up not doing game development. Extra Credit has an interesting video on Non-Professional Game Dev , which has a good description of hobby…

C# with Godot: Custom Attributes, Reflection and Extension Method

It’s been a long time since I last wrote any serious C# and my last experience was actually surprisingly pleasant (given that I am a long time Linux / Mac user). And I’ve been using Godot game engine for a long time for my games. When Godot 3.0 introduced C# support, I immediately decide to give it a whirl. Godot, if you are not familiar with, comes with GDScript , which is a Python inspired…

Developer's Music Making Guide

Unfortunately, I missed Ludum Dare 39 because of some terrible flight arrangement and delay. For those of you who have never heard of Ludum Dare, it’s a game jam that requires you to create an entire game from scratch in 48 hours. That includes all the assets like sprites, sound effects, and background music. As a developer (and an unqualified designer), I can do sprites, but music is something…

Venture Capital and Tech Background

Since our product’s target users are Chinese venture capitalists, I had the chance to talk to a wide range of VC professionals, from seasoned general partners to first-year analysts. I also have quite a lot of friends who work in this industry: some have strong tech background while others don’t. Although people from both groups enjoy different levels of success in their investments, I cannot help…

Dota 2 AI Quick Start

Dota 2 7.00 ( The New Journey ) introduced Bots API, which is quite good news for people like me. I am a fan of the game but I never manage to have enough skills or APM to compete with online players. So being able to write my own bots must be a lot of fun. However the official document is very bare bone and unfriendly for people who are new to Dota 2 modding. So here is a simple quick start for…

Do Product Managers Need to Know How to Code?

Recently I’ve spent quite some time recruiting a product manager. I have to admit, it is a first time experience for me, and for our team, since we’ve never had a product manager before. So it takes us some time to figure out what we want this person to look like — skills, qualities and job duties. And one of the most heated discussion is, whether the product manager should have a technical…

I Don't Control Every Bit of My Product and That's OK

I, probably like many other people, have coded my product from scratch. In some sense, the product is like my child - I have put a lot of passion and hard work into it and seen her grow from a toddler to a teenager. Then I feel I am distanced, not because of teenage rebellion, but because I am not her only “parent” any more. The whole engineering team has influence on her and starts to shape her.…

Passive Open Source

I used to be an active contributor to open source projects, but that was when I was still in college - I had a lot of free time and it was some good learning experience. I even managed to get involved with several open source projects when I start my first job in a big company. Things has changed since I started to run a team in startups. Sure we’ve used lots of open source libraries, but we’ve…

Things I Wish I Were Told About React Native

No. 1 (Really) Read The Document I list this as first one because it is the single most important time saver. After you really read the document, especially the “Guide” section, you should already know most of the tips below. But I know people prefer to learn by doing these days - and that’s exactly what I have done. I have wasted hours and hours on some of the things below without reading the…

Early-bird Dividend

When the “next big thing” is at its initial growing stage, they will usually provide very good terms to attract third party developers / marketers to its “ecosystem”. At that time, acquiring users is very easy because of the loose control and generous API. That’s early bird dividend . However, this will not last forever — when the platform matures, starts to exert control over its ecosystem, or…

What D3.js is Not

I have played with D3.js quite a bit recently. After exploring its API and building a rather complex chart, I come to realize that I have misunderstood D3 for a long time. It’s not only me, after talking to my friends, they also have misconceptions regarding D3. So I’ve decided to write this post to clear some of the common misunderstandings. D3 is Not a Charting Library When you go to D3…

At the Right Time and for the Right Thing

Back in early 2011, when I was coding 17Startup.com ( it’s a Crunchbase for Chinese startups ) from scratch, I was quite disappointed that I was stuck with PHP - a language that I never liked. Therefore I was exploring my other options. So I decided to give “JavaScript MVC + JSON API” a go. I had a few “good” reasons. JSON output from server-side could be used for multiple “front ends” - Web,…

Scala is Not Java Glue

Scala is enjoying all the hype now and it definitely deserves it. The language runs on one of the most mature and battle-proof language VM, has a expressive and concise syntax, provides a pragmatic mix of object oriented programming and functional programming and has a company and an active community behind it. Targeting at JVM is a smart move, that means all of the developers that write software…

My First Day with Go

I’ve always wanted to try out Go, ever since it came out. But I was always busy with other stuff so I keep procrastinating. Until recently I decided to put off everything else, put on some nice music and spend a day (actually only about 5 hours) with Go. So I record some of my first thoughts - I am sure when I look back after I spend more time with Go, I will regret some of the stuff I write here.…

A Glimpse of Angular.js $scope via Example

Angular.js is nice. I especially feel so after I started to write Backbone.js again - I had to maintain a project written in Backbone.js. Every time I write Backbone.js, I cannot help imagining how simple and easy the code and test will be if it is written in Angular.js. However, Angular.js does have its own complexities. One of the most confusing part is its $scope life cycle. Let me use a…

Implementing PDiff with Existing Selenium Tests

I first heard how PDiff (Perceptual Diff) was used for testing web applications from Brett Slatkin via his presentation of “The Secret to Safe Continuous Deployment” . I am very impressed at how simple the technique is yet it can provide great value. As a developer who spend lots of time on UI, none of the existing automated test methods can spare me the trouble of firing up my browser and…

Things I Wish I Were Told About Angular.js

Recently I have worked on a project using Angular.js. As of writing this post, it’s a medium sized app (~10 modules, ~20 controllers, ~5 services and ~10 directives) with quite decent test coverage. When I look back, I find myself learning much more about Angular.js than before. It’s not a smooth ride: I’ve gone through lots of refactor and rewrite. And there are lots of things I wish I were told…

To Developers Who First Use Bootstrap (Two)

It’s been a long time since my last post. I have to apologize for the delay as I had a little health condition. Luckily I had a draft of the second half so I can continue the writing despite of the interruption. ##Customize it the Right Way It’s acceptable to use “default” Bootstrap for internal projects or weekend project where good user experience is more important than looking good. However,…

To Developers Who First Use Bootstrap (One)

I started as a designer back in the time when the design of a web page (or app) were usually done by “professional” designers in wireframe, then in Photoshop and was sliced up nicely before it was sent to “front-end developers” who fought with cross-browser compatibility and CSS hacks. Now, this process is much simplified. You can start with some wireframes (pencil drawings is good enough) and…

Journey From DHTML To Ember.js/Angular.js

The number of times that I revisited JavaScript is probably the most among all the programming languages I use. And every time I revisited the language, it felt like writing a complete new language. Although the syntax stays the same, the application of the language has changed dramatically. DHTML era If you start writing JavaScript early enough, I am sure DHTML is very familiar to you. This is…

Node.js is Perfectly Fine And Probably You Don't Need it

Yesterday, my friend told me that he planned to rewrite his app, which was content-centric with a tiny social network running fine in PHP, to Node.js. I immediately told him “Don’t do that, it’s a terrible idea”. He said “Hah, so you are one of the node haters then.” I said “No, I am not. I think Node.js is perfectly fine and I don’t hate Javascript either.” In my friend’s case, I don’t advise him…

Pragmatic Lua - Error Handling, OOP, Closure and Coroutine

This is a follow-up post of my previous Lua introduction. If you are new to Lua, you might want to read Pragmatic Lua Basics in 30 Minutes first. Error Handling Lua does not have try-catch like syntax for error handling. In fact, error handling in Lua is very minimal. It is usually done via error() and pcall() . In most other languages, you can write something like this (I use Lua syntax) function…

Pragmatic Lua Basics in 30 Minutes

I recently learnt Lua. By saying “recently” I actually mean two days ago. I did not learn it for any projects or work - I learnt it for fun. So I spent some time googling and playing around with different stuff . Lua is probably best known as the “WoW script language”, although Lua’s application extends far more than that. However, Lua is not considered as a mainstream language and it does not…

My Take on CoffeeScript

I discovered CoffeeScript when it first came out. I thought it was just a bunch of syntactic sugar for brackets (braces and parentheses) haters. Back then, I did not write that much JavasScript and I do not hate brackets. Therefore I decided that I would not pick it up. Not a painless start However, when I wrote more and more JavaScript, I was finally fed up with its verbosity and I decided to…

6 Months with C#

I have been writing C# for more than half a year now. I think it might be a good time for me to stop and think about what I have experienced with C#. C# is not my first language - I have done lots of programming in other languages before going into C#, including C, Java, PHP, Javascript, Python, Ruby, etc. So it is relatively easy for me to pick it up - in fact, after going through some sample…

When You Need to Render Large DOM in Underscore.js

For many Javascript-intensive application, front-end template is widely used. It is handy and the code is easier to maintain. In most cases, performance won’t be a concern - modern browsers are very efficient in running Javascript. However, when DOM being rendered is getting larger and larger, the latency in browser becomes noticeable. Recently, I came across a situation where I had to render few…