Writing A Language In a Game

Chig Beef - Mar 22 - - Dev Community

Intro

For the past while I've been busy developing a game I plan to sell. This game is called CompNerdSim and I've just added the most interesting update so far.

The Premise Of The Game

Before we get into the update, why do we need a language? Well, in the game, you write code to make money. With that money you get a plane ticket to travel and see your girlfriend (which is the win state). So if we're writing code to make money, I have to first create a language for people to code in.

Enter: Slither

No, it's not Python, it's Slither. To get started writing Slither, pull up BScode. Now that you have your favorite IDE open, let's take a look at Slither!

An if-else statement in Slither

Look at that if statement. Even an else? How great is that! We can print objects to the console using out, and clear the console at any point using clear. I know, you're pretty much sold already, but let me show you some more features first.

Looping

We all need ourselves a for loop, so, here's what they look like.

Finding the first 3 prime numbers in Slither

Wow, look at those prime numbers, and look at those for loops. Nesting even works, as you would hope. Everyone (except Python lovers) are probably also excited that true and false aren't capitalized!

Type Casting

Now what's the point of having types if I can't switch between them. Luckily for you, I've thought about this and have implemented it.

Type casting in Slither

So easy to use!

Future

Now, I know what type of people are probably reading this, and no, currently you are unable to write DOOM in this language, however, here are the future plans for Slither.

  • Functions
  • Structs
  • Pointers

Pointers is going to be fun, because depending on how I implement it, I could provide no safety, which would make the game very fun.

I also have graphics planned for the future. This means you'll be able to write games (DOOM?) in Slither, and have them show up on screen! Then you'll be able to sell these games in a future update.

But... Why?

I could've made any other game, why did I choose a game like this?
Simple, it makes me a better game developer, and better and language design. I also think that this game will be enjoyable to play, and educational. It will also give people another perspective on language design, and really make them question what good language design is.

If you want to keep track of this project, I'm going to sell it on Itch. The planned release date is in August, but if development goes fast enough, this could be sooner.
And if you want to support the project, give me your ideas! Does a part of the game look terrible visually? Or does a game mechanic not make sense? Make me know!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .