Logic World Wednesdays: We’re Back!

by @MouseHatGamesDeveloper2 years ago

Welcome back to another Logic World Wednesday. After a three week hiatus, we are back!

If you haven’t been keeping up with us on Discord, the break has been because we were reorganizing Logic World’s 50,000 lines of code. That work is finally done, and your regularly scheduled Wednesdays have returned!

New Menus - Jimmy

I’ve added three new menus to Logic World this week! We now have a pause menu, and buttons and keys have gotten menus for editing those components.

MIDI Input Support - Jimmy

Thanks to the release of Minis by Keijiro Takahashi, Logic World’s extensive input system now supports MIDI input! You can now use your pianos to control the game. MIDI bindings can be used for regular game actions like walking and jumping, but I expect they’ll mostly be used with Keys to make in-game music machines :D

New Game State System - Jimmy

Logic World uses a complex state machine to govern the flow between game states. For example, you’re allowed to transition to the in chair state from the building state, but you’re not allowed to transition to the in chair state from the multi-wire placing stage 2 state.

Previously, we defined the rules of the state machine all in a single file. This week I’ve built a new system and transitioned all our game states to it. Under the new system, the rules of the state machine are distributed throughout many files. The rules for one state are now right next to the code for what actually happens when the game is in that state.

When we’re working on a game state, this makes it easy to see that state’s relationships with other game states. But more importantly, this means that mods can now add their own game states, since they’re not all defined in one master file.

Server architecture & networking refactor - Felipe

This week I’ve been working on refactoring the server’s codebase, adhering to the Inversion of Control principle. This means that I went through every single class, converted it to non-static, determined the classes that it depends on and injected them on its constructor, while creating an interface for it. This results in highly testable and modular code that’s a lot easier to maintain and extend.

I’ve also been refactoring the networking code: previously each packet type was composed of two methods: one for writing the packet and one for reading it. These methods operated directly on the network stream and they didn’t have an explicit structure, as it was determined by the order and type of read/write calls. After the refactor, each packet is its own class, we have SECCS serialize and deserialize it, so we don’t have to write any code that manipulates the network stream directly. Another benefit is that packets are clearly defined and, again, easier to maintain and extend.

Modding System Progress - Felipe

I’ve also been rethinking the existing modding architecture, and this time I’ve decided on a file structure that looks like this (not final): * assets/ * myimage.png * mymesh.obj * my_unityassets.assetbundle * data/ * components.succ * lib/ * MyLibrary.dll * manifest.json * server.dll * client.dll * shared.dll

The mod as a whole is comprised of two parts: the server and the client. As their names suggest, the server.dll will only be loaded on the server startup and the client.dll will be loaded on the client startup, while the shared.dll will be loaded on both and can be used to share code between them. It’s worth mentioning that all of these DLLs are regular .NET Standard 2.0 libraries generated by Visual Studio projects. A mod can have any combination of these 3 DLL files, that’s to say, a mod can have a server.dll, a client.dll or both, in which case it can also optionally have a shared.dll.

The assets folder contains different assets that the client-side mod will be able to load at runtime. Right now the supported types are .png, .obj (.mtl will probably come too) and .assetbundle, and I’d also like to add support for audio files. The asset bundle files must be generated using the same Unity version as the game, which will be made known when the game is released. These asset bundles can contain any complex assets that you may need, like Unity scenes or prefabs.

The data folder currently only contains the SUCC file defining the components that your mod has, whose format you may already have seen in previous LWWs.

The lib folder can contain any external libraries your mod uses, and the manifest.json file defines the mod’s properties, like its name, author, and unique ID used to identify the mod in-game.

Finally, the mod as a whole can be stored in one of two ways: in a .lwmod file (which is just a renamed .zip file), or in a plain folder. The former is how mods downloaded from logicworld.net will be stored, while the latter is especially useful when developing mods as you can just copy the files over without any worries.

You will be able to upload and share mods on logicworld.net, but you must upload its source code, which will get compiled for you. This is in order to enforce open source code and transparency. It protects against mods with malicious code, and it helps people learning to make mods, since they can see the sources of existing ones.

An Early Phriday

For the past few weeks, we’ve been holding biweekly off-topic discussions on the Logic World Discord. This has been a lot of fun and we’ve had some very interesting talks. Some people have lamented that these discussions are not at a good time for them, so we’re experimenting with different times. This week’s Philosophy Phriday willl be 2 hours earlier than usual, at 18:00 UTC&).

If you’d like to receive an email each time we post one of these blogs, you can sign up for our newsletter. Be sure also to wishlist Logic World on Steam and join the official Discord.

See you next Wednesday!

Read previous Logic World Wednesdays

@Vykori2 years ago

You didn’t think my small joke comment was the only comment I was going to make this week, did you?? Here I come with my regularly scheduled wall of text.

I love how Logic World will have an official mod hub, which is controlled by you guys, and also has protection measures against malicious code. This resolves multiple concerns with other games with a large modding community. Concerns like: 1. having no defined primary community 2. download links to external websites filled with ads 3. unofficial mods that cost money and don’t financially support Logic World’s development team for creating the modding framework (this point totally depends on your opinions though) 4. malicious mods 5. with enough mention of the official mod hub (on this website and in-game) you can prevent players from getting maliciously convinced to trusting outside mod sources

