In my last post I talked a little bit about my ideas for encoding my messages, so I thought I’d elaborate a little bit. Basic Premise To encode an object I’m going to start with converting the object into a proxy object which is simply a map of string -> string. So for example an
Continue reading Message Mircoformat and Serialisation
Message Passing in Web Workers
Once I’d implemented the Web Worker split, I had a new problem: How do I pass the messages back and forth? The main issues here is that I have to send the game state from the worker and the web page, and send requests for player interaction to the worker. Message Object The first thing
Continue reading Message Passing in Web Workers
Web Workers in Kotlin
Something I’ve known is useful for a web game is using Web Workers – the reason for this is that we need something to run in the background when the page isn’t active, and a page’s timer runs much more slowly when the page isn’t in focus (eg if you go to another tab) Kotlin does
Continue reading Web Workers in Kotlin
Back to where I was!
I’m back to where I was with Elm now, but this time with Kotlin. I’ve got: A game loop Actions including gather and forage A player action that can be set and that takes time to complete Buildings that cost and produce using the action system Random pumpkins It was considerably easier than it was
Continue reading Back to where I was!
Game loop in Kotlin
To start the game, the first thing I need is a game loop. Kotlin’s timers, unfortunately, lack some clear documentation. The first thing I noticed was that the timer functionality is, once again, just a wrapper of Java timer and not available for Javascript. This really makes me think I’m using a second-class version of
Continue reading Game loop in Kotlin
A First Look at Kotlin
Next on the things that keep cropping up in my searches is Kotlin. This appears to be a Java derivative that can compile to a few different targets, one of which is Javascript, so I thought this might be a good idea. Installation It appears that Kotlin comes free with IntelliJ IDEA which is an editor
Continue reading A First Look at Kotlin
Is Elm Right for this?
I’ve been working with Elm a bit now, and I’ve begun to have a feeling for how it works, as well as starting to hit a few problems. It’s perhaps time to consider if I’m going the right way. Good things It has been a lot better than I expected to be honest. As an
Continue reading Is Elm Right for this?
More Randomness in Elm
I found my first real bug in the game recently. When looking at my random forage results I realised that they were always getting the same results every time the action completes, unless I restarted forage. It’s a pretty stupid mistake really – because the random forage results are generated in advance, of course they’ll
Continue reading More Randomness in Elm
Probability for Drop Rates
I had a few minutes today, so I thought perhaps it was a chance to think about pumpkins. I added pumpkins as a placeholder originally, so that my resource type had more than just herbs. But it would be nice if I introduce them as a rare resource. You’re not going to find them often
Continue reading Probability for Drop Rates
Randomness in Elm
Buildings as Actors In working towards making buildings work, I realised I already have in place the structure I need for them. Fundamentally, a building is just another actor, and it produces resources in the same way as the player does. I already have a loop for that – in this case almost all building
Continue reading Randomness in Elm