tags

bpseudopod's picture

my game is a huge hack

one of the things that scared me off of making games for the longest time was the existential horror of using a game engine. like either you code one yourself and get balls-deep in the nasty, unwashed hobo asshole that is the nitty-gritty of coding, or you take someone else's engine and you have to learn all the weird bullshit that I SWEAR IS GONNA MAKE THINGS SO MUCH EASIER. i read the docs and i still have no idea how anything in godot works, dont tell me that shit's beginner-friendly.

so anyways i flip-flopped between "im gonna learn my own engine!" and "im gonna use this bullshit engine!" for basically my entire life, making no progress on any endeavors

So eventually I gave up and decided I'd just make a virtual space in hypertext. It wasn't exactly a game, because you couldn't really interact with it, but HTML meant that, for what I was doing, I wouldn't have to either learn arcane secrets or reinvent the wheel. Then I did something silly but really important: I made it so that, every so often, you'd have to sleep, which'd redirect you to a page then you'd just click back to it. Here's the code that handles it. The "Cookies" object is from js.cookie, a simple javascript cookie library.
var stamina = 16;
...
sleepiness = Number(Cookies.get("sleepiness"));
if (sleepiness < stamina) {
Cookies.set("sleepiness", sleepiness + 1);
} else {
Cookies.set("sleepiness", 0);
document.location.assign("sleep.html");
}

This code was packaged in game.js, which was included in every HTML file, so it ran every time the player changed scene. This was when I started to realize that the web browser was secretly a game engine. The DOM is a really powerful UI library, I could use cookies to manage state, and if you include a javascript file in every page, you've created a game loop. Hypertext itself is in charge of loading/unloading assets and logic, and provides them with a convenient scope, and you can use cookies for transferring data between local and global scope. These technologies are already there without any added programming, and they're really easy to interface with.

ok so the end result is actually pretty fuckin basic but gimme a break will ya?? this is my first time making any game or any of html/css/javascript, so i'm pretty proud of it nonetheless so play it here

Syndicate content