
The first version of User Scripting with Typescript went live this week on dot big bang, opening up a lot of new possibilities for creators. We caught up with Lead Community Engineer Charles Palmer, aka meheleventyone, to talk about what this means for the platform, and what the future holds.
Let’s start at the beginning! For the unacquainted, could you outline the basics of what Scripting is?
Scripting lets creators program new behavior for their games. In our case, as a web-first game engine, we went with a popular language that easily interfaces with JavaScript called TypeScript. We’re also using the editor engine behind the popular code editor VS Code which has some excellent features to help make programming easier.
These two combined means we can offer a powerful and intuitive way to make games in a browser, even whilst the game is running. This in turn lets you see how your code works in the game immediately, which is amazing to quickly put together new gameplay!
What does the arrival of Scripting mean for dot big bang creators?
Scripting is really one of the key pieces for any game engine without which you are extremely limited in what you can accomplish. So it’s a big thing for us to unlock the full creative potential of all the people who visit dot big bang daily. For our creators that means they can literally think things into existence in dot big bang… with a bit of telling the game engine what to do.
A big capability is just being able to see how our games are put together.
What are a couple of examples of how Scripting might be employed by creators to do things that weren’t possible before?
Our last update added a bunch of Template Toys into our editor. These let people build games through level design. With the release of scripting creators will now be able to build their own and mod the existing Toys. We’ve made this a core part of how we built the Toys.
Likewise, in the current update we’ve added two new starter-game templates, one of which is a small version of our FPS game. Creators will be able to use this game as the basis of their own FPS, changing how the weapons work and generally modifying the game to be what they want. Infernalviper – a creator who is part of our incubator program – has been doing this for quite some time, with some amazing results.
And what’s a sky’s-the-limit take on what creators could use Scripting for in dot big bang?
All of our games from the Hub World to Straits of Danger have been built by the Community Engineering team using the tools we’re releasing. So really, at the upper limit, creators can expect to be able to make very complex games. I’m personally looking forward to seeing some racing and life-sim games.
What are the qualities and advantages of TypeScript over comparable programming languages?
Originally our scripting system was based around JavaScript. This makes a lot of sense as we are web-first and there are enormous performance advantages in letting the browser optimize our code. But we found we struggled with the dynamic nature of the language. It was easy to make typos or mistakes and not find out about them until you ran your game. We also found the level of help our editor could give was extremely limited. It worked, but it was a much more frustrating experience, especially when trying to learn.
TypeScript helps with that as a natural extension of JavaScript. It works by compiling TypeScript code to JavaScript which is then run by the browser. This extra step adds static typing to JavaScript which means the editor has a much better chance of helping you out. In fact we can easily add inline documentation, and the autocomplete is excellent!
It also makes typos and other mistakes a thing of the past as the compiler will let you know when you make mistakes without having to run the code. It’s also allowed us to express things much more simply – for example, public properties on a script are those shown in the editor and we can use decorators to add descriptions, number ranges and so on to those elements. That would have been a big, ugly mess of handwritten awfulness before.
Are there any resources in the works for dot big bang creators who’d like to learn more about TypeScript?
Yup, docs.dotbigbang.com will take you to our creator documentation. This is quite barebones at the moment but we will be working on it continuously from now on. It has a number of articles explaining various parts of dot big bang, including more in-depth information about our scripting. It also contains our entire API documentation so you can see the capabilities of our engine at a glance. You can also find some video tutorials on our YouTube channel and chat with us on Discord.
And any existing resources you’d recommend on the internet?
TypeScript is a very popular language so there are loads of resources available to help you learn the language. A good jumping off point is the official website and the Playground there. We don’t use many complicated language features but it gives a nice overview and several different ways to learn the language.
Otherwise a lot of game development programming tutorials written for other engines apply pretty equally well to dot big bang. You can use the API reference to translate their types and functions to the dot big bang equivalents as you follow along.
How will dot big bang’s implementation of Scripting develop from here?
This is really just the beginning. Our most immediate goal is to bring more functionality to the editor so the full feature set of the engine is available to users. This will happen quite quickly over the next few months. However our scripting features are a long-term project we will be working on continuously from now on.
Scripting is part of a larger set of tools we’re building which support three levels of creator; beginners, skilled creators and experts. We want people to be happy using any of our tools, and also support moving between them easily.
For beginners we have our no-code game creation system: Template Toys where anyone can drag and drop fun toys into their world to make a game. We’re also going to be working hard to extend Template Toys to provide more scripting-like functionality through a set we’re thinking of calling Contraptions. For example, imagine hooking a button up to a door either by placing the button near the door or connecting the two together.
For skilled creators (who might have used Minecraft Redstone, or Scratch Blocks), we’ll offer block-based programming, as seen in projects like Scratch. This helps avoid syntax problems that come with learning a programming language, and lets creators concentrate on solving problems by clicking things into place, literally. As block programming is closer to our TypeScript scripting it means they’ll also learn a bit more about how things would be structured there. In-fact blocks can be converted to TypeScript so creators can preview and then move to TypeScript if they want to.
For experts making more complex games, graphical programming becomes very messy, which is where TypeScript comes into its own. Our TypeScript API will continue to evolve along with our engine. As we add new features we’ll expose them to our scripting system. We’ll also continue working on both our compiler extensions and code editor to support more helpful interactions and make scripting a first class part of our editor. This tight integration will also benefit the other levels of scripting as they all build on top of our TypeScript implementation.
Useful Links
See a scripting tutorial livestream video
Intro To Magic 101: Scripting Tutorial
API documents and scripting features overview
Join the dot big bang Discord