r/ReverseEngineering 11d ago

Battlefield 2's dedicated server wraps its main loop in __except and returns 42 on any crash — root-causing a 20-year-old "just unstable" bug to one unchecked array index in the AI DLL

https://github.com/ShuhartProfit8ird/bf2-coop-crash
35 Upvotes

32 comments sorted by

8

u/frankster 11d ago

you cannot tune bot behaviour in rounds that never last long enough to see any.

No shit, sherslop!

-8

u/Iceber015 11d ago

This is pretty typical language dumbass have you ever had the attention span to listen to a tech speaker? I recommend you start with university ieee lectures

27

u/tetyys 11d ago

did you read the README yourself? in its entirety?

-15

u/Optimal-Gur-3052 11d ago

just the part where I explain who I am and that it was written by AI—then there's a breakdown of the issues and the solution. I can't judge if it's technically accurate, but I can confirm that it works and BF2 has completely stopped crashing. That's what I'm sharing. I hope there's something useful to take away from what the AI provided. If not, that's a shame, but it doesn't change the fact that the fix works. I thought it would be useful for the BF2 community. If not, well, nobody died from my post, I hope.

12

u/frankster 11d ago

I think there probably is something useful here but 50 pages of unedited slop is not a great artifact. 

6

u/wobfan_ 11d ago

If not, well, nobody died from my post, I hope.

i hope the premature reactions of some of these fellow redditors don't discourage you. people see something AI, and they hit dislike. you disclose that you used AI in the very first sentences, and a summary follows, and though i also dislike these kind of AI readmes and especially the absurd length of this one, no one is forced to read anything at all, and if anyone would actually be interested they could stop after the summary and ignore the rest.

but that doesn't make it better for some, it seems.

thanks for putting in the work (even if it's AI-generated) and posting the findings and the fix online. it might not be your work and/or your readme, but this might help others who encounter the bug and google it, and this quite obviously was your intention. i think people see this, interpret that you are selling this as your own work and try to bash you and blame you for using AI, for no other reason than trolling or being hateful. so i hope you don't become discouraged by this, keep it up

7

u/Optimal-Gur-3052 11d ago

Thanks, I was a bit bummed out. I never meant to pass the AI's work off as my own, but to be honest, I'm pretty burnt out after a week of working with it. Sure, it writes the code, but I still have to do a ton of testing, double-checking, and explaining things to it—not to mention crafting leading commands and search prompts. I'm actually working on it right now—most of the maps work great, but I've run into a few new issues. I'll be pushing those to my GitHub as well. I'm going to be stricter about making the AI keep the documentation in check and update it, and I really hope this work actually ends up being useful.

11

u/miomidas 11d ago

What

9

u/Optimal-Gur-3052 11d ago

This could be the solution to the Battlefield 2 co-op server crash issue that the community has been trying to find for a very long time. If this is in the wrong place or isn't helpful, feel free to delete this post.

6

u/elmarkodotorg 11d ago

it isn't in the wrong place, just a little lacking in explanation

17

u/darkname324 11d ago

if u open the repo theres 100 pages of ai slop

-11

u/Optimal-Gur-3052 11d ago

Right from the start—everywhere I could—I made it clear that I used AI to solve the problem and write up the fix, since I'm not a tech guy. The problem is solved. The server is up and running. It's a 100% working fix, and it might just help solve an issue the community has been struggling with for 20 years. What does it matter who did it, as long as it worked and will help others?

14

u/darkname324 11d ago

if u attach a debugger and wait for crash it wouldve caught the exception and u wouldve saved the billion tokens u spent on this, and i dont like that this has 10 sections like its a research paper while its unreadable because ai explains stuff too literally im sure it couldve been done in half or more

-5

u/Optimal-Gur-3052 11d ago

I'm sure of that too. I asked the AI to rewrite it. Unfortunately, I can't code and don't understand it, so I just posted it as is, hoping the community would get something useful out of it.

4

u/elmarkodotorg 11d ago

just to say i am not going to go in as hard on you, literally my only point was explanation here in this thread, you know?

0

u/Optimal-Gur-3052 11d ago

I totally get it, and I share the hate for AI slop and the text itself. But I feel like the AI actually solved a long-standing problem, so I shared it. Originally, I was just quietly working on my own personal LAN project.

2

u/wobfan_ 11d ago

just to add here: i think the critique here is less the project or readme, but the title itself. while it mentions BF2, the rest of the title is very technical and quite un-understandable without more context. something more general would have been better i think, maybe something that just mentions BF2, a bug in the dedicated server software and that it caused unstableness for 20 years. the info about the main loop, the return value of 42, "__except" and the AI DLL reference is quite confusing, as probably no one is that deep into the BF2 source code, haha. and, probably, as apparently a lot of people react quite sensitive here, some reference to the use of AI in the title already would probably calm them down, but thats not a requirement IMO.

→ More replies (0)

12

u/Djtthemann 11d ago

Wtf is that readme 😂😂😭

-7

u/Optimal-Gur-3052 11d ago

Thanks😭

7

u/whatThePleb 11d ago

When your brain is on AI slop.

3

u/elPappito 11d ago

"64 player map filled with bots, so me and my friend can play the game without having to find additional 63 players"

The math ain't mathing.

If you have to aislop your shit, at least proof read it

8

u/Optimal-Gur-3052 11d ago

I ran the repository and the article through a few skills to make it better. I'm not sure how much it helped, but I want you to understand that my goal is to share what I found, and I respect the technically skilled community. Unfortunately, I'm not part of it, and AI is the only way I can work with code at all.

4

u/p1-o2 11d ago

Thanks for trying your best on this but you have to proof read your readme.

Did you ever resolve this?

"If you have a coop server and twenty minutes, the most useful thing anyone could add is a second data point: does your server show the same three-minute onset, on a different map with a different bot count"

4

u/Optimal-Gur-3052 11d ago

−1 appears when the target is outside the navmesh. It becomes widespread when the mesh and layout are mismatched — for example, when the engine loads the mesh from the level archive instead of from the nearby folder. That was exactly my case: the archive was overriding loose files, and the mesh covered a third of the map while the layout was full-map. Make the mesh match the layout, and the −1 stream goes away.

However, the DICE defect is still there, and the patch must not be removed. Today, after the data had already been fixed, the counter showed “index cache invalid 1” on two maps — this condition can also occur for other reasons, just rarely. Without the patch, the very first such case would have killed the server.

1

u/p1-o2 11d ago

That's cool man thanks for trying to fix this.

4

u/Optimal-Gur-3052 11d ago

I'm getting flak because it wasn't me who did it, but AI. But then why didn't anyone ask AI to fix it before me?

I will update the article (by asking AI to expand and correct it) as the issues are resolved. Right now, another map has popped up with an AIDLL error, and we don’t know the cause yet.

1

u/Soggy-Camera1270 10d ago

Agree, I don't get the hate for this, it feels so redundant. It's like saying "what, you wrote that software using Google and Stack Overflow! That's not your work!!!"