Why I Made a Pseudo Game Engine with SvelteKit
Tags: svelte, opensource, webdev, gamedev
Published: 2023-08-14 07:22:37

Because I thought I could make a living with - Seat your belts and see how I deluded myself for a year and learned a great many lessons from it.

So my journey has started more than a year ago, around 2022 March. I had this million dollar idea to make a game out of rock paper scissors with extended rules. Like hitting the rock with scissors to create a spark and fire up a stack of paper to warm up and survive the night.

But then I thought, why keep this to only three objects? There is only so much you can do with rock paper and scissors. Then I got reminded that I have no talent or interest to draw every goddamn object in the world, but still wanted to extend the original trio to an orchestra. 

I needed an artist. 

Wait, on a second thought, maybe not.

I don't want to split the profits. 

Why not just borrow a set of established icons that everybody knows, uses and loves? You know what I'm talking about, the emojis! 🥳

I immediately started working on a prototype, since the graphics were just fancy "strings". (Though I changed them to [twemoji](https://github.com/twitter/twemoji) svgs later, nevermind.) The year long rabbit-hole of dedication, delusion and disillusion was begun.


## Emojistan 🏝️
Yeah, that's what I called it. Emojia or Emojiland didn't sound as cool imo. Anyways, back to the process.

We have already established that there is only so much you can do with rock paper and scissors. But there is SO MUCH you can do with emojis with variable skin colors and that's a problem. I am not going to brainstorm and write algebraic equations with emojis all day and write zero lines of code. Instead, I'm going to write shit tons of code and provide the players some tools to write their own equations instead.

And that's what I did for the next twelve months. Shitting code and creating a pseudo game engine with a javascript framework. I even created social media features like sharing your game, following people, liking people's games etc. If you are making a game you should also share it right? The answer is yes, but only if you are making a game in the first place. I'll come back to that later. Let me explain the core mechanic of the game (engine) first.

So Emojistan has three views, Map Editor, Rulebox Editor and Dialogue Editor.

## Map Editor
This is where you place emojis and color your map. There is also a test mode to playtest your game. There are 144 sections and 144 cells on each section, giving you a whopping 20.736 cells to color and populate in a single game!

{% embed https://youtu.be/FGM4xKRIFJM %}

{% embed https://youtu.be/y8yZh_ldbMM %}


## Rulebox Editor
Ruleboxes are the building blocks of Emojistan. They define relationships and behaviors between emojis. There are six different ruleboxes. You can see how they construct the game logic in the [tutorial](https://emojistan.app/tutorial/)

{% embed https://youtu.be/VCAMzouh69s %}


## Dialogue Editor
Well, nothing too fancy. Just a branching dialogue editor.

{% embed https://youtu.be/X8KeBDf708g %}

So with these tools you can define things like:

`🌬️ will push 🍃`

`If 👶 drinks 4 🍼s then it evolves to 🚶‍♂️`

`If 🚶‍♀️ interacts 🌲 3 times with 🪓, 🌲 dies and drops [wood]`

Sounds fun right? Well because it is! But not the playing part, the developing part. You see, even before starting this project, I said to myself "I'd never play this game". Yet somehow, I convinced myself that there would be people who would want to play it 🤦‍♂️

That's because the direction of my reasoning was reversed. I made the conclusion, and tried to find a reason later, or just made it up.

### Reversed Logic
Reasoning: People will play this game (pretentious, smug, how the fuck did you even come to that conclusion?)
Conclusion: I want to build it

### Straight Up Logic
Reasoning: I want to build it
Conclusion: I don't care if nobody plays, it should exist (existential, cool)

That's Lesson #1: **Find reasons first, conclude later. Or simply, always challenge your assumptions.**

I think this also explains why I kept going for a year without showing this to any potential players. I unconsciously violated the "fail early" principle, so that I could keep working on it. (Lesson #2 **Fail as early as possible**) I found architecting this moderately complex project fun and tricked myself into thinking that "I'm doing this for money" where in reality it is not monetizable at all!


## Why is it not monetizable?
Because it has no users. And it's also statistically impossible for it to have any users. Let me explain.

![Venn diagram, two elements. People who are into emojis and people who are into gamedev. There is no intersection.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tbqfk0u2a23c795u0e18.png)

For someone to be interested in Emojistan, they have to be in the intersection of these three circles. And the number of people who are in the intersection zone is zero. Don't believe me? Let's ask to the most reliable source of internet, reddit.

So there is this website called [subredditstats.com](https://subredditstats.com/). You enter a subreddit's name and it lists a bunch of subreddits along with the percentage of user overlap with the entered subreddit. Ranging from 100% to 1%.

When you go into [r/gamedev (1.2m) subreddit overlap](https://subredditstats.com/subreddit-user-overlaps/gamedev) and search for "emoji"

or

When you go into and [r/emojipasta (176k) subreddit overlap](https://subredditstats.com/subreddit-user-overlaps/emojipasta) and search for "game"

You get the same result. 

0/0.

No intersection.

And that's how you slam dunk yourself kids.

(That's lesson #3 btw. **Know your audience. They might not exist**)


## Going Open Source

Since I got convinced that I was creating a product for literally zero users and even creating a relational database for it (Shoutout to Supabase!) I thought it's time I face with reality and open source this project and write an article about it so that I can stop worrying about it's future. (Shoutout to Supabase again for inspiring me with [this article](https://supabase.com/blog/should-i-open-source-my-company))

I think this project is a nice playground for junior devs who want to learn SvelteKit + TypeScript. Since there isn't a roadmap for the project. They can just hop in, learn how to read other people's code, refactor it, add new features, detect and solve bugs, create new bugs and solve them as well. Since what makes us a better developer is solving problems we haven't seen before I think Emojistan can provide that ground for anyone.

Thanks for reading! You can check out the repo [here](https://github.com/KutayGuler/emojistan) and the deployed website [here](https://emojistan.app/)