Logic World Wednesdays: The Thursday Edition II

by @MouseHatGamesDeveloper3 years ago

Sorry for the late post. Programming is hard!

D-Latches - Jimmy

By popular and passionate request, I’ve added D-Latches to the game!

The D-Latch is the first of many new logic components we will be adding to Logic World. Stay tuned :)

Board Saving Menu - Jimmy

Last week I showed off Board Saving, but it didn’t have a menu yet. I’ve been working on the user interface for that feature.

This is the most complicated user interface I’ve ever programmed. It was definitely worth my effort, though: I expect many people will have hundreds of saved boards, and they need to have a good way of organizing them.

Form validation - Felipe

If there’s something that’s annoying to both users and web developers, it’s form validation. Most if not all user input needs to be checked, for example to make sure a user’s email is a valid email address.

Every form in our website corresponds to a class in the server, for example the login page gets transformed into an object with two fields: string Username and string Password (this will be relevant later). In this case there’s not much to verify, other than that neither fields are empty, but in more complex forms like the register form you may have to verify the email format, the username length, the password complexity, etc. These requirements have to be verified with the same criteria on the front end (for a smooth and instant response), and on the back end (in case the client fails to verify the data).

As you may or may not already know, the website is made of different technologies for the front and back side, each with their respective languages (C# and Typescript in this case). This means that validation criteria have to be defined on both the back and the front end and in ways appropriate to each language.

ASP.NET Core (the technology used in the back-end) has support for decorating the members of the aforementioned data class with attributes, which makes for a smooth and clear indication of the requirements of the form’s inputs. For example, this is how a register form could look like:

The problem is that in order to enforce these same rules on the client, you’d have to manually check the username’s length, use a regex for the email, etc. Ideally these same rules would be transferred to the client and automatically applied, so that you’d only have to specify the requirements once. This is exactly what my new library vue-aspvalidate does! It allows you to validate inputs on the client and the server while only writing the requirements a single time on the server class.

This will save you a lot of time since you won’t be writing duplicate code, while also making it less buggy and, perhaps most importantly, making sure that the server and client agree on their requirements. It’s also very extensible, letting you define your own rules with client and server logic.

Board Save Format - Jimmy

Last week when I showed off Board Saving, saved boards and saved worlds used a different file format. This week I’ve unified the systems so that boards and worlds are saved with the same logic. This means less code, which is always a good thing!

There is also now a debug option to save boards as text data instead of binary data, in case you need to edit the files manually.

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!

@Ry3 years ago

Also how much will logic world cost and will it only be sold on the lw.net store?

@JimmyDeveloper3 years ago

Sorry I took a few days to respond, I missed this comment. We are planning to sell Logic World for around $12 (in the US - there will be regional pricing). The game will NOT be exclusive to the logicworld.net store. It will for sure be on Steam, Itch.io and Gamejolt, and there are a few other stores we’re looking into as well.

@Ry3 years ago

I Thought of a idea. A Light Transmitter And Receiver. So the transmitter will take a 1 bit input and output a light signal that is 1 by 1 and 8-16 blocks long. the receiver will receive that signal And output it. This could be good for floppy disk like things and in real life you didn’t have to wire the disk to the drive and also it just makes inserting program roms easier

@JimmyDeveloper3 years ago

Interesting idea. We probably won’t do this in vanilla, but that would make a great mod :)

@Ry3 years ago

ok Noted. i cant wait for the game to release

@ThatEpicBanana3 years ago

Will the saved boards menu be able to be accessed without a board?

@JimmyDeveloper3 years ago

I agree that accessing it through the edit board menu isn’t ideal, but I can’t think of a better place for the button. There is a console command to bring up that menu, and we have a system for binding console commands to keys, so you could pretty easily make the shortcut yourself if you need it.

@TheWildJarvi3 years ago

Thankfully we can now build some compact memories!

@JimmyDeveloper3 years ago

Indeed! To do anything computationally interesting, you need a lot of memory, and D-latches make huge memories viable.

@ForLoveOfCats3 years ago

The new saved boards menu looks great! Seems to be missing a search bar though wink wink

@JimmyDeveloper3 years ago

Great idea, thanks - I’ll add it to the list!

@Broyojo3 years ago

yay d latches

@JimmyDeveloper3 years ago

As I recall you were initially opposed to the idea, preferring a low-level game with only inverters. What changed your mind?

@Broyojo3 years ago

we were working on building compact memory and it was very tiring so these would help

@pipe01Developer3 years ago

I forgot to mention that you will no longer be logged out when an update is rolled out!

@JimmyDeveloper3 years ago

Shout out to @Nano for his particularly persistent insistence that I add D-Latches :)