Boxing Sim Game made in Excel
Our take
Hi everyone, I previously posted about my personal project to create a boxing sim game in Excel. Admittedly, my original post was a bit of a brain dump without providing much insight so I appreciate the reason for its removal.
I now have a file to share and play test:
https://drive.google.com/file/d/11fgPyhOUB4mfyxqAp7dfbhkqHc6_nKuV/view
Gameplay video:
https://www.youtube.com/watch?v=kXnUE70LbrQ
Mods - I hope this is OK now. Would it be possible to change the flair to 'Show and tell' please?
I would appreciate feedback on the speed it runs on your machines. I'm hoping that the text commentary does not generate too quickly or too slowly.
It took me around 2 months to create this project, working on it in the evenings. As a bit of a show and tell, to begin with, I would like to do a deep dive into one feature that I had difficulty problem solving early on. However, as the game progressed, the solution became more obvious. If there is interest, I'm happy to explain other elements.
Commentary system
I wanted to create some Football Manager style commentary that sort of felt natural and not too repetitive. Without this being implemented, I would have abandoned the project.
The first step was finding a way to make it obvious on screen, which boxer a line of commentary was referring to. I went about this by adding a shape for each boxer and applying corresponding colour fills and text colours. The colours would also need to be updated automatically each time a new set of boxers was selected in the Quick Fight mode. So my solution was to store the hexadecimal codes for each selected boxer in a table. VBA was then used to apply the colors.
There was something I didn't realise at first - VBA only understands RGB, not HEX, so this was converted in the code:
fillHex = ws_fight_calc.Range("F3").Value
If Left(fillHex, 1) = "#" Then
fillHex = Mid(fillHex, 2)
End If
r = CLng("&H" & Mid(fillHex, 1, 2))
g = CLng("&H" & Mid(fillHex, 3, 2))
b = CLng("&H" & Mid(fillHex, 5, 2))
shpCommentary.Fill.ForeColor.RGB = RGB(r, g, b)
In the extract above, the HEX code for one boxer is stored in cell F3 and it is simply coverted into RGB and applied to the shape.
The second step in the process was deciding when to surface the shapes on screen by changing each shape's .Visible property in VBA. This involved identifying which boxer is performing an action. To keep things simple, I generally set the 'active boxer' to be the one launching an attack. This is based on the results of a separate attack/defend series of interactions, which I won't go into the detail here, since the mechanism is quite lengthy.
The final step was to assign a line of text commentary to each action, which are the outcomes of each attack. For example: "Boxer 1 lands a jab", "Boxer 1 swings wildly and misses", "Boxer 1 throws a hook, but it's blocked", etc.
I've counted that in my game, there are 95 interaction outcomes in total. So at the very least, I needed 95 commentary lines. However, I tried to add variety by setting different lines depending on: (i) whether a punch was a counter attack by the defending boxer, (ii) thrown as part of a combination, (iii) thrown during the clinch mechanism, or (iv) thrown to deliver a knockout blow. In total, I ended up with 183 lines.
To add more variety, I also hardcoded some 'colour commentary' lines where the description being surfaced on screen as a follow up to the main action. Some examples are lines such as:
"Boxer 1 nails a six punch combination"
"Boxer 2 is in trouble"
"Boxer 2 is able to beat the count"
"The referee breaks up the clinch"
With these lines, I wish I had a scalable way of adding more variety. A few things I thought about but quickly dismissed included:
- Could I get Microsoft Copilot to help generate commentary lines? I'm not sure.
- Can I set more than one commentary line per action, and then randomly select a line using RANDBETWEEN? I think this is actually possible to do but I fear it would slow the game down massively.
- Is it possible to use text to speech to produce sports style audio commentary? From my research, I don't think this is possible at all because text to speech relies on the Windows voices and there is no way to alter the velocity of speech, making it sound exciting.
Finally, I implemented a couple of things to help make some actions more impactful or add tension. For example, using the Pause() function to set the time gap between commentary lines.
Also, you'll see that at certain points like a knockdown, a flashing text box is used. This was easy to implement - it was just a case of switching round the colour fill and text colour codes applied to the shape. The VBA code is just quickly alternating between the two sets of colour applications.
I hope that provided some good insight. Again, I'm happy to deep dive into other elements if there is interest.
In the Excel file, if you are interested in the game logic, I would recommend reviewing the following worksheets:
- 'Fight Engine' (this explains each interaction and provides most of the cell ranges that VBA reads and writes from).
- 'Fight Calcs' (this basically helps to drive the action seen on screen).
If you made it this far down, thank you for reading. This has really been a passion project. I'm not sure why I've spent so much time on this, maybe it's consolidating all of the things I've learned in Excel over the years. It feels like closure. I would say that in my day job, I'm starting to use VBA less and less. I find that there are easier ways to achieve things now, especially with Power Query.
[link] [comments]
Read on the original site
Open the publisher's page for the full experience
Related Articles
- A boxing sim I made in Excel - what I learnedI hope it's OK to share a personal project. Apologies that this is quite a long post but I feel the need to release some thoughts that only people with an interest in Excel would understand. A few weeks ago, another user made a post asking what everyone's biggest or proudest project was. Mine ended up being a boxing game that was still in its early stages. I have now hit the milestone of having an actual working game engine. It has been a lot of fun building this, but it's also taken me two months of hacking away in the evenings. Honestly, I feel a bit of burnout. Crazy to think that I've spent more time on this than any project I've taken on at work! Here is a gameplay demo: https://www.youtube.com/watch?v=xgM5LpYQUoU Driving all of this is of course, a lot of VBA, but also lots of tables, dynamic arrays, nested ifs, XLOOKUPS, and INDEX/MATCH. I'm not a gamedev at all, so my biggest mistake was keeping a lot of game logic in formulae. This is just what feels natural to me, but in hindsight, the correct thing to do was probably to create arrays in VBA where possible. I feel like I'm past the point of no return with this. INDEX/MATCH in particular was used a lot for strategy comparisons, by referring to lookup values on rows and columns. For example: the attacking and defending boxers have a given interaction, which compares one or more attributes - this assigns a base probability to each boxer winning that interaction. However, the probability can then be flexed by comparing say, the punch thrown vs the defender's guard style. Dynamic arrays were really useful for helping to combine the result of different attacks into one consolidated range, which I was then able to use for the in-game commentary system. Speaking of commentary, this was quite a laborious task because I created a unique code for each interaction outcome and then manually assigned descriptive words to each one. I did look into whether Copilot could be clever enough to generate descriptive commentary but I don't believe this is possible? For the visual elements like buttons, and bar charts - I spent a lot of time trying to make things look pretty when I was procrastinating. Actually, one of the elements that I'm most proud of is the 'momentum' meter that can be viewed at the bottom of the screen. This is linked to the knockdown system. It took me a while to work out how to create the momentum chart but I remember seeing something similar on those charts that people use to show swings between two different political opinions. Sound playback - I had some issue with the playback of one .wav file followed by another. For example, I needed to have crowd noise play immediately after the boxing bell ringing without any noticeable gap. From my research, I couldn't find a solution. In the end, I just asked ChatGPT to combine the files into one. And lastly, probably the elephant in the room - use of AI. I simply would not have been able to make this project a few years ago without the help of LLMs. The biggest gain was streamlining parts of my code. The first version of VBA code I wrote to simulate a round took twice as long as the cleaned up version because I was repeating a lot of steps. AI was used for the artwork of course. I'm slightly ashamed to do this but this is definitely just for fun and will never be a commercial project. That's pretty much all of my thoughts laid out for now! There are a lot more features (game modes, AI decision making) that I would like to work on but it's time to take a break. I feel terrible that the time I've spent in the evenings would usually have been used for CPD courses (I'm an accountant and need to catch up on my hours now). Thanks for reading if you got this far! submitted by /u/superplex100 [link] [comments]
- I spent months recreating Resident Evil in Excel (100% VBA) - 200+ hand-pixeled sheets and now 64-bit compatible!Hi everyone, I wanted to share a passion project I’ve been working on. I managed to build a full Resident Evil survival adventure inside Microsoft Excel using nothing but VBA (no external game engine). Technical Specs: 200+ hand-pixeled worksheets for the visuals. 100% VBA code (recently overhauled for 64-bit compatibility). Custom engine logic for movement and interactions. Since I can't post the video directly yet, you can see the Gameplay and my other Excel projects (like Lemmings) here: YouTube Gameplay: https://youtu.be/0zrv3ZrjCmg Playable on itch.io: https://cookiesoft.itch.io I'm a retro dev trying to push the absolute limits of what a spreadsheet can do. I'd love to hear your thoughts or answer any technical questions! submitted by /u/cookie_soft_57 [link] [comments]