Monthly update for September 2017.

4 minute read

I think I’ll start posting these little monthly updates here. Because why not. It’s always good to keep some new content on the site now and then, right? Also, it’s just best to throw something together when it’s all relatively fresh - definitely much easier this way, so ultimately this may save me some time in the future if I wanted to describe some highlights of the process afterwards. So yeah.

Main theme will be the progress made throughout the month, off course. Maybe throw some other things here and there, who knows.

Abandoned globemap2.0

Globemap 2.0

For second version of the globemap I tried the approach of using meshes. The implementation turned out to be rather tricky, especially that I had almost no experience with generating meshes at runtime. And not any meshes - meshes that have to fit on a globe.

The basic idea, or rather a specific example I had in mind, was a pulsating color on the selected province. As the previous approach to the globemap was based on renderTextures using actual gui elements as provinces - it had no problem doing this. I figured the mesh approach could do this as well, and decided I’d give it a try.

While it didn’t work out, it definitely wasn’t a waste of time, as I learned a great deal. But what I also learned was that this is not the approach I’m looking for.


The approach I want to try next is a regular 2D texture approach. To get better performance at higher resolutions just split the thing into multiple pieces and organize them dynamically as the camera moves around. It’s also much better for integration with the scripts.

Ultimately I want to be able to modify province looks on the map from lua script. We’ll see how this unfolds!

More bootstrapping

Registering simulation objects from scripts is regarded core functionality when it comes to the lua API.

bootstrap.entity is working alright now. I’m still not sure if it needs some way of registering the entities in bulk or not. Right now it looks like this.

bootstrap.entity("01001", "province")
bootstrap.entity("01002", "province")
bootstrap.entity("01003", "province")
bootstrap.entity("01004", "province")

It’s ugly when you want to register a lot of provinces, but still feels useful to be able to give custom ids to all the entities. It could be more streamlined, say registering provines with id ranges 01001 to 01010 (since the province ids are already numerical). But if I wanted to make the org entity ids not numerical, like “GER” for Germany for example (like Paradox does it), then it would not work out that great.

Registering the handlers has been changed to allow for handlers to be registered any time at runtime instead of only at the startup. This handler functionality will be crucial for the element’s and how they use handlers. More on that to come.

More work on C# Evaluations

This is still an ongoing effort - to be able to make the actual evaluations on the c# side instead of the lua script side. This way it can be much faster. Ultimately I want to have the two options available, for the sake of flexibility and whatnot. It will probably be more intuitive and easier for people to write this

this.prop["population"] > 900

instead of this

types.eval({"population", ">", 900})

Doing it inside lua is fine for lighter stuff. But for heavy lifting - definitely go with the second option.

What’s next

Fully fleshing-out the lua API is the #1 priority right now. Globemap3 is definitely also going to get some attention.

Other than that, there is the website. I want to get some more docs content going. And think about publishing some API docs in the future. Yeah, that would be great.