this post was submitted on 03 Aug 2023
9 points (100.0% liked)

Programmer Humor

19544 readers
671 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 10 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

My favorite story about docs is when I tried implementing multithreaded Raycast in Unity.

I needed it to hit multiple targets per ray. Should be pretty easy, after all - there is this parameter right in the constructor:

maxHits: The maximum number of Colliders the ray can hit.

And this is how you use it, straight from the docs:

The result for a command at index N in the command buffer will be stored at index N * maxHits in the results buffer.

If maxHits is larger than the actual number of results for the command the result buffer will contain some invalid results which did not hit anything. The first invalid result is identified by the collider being null. The second and later invalid results are not written to by the raycast command so their colliders are not guaranteed to be null. When iterating over the results the loop should stop when the first invalid result is found.

Well, no. It's not working like that. I was always getting just a single hit, but sometimes, I received two or more hits. After a few days of debugging, I have found a typo in bubblesort, which caused the multiple hits, and I was in fact getting only one hit every time.

Strange, must be a bug then. And then I found it. A bug report from 3 years ago. But it was closed as solved. And the resolution?

I have some news about the issue where RaycastCommand will only return a maximum of 1 hit regardless what you set maxHits to.

According to our developers, each individual raycast in a batch only does a Raycast single in PhysX which will only return the first hit, and not multiple hits if the ray passes through several objects which would require a different raycast function. The documentation simply doesn't explain this very well.

The docs above are from 2021. Three years after this. The fuck "doesn't simply explain it very well"? It literally explains it pretty damn well.

But looks like they've finally changed the docs for 2022+ at least, it did happen few years ago.

[–] [email protected] 1 points 1 year ago (1 children)

Ah, reminds me trying to implement multiplayer just as there was some churn regarding unet/llapi/hlapi and every update something would break.

I just gave up. Add it to the failed projects list.

[–] [email protected] 1 points 1 year ago

We've once received an investor offer from a major studio for our game we are making since college in our free time, but the catch was that they wanted us to implement online multiplayer into a coop-only top-down shooter we've been actively making in our free time for the past 4 years at that point.

We ultimately rejected the offer, even though we managed to get a prototype working. MP is such a pain to implement in the first place, and adding it into an almost finished game is near impossible. But, if you ever resume the project you've scratched due to unet being awfull, I highly recommend checking out Mirror. It's free, open-source and has an amazing Discord community - every time I had an issue or needed help with something, there was someone willing to help me there.

[–] [email protected] 1 points 1 year ago (1 children)

Because things keep changing and no one ever updates any docs or guides.

[–] [email protected] 1 points 1 year ago (2 children)

It would be nice to have a kind of central hub where all the lastest resources are listed.
I could be updated by the community.

Well... one can dream.

[–] [email protected] 1 points 1 year ago

Someone should build a system that scrapes all open source repositories and uses an LLM to generate up to date documentation, and puts it in one big searchable place

[–] [email protected] 1 points 1 year ago (1 children)

If it's updated by the community, it's probably also created by the community. Instead of dreaming, why not create it?

[–] [email protected] 1 points 1 year ago

Stack Overflow tried that with their documentation project

[–] [email protected] 0 points 1 year ago (1 children)

I know some people don't have the choice but if you do, please choose something better. That garbage does not deserve your effort.

[–] [email protected] -1 points 1 year ago

It's not garbage, it just has some flaws - as does everything. The Spring and Java/JVM ecosystem can be a huge advantage if you know how to use it - which sometimes means diving into library code when docs aren't sufficient.