Building Age of Empires 2 in React

Rate this content
Bookmark

How better to learn about the capabilities of a technology than to do something it was expressly not designed for? What can we learn about the square peg as we mercilessly shove it into the triangular hole? In an attempt to rebuild Age of Empires 2 using React we'll learn about the limitations and possibilities of the tool we use everyday.

This talk has been presented at React Advanced Conference 2022, check out the latest edition of this React Conference.

FAQ

Joe used CSS for the isometric transformation of a grid layout. He employed CSS variables and transformations to create the effect.

Joe utilized React's state management and event handling to control unit movements and interactions, adding complexity with React reducers and handlers for mouse events.

Joe intentionally used only JavaScript and React with DOM elements for rendering, which added complexity and was described as a 'painful' approach to learn more about the tool's capabilities.

Joe has created a variety of projects, including 'Katamari Node Modules', a game where players roll a node modules folder to collect NPM packages.

Joe can be contacted through his Twitter handle @joeheart, his website joeheart.co.uk, or via email at joeheart.dev.

Joe is a web engineer consultant with previous work experience at the BBC, Monzo, and Lego. He specializes in React and front-end engineering.

Joe aimed to include rendering an isometric battlefield, scrolling around the battlefield, and basic unit interactions like selecting and moving units.

The project began as a playful idea during a work discussion about graphing libraries, leading to a suggestion to submit a talk proposal on this topic at React Advanced.

Joe Hart
Joe Hart
22 min
24 Oct, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This Talk discusses the process of recreating Age of Empires II in React. The speaker shares their inspiration for the project and explores different approaches to game development using React. They demonstrate how to create an isometric grid, enable scrolling, and render units. The Talk also covers handling unit clicks and implementing right-click movement, as well as techniques for making React render more consistently. The speaker concludes by highlighting the value of exploring different tools and approaches in software development.

1. Introduction to Age of Empires II in React

Short description:

Welcome to recreating Age of Empires II in React. I'm Joe, a web engineer consultant with experience in React and front-end development. I also enjoy stand-up comedy and creating video games. Check out my Twitter and homepage for more details.

♪♪ Hello, and welcome to recreating Age of Empires II in React or the other subtitle. Why do I keep doing this to myself? If you're wondering who myself is, hello. Hi, I'm Joe. I'm a web engineer consultant. I previously worked for places like the BBC, Monzo, Lego, doing all manner of React and front-end things for people.

Nowadays, I shop my skills around for anything view-related, React-related, or general web stuff. And as well as doing web engineering, I also do many, many silly things in my spare time, including stand-up comedy. I also make silly video games, and indeed combine them where I do stand-up comedy where we play silly video games as well. If you want to see some more details about that, you can check out my Twitter at joeheart, or you can go to my lovely homepage, joeheart.co.uk. I spend a lot of time styling it. Please let me know what you think of those styles when you have a look at it. And if you ever want to e-mail me for any reason to tell me how much you didn't like this talk, please drop me an e-mail at joeheart.dev.

2. Setting the Context: Katamari Node Modules

Short description:

One of my favorite games I ever made for a developer event called Smush back in the day was called Katamari Node Modules, which is a version of Katamari Damacy. It's a little video game where you play a little node modules folder and you roll around the world. The aim of the game is to get as large as possible.

Now to set the context of where this talk is going, I thought it would be good to talk about an example of the kind of things I've done in the past. One of my favorite games I ever made for a developer event called Smush back in the day was called Katamari Node Modules, which is a version of Katamari Damacy, which if you've played that, you'll know where this is going where it's a little video game where you play a little node modules folder and you roll around the world. And as you do, and as you hit into things, things stick onto you. And the aim of the game is to get as large as possible. So to roll around this little world where all the objects in it represent NPM packages of various sizes, you want to get the largest NPM packages as possible and just bloat yourself as much as you can, much like our real Node Modules folders do on our dev machines every single day. So that's the kind of set the context a little bit.