Development Blog (semi)random.thoughts()

Swift

Pseudo random number generation using a hash function

What if you want to generate random numbers, in a deterministic way and be able to restore the RNGs state? Maybe rolling your own using a hash function and conforming to `RandomNumberGenerator` is the way to go? Its the way I did it for my roguelike game.
Read More…

Bye bye callbacks! Combining Combine and SpriteKit

Consider a simulation game. The game probably has some entities, wether it's cities, cells, soldiers or reindeer. Now consider it is a turn based game, where the simulation advances on a "tick" basis. Before and after the tick, the state of the simulation will have changed, so for instance your cells might have a different color and your reindeer might have moved. Your visualization should update accordingly.

Due to the complexity usually involved with simulation models, your modal is probably a self contained unit, that perhaps knows nothing about UI stuff. Or it shouldn't anyway, because why would it care? Can we use Combine with SpriteKit to simulate the "automagical updating" of SwiftUI. Yes we can!

Read More…

Codable conformance for ECS system revisisted

In the post I demonstrated a way of adding Codable conformance to the GameplayKit ECS system. For another game I'm working on (HexEngine, source here: https://github.com/maartene/HexEngine) I experimented with a different solution, that I now feel is more elegant.
Read More…

Running Vapor apps in the Cloud using Docker and Digital Ocean

So, you created a nice Vapor app? Or you followed one of many online Vapor tutorials? And you have it running successfully, albeit locally? Now you want to run it on the server? This is exactly where I was a couple of days ago. And getting my App to run online was a little tougher than expected… Read More…

[Deprecated] SwiftUI as UI for SpriteKit games

Update 2020-06-23: in Xcode 12, Apple introduced a native solution for integrating SpriteKit and SwiftUI. Learn more here: https://www.hackingwithswift.com/quick-start/swiftui/how-to-integrate-spritekit-using-spriteview

———— Original post follows ————
For my HexMap project, I use SwiftUI to create the game's GUI.

Schermafbeelding 2019-10-31 om 21.47.33

In this tutorial, I'll show (with a simpler) example how I integrate SwiftUI and SpriteKit. Read More…

We value your privacy. This site collects only information required to provide you this Service. For more information, read our privacy policy.