Introduction:Back in February, Grav asked me if i had any memory watchlists or Lua scripts to share. Since I've been doing memory watching for a long time, I had plenty of useful addresses, but for whatever reason, no Lua scripts. I realized at that point just how useful such scripts can be and how much of the manual work I tend to do that could be automated. The programmer in me immediately started thinking up wild, crazy ideas for scripts, and one of the first things that came to my mind was a real-time map. One where you could see the location of Bond and every guard in the level, as well as their current state.
I knew enough about the games memory to pull that off, but I had never written a single line of Lua code before. Thankfully, it turned out to be a very simple language (I normally code in C++) to learn and it quickly became one of my favorite programming languages. It didn't take long before i had a working prototype ready. The first version took the shape of a minimap and was extremely simplistic. I realized that in order to make something that would actually be useful, I needed something more than just relative guard locations, I needed an actual map of the level.
The Goldeneye Setup Editor was a huge help at this point, since I would never have been able to find and extract the clipping data by myself. The export clipping to .obj feature was very convenient, and with a bit of pre-processing i could finally see a full blown pixel-perfect map of the levels! There was only one problem though... Performance. The map was ridiculously slow, as can be seen in this early sneak peek:
https://www.youtube.com/watch?v=E80LCF4RHWw I knew i had to optimize it somehow, and I had a pretty good idea about how to do it: Quadtrees. I didn't know if this would be enough, but after a bit of implementing of testing it became clear that Quadtrees was a lifesaver for the project. Drawing lots of lines on the screen was still fairly slow, especially on levels like Frigate, but still far better than the old version.
As the project went on, I kept coming up with new ideas that i wanted to implement. The prototype project turned into a full blown implementation with lots of files and thousands of lines of code. In May, I began to see the end of the project, and made a short list of stuff I wanted to fix before the first release. And last week, I finally reached the finish line...
Trailer:Not a valid vimeo URL
How to run:To run the script, follow these steps:
1. Get the latest version of BizHawk (tasvideos.org).
2. Get a Goldeneye rom file.
3. Clone the git repository OR download the zip file:
Git:
https://bitbucket.org/Wyst3r/bizhawkluaZip:
https://www.dropbox.com/s/mpg03gscqmma61c/BizHawkLua.zip?dl=04. Load Goldeneye in BizHawk, and go to Tools -> Lua console.
5. Go to Script -> Open Script, and open Map.lua from the root folder.
6. That's it!
Controls:To pan around the map, hold the left mouse button.
To select a target, click the left mouse button.
To switch camera mode, press M.
To switch floors, press F.
Known issues:There a few things I know about but either haven't gotten around to fixing yet or simply don't know how to fix. I'll make a list later. If you find any bugs/issues or have suggestions, feel free to post them here.
Future:There's still plenty of stuff that could be added to this (I have a long TODO list on my hard drive). I don't know yet if I'll continue working on it now or take a break (development has been quite intense these last few months, so probably the latter). I also have plenty of ideas for other scripts that would be interesting to create.
Reusability:The classes in the Data folder are very generic and could be reused for many other applications. If you wish to write your own Lua script for Goldeneye, they're a great place to start. Over time, my hope is that the gaps in the data can be filled in and we can have a somewhat complete toolkit for easily accessing Goldeneye data.
Bonus: Some funny stuff that happened randomly while messing around with memory addresses.
Other scripts:File Recorder -
https://forums.the-elite.net/index.php?topic=21141.msg437012#msg437012Lag-O-Meter -
https://forums.the-elite.net/index.php?topic=21141.msg450439#msg450439