Pivot to Web-based Tech for Scripting in Project Hack
What's up, everybody? Welcome to another episode of the UI Buzz podcast. I'm your host as always, Peter Witham. You can find me in this podcast at peterwitham.com. This one, I am gonna talk about a bit of a pivot here on my Project Hack game.
Peter:Now it's a slight pivot on the game itself, but it's a major pivot on the technology, And that's what I'm gonna focus on in this one. In a future episode, I'll talk about changes and updates to the game and everything else. But I wanna focus on something here that surprised me and something that I never thought would be the direction I would go in. So let's get into the details. As many of you have been following me for a while, quite a long while in this case, Project Hack is a hacking game, and it's been a passion project of mine for many years.
Peter:And I work on it as I can, but I'm making it more of a focus now because I really wanna get something out there for everybody else to play. So over the years, I've used different technologies to try and make this game. But the core one that I always come back to is Unity, partly because I can code it up in c sharp, but also because I have some plugins and add ons, whatever you wanna call them, that helps me out with some of the things like the syncing to the cloud and all those kind of convenience features. Now interestingly, I decided to try something a little different, and this is one of those Sunday afternoon ideas that developers have where they say, hey. I wonder if I could do my project in some other technology.
Peter:And I decided, okay. You know what? I love playing these hacking games out there. There's quite a few of them if you're into that kind of thing. And I was wondering, how do they all do it?
Peter:Right? Because there's so many different styles and everything else. A lot of them you can spot. But one that always fascinated me was ones that allow you to write scripts to do some of the hacking in the game. And, yeah, I thought, okay.
Peter:I could probably spin up some kind of code editor and hacking script running engine thing in Unity and that, but that's a lot of hassle, and I really don't wanna get into that too much. I'm all about making the game and not an engine to then make the game, which is something I've spoken about in previous episodes if you go check those out. I looked at a few, and I thought, you know what? I know a lot of these allow you to use JavaScript to write the scripts in the game, to do various things, hacking, whatever purchases, whatever it may be. And so I thought, okay.
Peter:The clue there is the JavaScript part. So I sat down and worked through some ideas, and I'm not a big fan of vanilla JavaScript. Never have been, even from my web development years, But I do like TypeScript a lot more because I spend most of my time with typed languages, and I just personally, that's the way I like to go. So I sat down and started to figure this out. And it's one of those things where you're like, why did I never think of this before?
Peter:So I never thought in a million years I would be using my web development knowledge to make a game, And it's really paying off as far as how this worked out for me. So I'm gonna dive into the tech stack a bit here because that's what we do. Right? This is not starting over with a new idea. This is just building it a different way.
Peter:So I sat down and, okay, spun up a new empty folder, right, like you do, another one. And I'm using React as the UI framework because it's just super quick for me to spin stuff up with that. Right? I know you've all got opinions. Fine.
Peter:No problem with that. Whatever your opinion is, I respect that. But this enables me to spin the UI up again very quickly. I'm using TypeScript because it gives me type safe JavaScript, and it's something I'm familiar with. And, of course, I'm using HTML and CSS.
Peter:Again, web background for many years ago, very familiar with this. Right? So immediately, this gives me a stack that I can work with. I have never directly used Vyte, and I thought, okay. Hey.
Peter:Let's do it. So I'm using Vyte as a build tool and my dev server, if you like here. And then something I had never heard of, and if I pronounce this wrong, I am sure somebody will correct me, Zustand or Zustand, z u s t a n d, for state management. This is obviously massively critical for a game. Right?
Peter:That's what I'm doing, and that's my core stack, if you like, to get a little more into it. So it's React 18, ZooStand or Zustand four. For the code editor, I'm actually using what a lot of people apparently do, which is Visual Studio Code's editor, which is the Monaco editor, because that gives me all the functionality I need. And you as the player, right, you're a hacker. And if you're familiar with writing scripts, you'll have seen this, and it will be familiar to you.
Peter:Even if you don't use Visual Studio Code, doesn't matter. So many IDEs and everything else out there uses that under the hood now. It's gonna be familiar, and it gives me the functionality out of the box to do scripting and all of that kind of stuff without having to build which is key. Right? And then on top of that, I'm using something called d 3.
Peter:J s, which enables me to do a lot of the visual drawing for things like a very cool map. If you've not seen it, go to projecthack.net, and you'll see it there. A very cool sort of network server map type thing that I wanted, which would have taken me forever to build in Unity. So that was a big plus right there, and it works beautifully. I'm so thrilled with how that works.
Peter:And then, you know, that's really it. Right? So it's byte six, TypeScript 5.6. And then on top of that, I've got ESLint nine just for code checking. And then to compile it as a desktop application, I'm using something called Tori, and I'm actually using Tori two, which, again, is a new one to me.
Peter:And this enables me to build out for Mac, Windows, Linux to essentially a standalone. Right? Think of it as or or at least in my brain, what it is like Electron, but a different way of doing things. And nothing against Electron, but I was like, great. An opportunity to do and learn and expand my knowledge, which is always key to anything I do, is take away some new knowledge from it.
Peter:So that is the new stack for building the game, and it's working beautifully. It really is. Again, go to projecthack.net. I'm just thrilled with the way it's going, and I've got all the features that I wanna have in there from the previous version. They're not all active yet.
Peter:Again, things like boss fights, hacking servers, getting money, buying resources, all of that kind of stuff is all in there or going to be in there. And, of course, a key part of the game that I definitely wanna retain is this idea of the multiplayer, which, again, I'm still working through that one, but I've got basically the core of the game working. And I've also figured out a question that has always bugged me is why am I playing this game other than I love progressive games, and why would anyone else play it? I've always had an idea for a storyline in the game, and I'm starting to introduce that now and map that out as well. But key to this whole thing is you play the game the way you wanna play it.
Peter:And that is key because a lot of the way that I've designed the systems in the game enable you to achieve your goals and the end goals and progression, but in a style of your choosing. So up until now, it has been tap and click, buy resources, make decisions, and hack bosses, win the fights, and progress, and so on. That's all there. That's all there still. Some of it's not active yet, like I say, because I'm still building the new version, but that's all in there.
Peter:But key now is if you wanna, like, really embrace the hacker aspect of the game, you've got a terminal and a code editor. You can write scripts using JavaScript to access some APIs that I'm putting in the game to perform the tasks. Or if you want, you can do a combination of visual and scripting. However you wanna play this, I'm given the opportunity to do it that way, which I think, again, plays into the whole hacker aspect of the game. So I'm just really thrilled with the way this has come together over the last couple of weeks.
Peter:As of recording this podcast, it is actually up now on itch.io, and I'll put a link in the show notes. It is far from complete, and I make it very clear that it is a game in heavily in development as it has always been, but I felt it was in a place where I needed to start getting feedback on this new system. So I decided the only way to do that is to throw it to the Internet people and let them have their say. So because this is using web technologies, it makes it awfully easy for me to put it up on itch.io. As I had mentioned before on a blog post on projecthack.net, I had some problems with the Unity version and the Unity game services.
Peter:None of that matters because this just works. So I'll put a link. You can go play this in its current state, and I would love your feedback on it. There is a community board there and suggestions, but I think you're gonna enjoy it if this is your kind of game. If it's not, skip it.
Peter:Move on. But I am becoming very addicted to my own game, which is a good sign, a very good sign. Right? So I'm doing a lot of development there, but I really am just thrilled with this new pivot of adding these extra features as far as the scripting engine and everything else. And because you can play it as a standalone or in the web browser and that kind of thing, it makes it a lot more portable.
Peter:And I'm entertaining whether may maybe this is finally the one I pushed to Steam or anything. But at the moment, like I say, it's on itch.io, and you can actually play it over on projecthack.net once I implement it there as well. And so there is a video on there showing a lot of this new UI. Love to hear your feedback on it. I could probably ramble on for a lot longer about this, but I hope this has been enough to have you thinking that sometimes just going in a very different direction as far as how you build something can really open up the avenues that have been causing you problems, and you can just plow ahead.
Peter:And like I say, for me, this has been a way to bring in a lot of features that I just could not make work with the old UI that I had built and ways that you can work with the game in multiple styles now instead of just the one. It opens up this opportunity to put in the storyline and allows me to expand it a lot quicker than having to deal with some of the constraints that you have with game engines that are perhaps not necessarily designed out of the box without me doing a lot of work to build my own engine on top of the engine to do the thing. I've said this before. For me, it's all about, look. I wanna make the game.
Peter:I don't necessarily wanna spend a long time making an engine to then make the game. And this is helping me do that using technologies that I'm not necessarily familiar with on some of the aspects, but I know enough about the core technologies to be able to learn and get excited about this and rapidly progress it. That's it, folks. Again, I'll put a link in the show notes, but go to projecthack.net where this game lives and give it a go if it sounds like your kind of thing. It may not be, but I would love to hear from you.
Peter:You can reach out to me at Peter Whidom dot com. Share your thoughts. There's a contact form there. And, of course, over on that site, I've got all the links to all the appropriate social networks, everything else. If this has been of interest to you, hey.
Peter:Leave me a review. Let me know. I'd appreciate that. Share it with folks. I do still do my livestreams as well.
Peter:Drop by on that if you want. But for now, that's it. If you wanna go the extra mile, buy me a coffee. There's a link over on peterwitham.com. I try to keep adverts out of these podcast episodes, but there is obviously expenses.
Peter:And to all of you that have helped with buying me a coffee and things like that, just go to peterwitham.com/bmc. It has really helped, and thank you to all of you dedicated listeners and supporters. That's it, folks. See you in the next one.