Maybe it isn't so hard to make a game engine anymore
I just finished porting this game to web assembly with Web GL 3.0 as the renderer. I would have preferred not to, since the web is quite a bit more complicated than other native platforms.
But I just didn't have a choice. Most itch.io users bounce off a page if you can't play the game inside of web browser. The number that do is so large in comparison to the number of people who download games that browser-based play is simply impossible to ignore. If you want to validate a game idea early, you need it to run inside of a web browser.
For most developers, this is pretty simple. You go into Unity/Godot/Unreal and click a button that exports your game to WebGL. You take your compiled zipped thing, upload it, and you're done.
But my case is different. I make all of my games from scratch in a custom game engine that I've been using and reusing for years. The prospect wasn't so simple as that.
In my world, if you want to support another platform, you make what's called a platform layer. In practice, it's a thin piece of code that acts as a sort of bridge between your video game's cross-platform logic and all of the platform-specific apis you need to run your game in a given environment (for example Windows, Mac OS, or in this case several different web browsers which support WebGL and Web Assembly).
This time, for this particular platform, it took me a little under two weeks to create this new platform layer for the web.
I'm actually shocked it took as little time as it did. I think some of it comes down to experience, but I am increasingly of the view that moderate use of generative A.I. tools like ChatGPT has made more productive on whole, and I'd like to take some time to explore that.
Some of you might be aware that I've been a huge fan of the Handmade community since its inception, and if you are aware of some of that community's values, my use of A.I. tools might seem at odds with this online identity I've created for myself. After all, I am literally the guy who made a YouTube video on Why You Should Learn To Program The Hard Way. What am I saying? You should throw all of that out and start vibe coding to ship faster?
Certainly not, but I also can't ignore the obvious value that is right in front of me.
Over five years ago, back when I really got started making games, I had never written a platform layer for a video game. I had no idea what to do, how to structure any of it, what to call in what order, or how to work with graphics and sound libraries.
I was working from Mac OS, and there weren't any good reference materials. Nobody was trying to do what I was doing. The information was there, but it was scattered in a bunch of different forum posts and random messages between strangers.
I had to figure out all of it with very little help. The only real help I got was from watching Handmade Hero. I took the work Casey Muratori was doing and tried to find the same thing but on Mac OS. It was so much research, and I was often wrong.
It also didn't help that it was my first exposure to graphics programming. I didn't know how any of it worked or what any of the terms meant. I stumbled around and made many mistakes. Parts of the game would work, and I wouldn't understand why. I would do really weird things like declare a huge array of vertices and draw parts of it instead of using instanced rendering.
It took over two years for me to get some of my first game prototypes out to playtesters, and it would take a few more years for me to publish my first game on Steam.
Sure, I've gotten good, and I probably don't give myself enough credit. But I also think that had I been doing that work today with the tools we now have available to us, I likely wouldn't have taken as much time. I think I would have been stuck for shorter periods of time, and I would have been exposed to better ways of doing my work earlier.
On top of that, I think would have understood what I was doing faster than I did.
It took me two years to do my first platform layer for Mac OS. The one I just finished took me two weeks.
Why the dramatic difference? I think it comes down to the following.
- I already had clear working examples of platform layers I could draw from. This arguably is the no. 1 reason, and it far outweighs everything else.
- Chat GPT.
I won't go into the first reason since I'm guy who always argues that there is no substitue for real experience. This much is obvious. The second reason is a little more fitting of our time, so I will talk about that.
I use generative A.I. tools to help me in a variety of ways, and I have noticed myself getting stuck much less often and for shorter periods of time than I used to.
Let me clarify a few things first.
I'm not the type to ask the A.I. to go and build the engine or build some feature. I don't have an "agentic" workflow with a bunch of rules in a text file. Compared to many programmers today, my use of A.I. tools probably seems a little quaint.
99% of the time, I just have a web browser open with Chat GPT, and I ask it a series of questions related to whatever thing I'm trying to build. (I had the $20 subscription for a month but then cancelled it after the first month because I hate subscrpition-based products and I'm always buying and canceling as a small act of rebellion).
Usually if I'm working on the core of my games, I don't ask the A.I. any questions. I'll just build it from scratch in C-flavored C++. Since it's all my cross-platform code, and I don't need to talk to any apis, there is often very little research to be done.
However, when I'm doing something like platform layer work which has a lot of external apis that need to be glued together, Chat GPT is particularly useful. I use it instead of doing a Google Search (although now all Google Searches have some form of A.I. in them so the difference is vanishing as I write this).
When I ported my game to Web Assembly, I started by simply asking Chat GPT something like, "I have created a cross-platform video game in C++ which already works on Windows and Mac OS. How would you recommend I port my game to Web Assembly with WebGL as the renderer?"
There are a few key things in this question which, I believe, set me apart from a mere "vibe coder." I already know what I'm working with, which technologies I'm targeting, and why I'm doing my project. I was already exposed to Web Assembly and knew it would be a good choice to make my games run inside of a web browser. I think if I were a vibe coder, I wouldn't be in the communities which expose me to that kind of thing, and I probably would have asked a lower IQ question like "I need to make a web game. How do I do that?"
All of this is to say I think the utility of A.I. has as much to do with the intentions of the person using it as it does the tools themselves. If you approach the tools with a growth mindset and a desire to learn and improve your own skills, A.I. can help you do that. But if you just want a quick answer and don't particularly care to better yourself, it can also help you lazily make slop.
The choice is yours.No less than five years ago, when I found myself staring at some Open GL I didn't understand, I wouldn't have been able to ask a simple question like "what does GLTEXTURE0 mean?"
Now I know that's a silly question, but for a programmer, our contextual understanding of the system is built up from many answers to "small" questions like that. Knowing something as simple and stupid as GLTEXTURE0 can help me quickly figure out which parts to pay attention to and which parts to ignore.
Does ChatGPT always have the right answer? Of course not. As was the case when Wikipedia came on the scene a little over 20 years ago, it's wise to be skeptical of anything you read online.
That said, I cannot emphasise the sea change it makes when you at least have some kind of workable answer. Something, even if inaccurate and occasionally wrong, is often better than nothing.
With A.I. tools, I am finding myself grasping at straws less, stuck for shorter periods of time, and on the whole more productive than I was no less than five years ago. If I were to make some kind of prediction, I think we will see productivity increases similar to what we saw in the years right after the dot com bubble burst. It's only a good thing.
I also think this has some downstream consequences for game developers.
One interesting consequence is the possiblity that it might not be so hard to make a game engine anymore.
You used to have to know the right people, have access to the right mentorship, be far more dedicated, and have a willingness to search through an endless sea of obscure forum posts.
Now we live in a world where you can ask a question when you're stuck, and there's a decent chance the answer will help improve your understanding. We live in a world where, with some experience, you can port a game to a new platform in just a couple of weeks, and you don't have to abandon any of your principles to do it.
We used to say you should use a third party game engine because it will save you time. But if you can make your own in almost as much time (maybe a little more), that proposition may no longer hold. And with that goes the business model Unity and Unreal are built upon.
I was always of the view that we should use the A.I. tools to finally understand our codebases and reduce complexity, not to churn out more complicated slop.
As I said before, it all comes down to our intentions.
If we use the A.I. to cut through the nonsense and focus our projects like a laser beam, we can usher in a golden age of high performance software that outshines any previous generation. But if we use the A.I. to layer on more of the same needless abstractions and complicated frameworks, software will continue to get worse.
The choice is ours.Get Cave Factory
Cave Factory
Build a sprawling underground factory
| Status | Prototype |
| Author | Ted Bendixson |
| Genre | Simulation, Platformer |
| Tags | 2D, Automation, Crafting, Gravity, Physics, Pixel Art, Sandbox, Sci-fi, Singleplayer |
More posts
- Firefox Browser Bug Fixes2 days ago
- Web Build Available3 days ago
- Additional bug fixes15 days ago
- Patch 00116 days ago
- Prototype Version 00117 days ago
Leave a comment
Log in with itch.io to leave a comment.