Good vs. Evil

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
46 I had time to work on arena_keeper again and even updated the build! https://lenscas.github.io/arena_keeper_quick/

What changed this time?
I added a new menu state. Though, only the play button does something
I added a way to select what you want to place (walls or beds)
I added a button to go to the shop
probably some other stuff? Especially compared to the last build....
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
45 Well, I spent 3 hours yesterday soldering 40 wires, then unsoldering them when it didn't work
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
44 there is a part of how my game works that I actually want to replace more and more. But, I am not sure what the best option is.
Right now, species and terrain types are defined by json files. Which is great, as in theory this would make the game at least somewhat mod able. Except, there is a BIG catch. These json files aren't read at run time. Instead I have some typescript code that parses them and generates rust code based upon them.

As a result, despite me using nice json files for these things you still can't modify without rebuilding the game afterwards. :(

So, I want to remove this part of the code generation and replace it with something more flexible, but I have a hard time deciding how I want to replace it.

I seem to have 3 options:
  1. Keep using json files but load them in at run time instead of using them for code generation
  2. Make bindings to a scripting language and change the json files to the chosen language
  3. Make WASM bindings, and use the current code generation to make .wasm binaries based upon the json files
Number one is probably the easiest, but also the least flexible. As the behavior defined in those json files is limited to what I allow them to contain.

The second and third are basically the same option "Make bindings for another language" but have rather big differences in their pro's and con's.

Some pro's for WASM are:
  • Native to the browser
  • Is sandboxed by design
  • Can be written in any language
  • Can have assets compiled into them

Some cons for WASM are:
  • Not easy to modify once compiled, or in other words: two steps forward one step back.
  • Though, any language can be used that isn't to say that its easy in any language.
  • Mods may end up being unreasonably big if they are written in "bad" languages (A mod written in C# will come with the whole Mono compiler/framework compiled)
  • Probably not as easy to setup as lua bindings


Making bindings for a programming language like lua on the other hand:
  • Is easily sandboxed (though, it is not save by design)
  • no compile needed, always editable by users.
  • Easier to setup for the user. Just place a .lua file at the correct place and you can mod the game
  • No need for every mod to ship its own VM because the language it was written in happens to need one
  • Probably easier to setup than WASM bindings (because someone already made bindings for lua and there are lua vm's written in rust)

But, it also comes with some big downsides:
  • Not sandboxed by default
  • Not native to the web
  • Only one language is supported
  • May require a dependency written in C depending on the state of the various lua vm's written in rust
  • LuaJit is dead and probably unable to be used in the browser :( RIP One of the fastest, if not fastest scripting languages
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
45. Oof - I hope it holds off! I was lucky, managed to get in a brisk lunchtime walk in the sun despite the forecast rain.
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
44 I don't hate it, the issue is when I need to stand in the rain for hours, though thankfully that didn't happen. It was just drizzling when we moved the car back, and that's because we ended early because of rain.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
45 I did a quick search and it seems that making bindings towards WASM is doable. It does limit me what types I share though (Various integers, with u64 being the biggest together with float 32 and 64).

However, the only part that requires unsafe blocks seem to be the module side. Also, some work seems to be done at creating a standard custom section that, if I understand it correctly means that some glue code can be auto generated that sits between the host and the WASM module. Which, once ready hopefully reduces the friction of the limited types. In the mean time, I guess I will just use the Serde crate to serialize everything that needs to be send across and its up to me to keep this overhead small.
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
44 Painted foam. It's a mold for the solar car, to use to do the carbon fibre composite layups on.
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
45. Oh nice! :) That reminds me of a car the Renewable Energy department made at my workplace a few years ago. I think that was hydrogen powered though
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
44 This is a student organization at my Uni, so it's designed and built by university students, myself included.
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
45. Oh wow! That's very cool :) Some of the guys at the Uni I work at are doing novel solar cell material, with metal oxides and such. Its pretty neat!