Maybe by default, Logic World would ONLY run mods from logicworld.net to somewhat prevent new players from being tricked to run malicious mods, too. maybe you can sign your .lwmod files somehow? like how Windows 10 displays an application’s signature when you try to run it as an administrator
Of course you would have to include a way to disable this limitation, for mod makers and curious players. Maybe a manual edit to a config file to put the game in development mode which adds a UI overlay and/or startup warning prompt about development mode. and maybe development mode could show you extra information like GUIDs for objects and random shit like that :o

Having a dedicated official modding hob also makes it possible to have mod hub UI directly in-game! and also allows servers to tell clients what mods the server has installed, so the client can automatically download them from logicworld.net and (maybe with an application restart) automatically join the server once it’s done! Maybe you can have some hacky steam workshop integration where the workshop items would just tell the game to go download the REAL mod data from logicworld.net. So mod creators can upload to the steam workshop if they want, for extra attention?

I wonder if it’s possible for finished mods uploaded to logicworld.net to rely on code residing on a different folder on your computer? this could be a bypass to the open source requirement.

@JimmyDeveloper2 years ago

You bring up a lot of great points regarding the benefits of us developing and controlling the modding hub for LW. Another thing which you didn’t mention is that we can ensure that mods don’t get lost in the long term. There are so many old games which used to have active modding scenes where you can’t find the mods anymore. Third-party hosts all eventually go down, but we’ll keep logicworld.net running as long as we can, and when we have to shut it down we’ll release all the website’s data as a torrent to ensure it is preserved.

Maybe by default, Logic World would ONLY run mods from logicworld.net to somewhat prevent new players from being tricked to run malicious mods, too. maybe you can sign your .lwmod files somehow? like how Windows 10 displays an application’s signature when you try to run it as an administrator

We probably won’t do anything like this, it seems like a lot of work for minimal gain. When you enable a mod in-game, there will be lots of warnings that mods can run malicious code, and you should only install mods from sources and authors you trust.

I wonder if it’s possible for finished mods uploaded to logicworld.net to rely on code residing on a different folder on your computer? this could be a bypass to the open source requirement.

This would result in a compiler error when you try to upload your mod; you couldn’t get it on the site.

@Vykori2 years ago (edited2 years ago)

Ooh yes, ensuring mods don’t get lost is a huge benefit too! I like this torrent plan. I will help seed! (if I’m still alive and have the storage space)

We probably won’t do anything like this, it seems like a lot of work for minimal gain.

Yes yes, I fully realized how un-worthwhile it would be to do all the mod signature verification stuff lol. A previous draft of the comment mentioned it as well, but I’m trying to limit my unnecessary rambling (like this that I’m currently doing!)

This would result in a compiler error

very very nice C:

@Vykori2 years ago

Scaling the pause menu is fantastic and all, but why can’t I resize the menu without resizing the elements? fucking broken pause menu fix your game

@Nerd2 years ago

Immversive pause menu mod

@JimmyDeveloper2 years ago

I suppose it would be pauseable to program that

@ForLoveOfCats2 years ago

I have a suggestion I’d like to pose. Usually in games such as this either all player’s builds are intermingled or each player would have to claim an area where their builds reside by some gentleman’s agreement with the other server occupants. What if instead on a single server there could exist multiple active worlds which players can switch between freely. Each of these worlds would be owned by a player or the server and the owning player could whitelist or blacklist other non-admin players from building and modifying the contents of that world. This would still allow the community aspect of going and visiting the builds of other players both when and when they are not online as well as still allowing multiple players to collaborate on building but without the logistics of trying to shell out different areas to each player for their individual use. I’m envisioning this being useful in large public servers with players constantly connecting and disconnecting and a multitude of projects taking place at any one time.

@Vykori2 years ago

That is such a great idea, but mostly only relevant for the context you mentioned: a large public server hosted by a team of moderators, with multiple projects taking place at the same time. But If this game has the ability to just flip a switch on my single-player world allowing my friends to join me, the need for these huge public servers would go down dramatically. I think in the context of a more personal server, you’d only be working on 1 world at a time, and would only need to host 1 world at a time as well.

Another reason I didn’t foresee this game having large ;public servers is because @Jimmy once mentioned in LWW comments that (for now) multiplayer won’t have cheating/greifing detection systems in place (to allow players to have modded clients that allow them to build more freely)

Now that I’m thinking about it again, the community aspect of having large public servers is actually huge. Join the server when you’re bored, hang out with your friends, see what people are working on (even when they’re not online), etc… The only downside is really that cheating/greifing prevention systems would be required for public spaces, but maybe if there just aren’t any public spaces then that isn’t a problem..?

@ForLoveOfCats2 years ago

Yup, this solves a lot (but not all) of both logistical, social, and administrative issues around having a large public server which is home to many players

@JimmyDeveloper2 years ago

That’s a really cool idea, thank you for the suggestion!

@TheWildJarvi2 years ago

very nice work! :)