Skip to content

jordan4ibanez/crafter

Repository files navigation

Crafter

Why is this game using typescript?

That is very simple. Static typing and the ability to do type restriction in parameters reduces the mental complexity of development for this engine. If the minetest api changes on a new release, the declaration can be updated. This will cascade the changes through your code and raise errors that you will see before you even think about launching the game engine.

Please note that: There were many languages that compile to the luajit target that I had found during my research into this matter. This one was simply the least shitty. So if you are saying "aw man typescript sucks", just know, across this highly complex and wobbly api, I can see errors before you can.

Not to say that, I can see everything, or, this is bullet proof. But if I try to transform a string into number with a variable that has a specified type of string, or perhaps I have a union of string | number. I must check which type it is, or, unsafely throw caution to the wind with a horrific implementation of casting value as string. The latter option is literally me saying "I know better than you, compiler" and therefore exploding the lua environment when something does go wrong. This cascades into where you have callback callbacks or recursive functions. I have a pretty high level of safety and soundness when calling a function. And my favorite part is, even if my declaration file is wrong, welp, I fix it and now I have discovered wrong implementation across anything else in the entire project that uses this component of the api.

And to add onto this: "Oh you have made an error at function X, Y, or Z." At this point I have probably read through the api.md file around 40 times. Everything that you are reading in this project is not only made by one person, it is entirely hand translated. So if you see that "heh heh, there's an error right there" in the declaration file, I only have one simple request. Open a PR and tell me I am wrong with what the minetest api.md file states it should be. I can only do so much. I will quadruple check the information and fix it accordingly. Thank you.

An important note about why you will not find this on contentdb:

This will not be on contentdb as I just don't feel like it. I will perhaps put this in itch.io.

An important note about why there is no csm anymore:

I don't feel like wasting my time doing the csm as no one can agree on if csm is good or bad. So if you want it, that's tough really.

An important note about why crafter skindex does not exist anymore:

I don't feel like having to instruct you on how to how to white list the mod. This is not to say I don't understand why this is the case. But I am not going to write a section in this readme or attempt to debug why it doesn't work on different versions.

An important note about why crafter no longer has redstone:

I don't feel like debugging what is essentially a turing machine in my game. I write this game for free, I write this game for fun. I don't want to waste my time on it. You can perhaps rip the mesecons out of mineclone2 and put it into the game. It is just as good.

How to compile Crafter:

If you want to mess with this or maybe you would want to use TS for your luanti things.

First you need node/nodejs/npm, if you're on ubuntu it's super outdated so go to the nodejs website and install it.

This is developed with the latest version of nodejs/npm

Nodejs stuff:

Simple:
npm install
More complicated:

This section is if you want to see what goes on.

Next you need TypeScriptToLua, typescript, and nodejs types. Also, you need Lua types for TS or else the compiler doesn't know what's going on. Also also, jszip is for creating a release zip.

npm install -D typescript-to-lua typescript @types/node lua-types jszip

Compiling:

Next you run make clean.

And if you want to edit the code you can run make watch in one terminal while continuously running make every time you want to test things in the engine. If you run make too fast after a change (like I do regularly) it will cause weird problems, so give it a moment to finish.

I HIGHLY recommend you use make. It automates a BUNCH of things. make clean is for a complete rebuild along with installing new media (images, music, models, etdc).

No make automation scripts created for windows yet though. It's because I don't run windows.

Final thing:

Start the game and create a world named debugging (don't change settings) and you will be able to use the make command without an error.

I cannot make a world for you from the command line. It does not exist in the luanti cli.

todos

todo: redo vec2 and vec3 as a TS class instead of the current mess.

About

This is my original game, given more love.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages