#programmers-off-topic
1 messages · Page 7 of 1
a good one
if (building.GetData() is { } data)
I laugh because it's funny, and then cry because it's true
I've actually got a worse one that really hurts. We are rebuilding a lot of functionality in the cash registers to be available via api to use elsewhere... We've been given the requirement for the api to always return the exact same answer as the cash register.
It's happened quite a few times now that we realized that the cash registers were doing something wrong, so we report and then get told it's been accepted to work this (broken) way and that we should build the new service to also do exactly that
Elegant. Pattern matching master race.
I do a lot of is { } because that's what my IDE tells me to do
we've had to essentially intentionally add bugs to our api because else it wouldn't be the same as the cash registers...
i don't think i've ever actually checked for anything in that { }
I did at one point, but found it less readable than splitting things out
i wish i could do:
void Method(int? n)
{
if (n is not { } n)
return;
}
basically shadowing n
Here's a real piece of code in my mod where I'm using pattern matching for more than a null check:
if (!this.isActive.Value
|| e.Button is not (SButton.MouseLeft or SButton.MouseRight or SButton.ControllerA or SButton.ControllerB)
|| this.holding.Value is not null
|| this.itemGrabMenuManager.CurrentMenu?.chestColorPicker is not
{
itemToDrawColored: Chest chest,
} colorPicker
|| this.itemGrabMenuManager.Top.Container is not ChestContainer container)
{
return;
}
It's more like a null check in a null check
oh god that looks ugly
Oh I found a really good one, you'll hate it. Real code:
inventoryMenu = Game1.activeClickableMenu switch
{
ItemGrabMenu
{
inventory:
{ } inventory,
} when inventory.isWithinBounds(mouseX, mouseY) => inventory,
ItemGrabMenu
{
ItemsToGrabMenu:
{ } itemsToGrabMenu,
} when itemsToGrabMenu.isWithinBounds(mouseX, mouseY) => itemsToGrabMenu,
GameMenu gameMenu when gameMenu.GetCurrentPage() is InventoryPage
{
inventory:
{ } inventoryPage,
} => inventoryPage,
_ => null,
};
To find the menu that the cursor is hovering over
goodbye
SMAPI Talk: Now that we have DataLoader to simplify loading things with the right types, it'd be neat if the AssetRequestedEvent had a similar thing for .Edit().
Like currently you can do .AsDictionary<>, .AsMap, and .AsImage but maybe toss in some extension methods for specific types?
"How to lose what respect anyone had for you in under 2 seconds"
what is this cursed code
Like instead of .AsDictionary<string, ShopData>() an extension method for .AsShopData()
Hey, cursed code that works is still working code. This is why my mods are MIT licensed, because no one in their right mind would actually want to fork my code.
honestly better formatting could save this code and make it look pretty ok
I don't format my code, I use analyzers and reformatting tools to do it for me
I wanna have a talk with your formatters
you're right
I don't even agree with all the formatting rules, but it lets me forgo the responsibilities
Like, whatever you say JetBrains + StyleCop. You're right.
I just want to write code and not worry about formatting, documentation, or good git commit messages
that is an abuse of power
I don't hate this
Two types of people in this world
!god
I don’t really hate it too much either, I’m just tired. Spent my day trying to override the font in Cobalt Core with a more compact edit I made of the one it normally uses, trying to give it all kerning data… only to realize it completely ignores kerning :|
Ah, keming
More like, EXHAUS T
oh no
.g cobalt core
Cobalt Core is a sci-fi roguelike deckbuilder with a unique single-axis combat system that will throw you for a loop. Many loops! Give orders to your crew by playing cards: Will you raise shields to protect your ship, dodge incoming missiles and cannon fire to avoid damage outright, or strike preemptively to disable your enemy’s weapons? Outmane...
$19.99
2042
94
does cobalt core actually have furries in it or is that just creative license on the title card?
I hope it’s gonna help some modders, but nothing can save this card, it won’t fit: before and after
that is.... a lot of text to cram into such a small space
The playable characters are animal-based, yes
hell yeah
text rendering. One of the oldest things in all of game development yet it's still a pain in the ass even now
I’d drink to that, but I gotta sleep
sleep sounds good
I've had to do some dynamic font scaling a few times for primarily winforms stuff and it gets pretty nasty
I joke the reason why I don't get PRs is my code is bad and the mods unfun
one of several reasons I used monospace fonts for games for so long. and also one of the reasons I love godot
When the real reason is probably my repo is cursed and involves submodules
False your mods are fun!!
my problem with PRs is that I'll knock out the feature in a few hours and then spend like a week worrying whether or not the code is good enough to put in someone else's repository. and then I never PR it
monospace fonts make life a lot easier it's true
Meanwhile I've sent Pathos two separate half coherent PRs
open source woes. At work my PRs are gonna get accepted cause the deadline was 3 weeks ago even though we didn't even get the item till the week before
(The AssetName one, aka "it's totally obvious a hardware engineer wrote this since there is a truth table in here " and interpolated strinf handler, where the code worked but I apparently got sidetracked while documenting and didn't notice)
I was going to do a PR for... range highlight? data layers? whichever of those is a pathos mod. to add support for the modified range option on better beehouses, but I ran into this weird problem where it got exponentially slower as range increased, and beyond a few tiles over the vanilla range, the game would just slow to a crawl
Data layers
I suspect it was somehow due to the way it does rendering but I could never figure out where the lag was actually coming from, so I just abandoned it
I relate to this so hard. There was a period of time when I straight up forgot to put what issue I was even fixing in the PR message
which reminds me, at some point I need to make a test mod for that spacecore custom tools PR I was gonna do
(Taking self documenting code to the next level!)
Oh free enchiladas!
(Will this be the year I fix the word wrapping bugs in Almanac? Spoiler: No )
What you describe as bugs, I call unintentional/unwanted features
Happy little accidents
I'm glad I will probably never have to think about word wrapping or internationalization again
never say never
When suddenly...
"Atra, you are our only hope. The fate of the world depends on you fixing this word wrapping internationalization issue"
Yeah we're all dying sorry
YouTube keeps advertising this ui/ux game dev course to me
Which
You know
Is about as far from what I like to do and what I'm good at as possible without evolving into modern art
love ads for things I would definitely never do anything with
Or how about ads that you did one search and suddenly Google thinks it's your entire personality
Actually the ones that really get me are me physically visiting a store, never do a search, but suddenly seeing ads for things in the store
when you let a single family guy video autoplay by accident
"you must love family guy here's 300 clips and also south park"
Hey atra wanna fix my word wrapping code?
tbh I go down YouTube rabbit holes frequently for enthusiasts for product types I would never do anything with so I give off mixed signals
I did a search for what turned out to be an air purifier like four years ago cause I didn't know what it was, and Google still advertises them to me
You're the legendary UI expert around here!
I literally bought boots from a store, and started seeing Boots ads on social media
I'm just a dumb EE
Tracking is extra creepy
I get recommendations for note-taking eink tablets despite never taking notes (I used like 6 pages of a single notebook in 4 years of university)
Reading the fancy words about Hash Sets. “The HashSet<T> is an unordered collection of unique items. No order is maintained.” This somehow fits me perfectly!!!
I am a hash set of useless video game trivia and programming.
My bedroom is sadly a hashset too
an unordered collection where no order is maintained
techincally hashsets have an order to them, it's just not an order that you would expect for anything
iterating a hashset twice will produce the same order
Omw to implement a hashset that iterates by randomly generating which element to return
HashSets only have an order as a detail of the implementation.
Anyone use GLFW?
I do!
I've written GLFW based applets in C & C++, with OpenGL
nice!
Vulkan is interesting but unsupported on some of my test machines
What do you think about C vs C++?
True, though it actually is more supported than I though
back to GTX 960s
Mhmm, it's less the hardware support and more the fact that OpenGL, though deprecated, still works seamlessly on MacOS
As for C vs C++
My thing is that I don't need most of the C++ feature set, & C works better for my tooling, so I prefer C
It's blazing fast to compile, so I use it where possible
Game engine development, primarily
hat does tooling mean also? Sorry I'm not very knowledgable
That is my main long term goal
to build a framework for desktop apps
Ah sure, yeah I have some in-house tools to track down memory leaks and other resource allocation leaks, and C just fits those tools better
It's severely limiting syntactically, and very verbose
ah yea
I think in general, modern C++ is safer & easier to develop than C, with a better standard library
However, if you make a mistake in C++, it can be much harder to track down
C is faster to compile, but between C & C++, execution time differences are negligible
I need to go back and debug one of my older projects
c# is life :[
That boils down to compiler implementation
:p
C# is quite popular
I wanted to build LLVM but I think I have a tad too little RAM
but anyhow I settled on MSVC for now
I write a lot of C# now thanks to Stardew, but at heart I'm still a C developer
MSVC is good, though written mostly as a C++ compiler from my experience with it
It's also been slower in compile times and worse at auto vectorizing than GCC or clang
I use MSVC on Windows, and GCC or clang on Linux & MacOS
There's some differences between GCC & clang but nothing that I've really had to deal with so far
tbh I have a negative association with GCC
I don't really like the GNU type licensing
I feel like the freedom requirements get too restrictive
My project is meant to be easily compiled on Debian/Ubuntu, MacOS 1.15+, and Windows 10+, so I try to avoid using compiler specific extensions in my own code
Yeah, I usually use the pre built binaries on Windows, and build from source on MacOS & Ubuntu
noice
I don't like the Python indent syntax also
semi colons seem sketchy at first but actually work really well
I'm generally fine with most language's syntax choices
I really appreciate Python's simplicity
If you aren't dealing with it's package management/dependency hell, it's a great for quick little scripts for bootstrapping a dev environment
What do you make of the new "next gen" languages?
The ones that are suppost to be super fast and simple
ah yes
downloading 20 tools to do one task lol
development
I don't care much for simplicity of development personally, but it's very valuable for any larger scale project with multiple people working on them
yea
Reading anyone's C code can be a nightmare, especially with how much C developers tend to use code generators or preprocessor tricks
True
I like C because it forces me to reinvent the wheel a lot, which is good for generally understanding how things are implemented. That said, I don't think that's valuable for most kinds of development tasks
For most, I'd say understanding when to use a hash table is more important than knowing how it works
So I think C++ is a good middle ground
But I'd almost recommend using Rust at that point, because it would encourage better habits imo
As a rookie programmer I need to find out how to get around if loops
Huh
Yea habits are a big thing
It's more that C++ & its compilers let you make many mistakes without complaining
People describe C & C++ code as "eager to compile"
Even if you use static checkers, sanitizers, and constrain the subset of the language you use, it's just not as safe as something like Rust
It teaches better habits because that's the whole design philosophy of the language
how does rust translate to game development?
Eh
or reverse engineering
I think a common theme is: C++ is better if you know how to use it but, it’s harder to know how to use than Rust
I don't think C++ is better in any capacity imo
That's not me saying Rust is better either
It's just that no developer is perfect, even experienced C++ developers make common mistakes, and there's no safeguards for it
True that is a big flaw
C++'s greatest strength is also it's greatest weakness
Code written decades ago will just work
But as a result, new code has to deliberately forgo language features that exist solely to support legacy code
Sometimes it’s just better to start anew, I bet Windows is almost spaghetti code rn
Windows is known to be spaghetti code, yeah
Explains why explorer crashed so often
I don't remember where I heard this, but it has something like 5 million lines of code in the codebase that no one understands
Anyhow, I really gotta go to bed, peace
that's crazy lol
Those notes that the one guy 30 years ago wrote:
Imagine they just delete it to see what happens
Slight tangent but Windows having such a chokehold on the gaming industry is one of biggest frustrations
In any case, my overall point is, never consider one language better than another
They all have their use cases
It’s practically a monopoly, really annoying cause I don’t want to use it but pretty much have to
I genuinely hope that Steam Deck can weaken the standing of Windows as the de facto gaming OS
I know MacOS is "trying" with having stuff like GPT (Game Porting Toolkit, stupid to reuse that acronym, I know)
But until they start trying to actively support Vulkan instead of locking developers into Metal, it's a hard ask to expect devs to actually work on a MacOS port
Also actively deprecating the later, more useful versions of OpenGL is such a tragedy
Microsoft seems to be trying to smush out OpenGL just a bit
The AZDO (approaching zero driver overhead) techniques for OpenGL are mostly 4.0+ features that are deprecated in MacOS
Playing on Linux is pretty easy nowadays with Steam's Proton
And those features actually make it potentially viable versus other graphics APIs
True, though it doesn’t always work right
Yeah, I think a lot of players will even use Proton version instead of the native Linux version because sometimes it just works better
I rarely have issues with games, and when I have, it's mostly new releases for which the community is actively finding solutions
How good is performance?
I had to do this for CIV6 : the Linux native version hasn't been updated since 2019 or something like this, making it impossible to play online
Not quite native, but pretty good tbh
I'd say better than Windows but my laptop is pretty old, I could barely run The Thalos Principle 2 last year (mainly because my computer doesn't support advanced graphics anyway)
Running via Proton beats a poorly coded native version anyday though
The hardest part for me was to install Nvidia drivers, but I've heard that I was on the hardest distribution of Linux to do so : Fedora
Ah yeah that makes sense
Unpopular opinion but Nvidis is just a horrible company
yup, but I kinda learnt about that 2 years after getting my laptop
If it's good hardware, it's good hardware
Valid
Anyhow this time I really gotta go to bed
GPU makers doing everything in their power to make it impossible to make open-source drivers sucks
Night!
Facts
it usually is honestly
I don't think that's an unpopular opinion
people like Nvidia gpus but I don't think there's many people who know about Nvidia as a company and like them still
the binding of Isaac had native Linux versions for every dlc except suddenly the last one
proton has been a double-edged sword. It's making it possible to play significantly more games on Linux than before, but it also makes it far less interesting to a developer to make a native Linux build
a lot of indie devs want their game to work well on the steam deck specifically though so they still tend to put some effort into making sure it runs smoothly even if that's through proton
A double-edged sword is a good way to put it. It allows for a more "write once, run anywhere" type of workflow which is incredibly convenient (especially for indie devs on shoestring budgets), but it ultimately incentivizes writing games that target Proton (and by extension, Windows)
Hi Atra!
Did you see I've become a Rust shill
everyone becomes a rust shill eventually
I have touched Rust only once, so maybe it really is just a grass is greener on the other side type thing
it's some pretty green grass tbh but it definitely does have issues too
a big flaw it currently has compared to C/C++ is a lack of a stable ABI
A stable ABI is both the strength & weakness of C/C++
There's no better tool for the job as it is now imo
performance wise I think your choice of programming language is honestly not as important as people make it out to be. Most of the times when I've seen significant performance issues in an application it was a flaw with how the code was written and not the language
Hi!
it's rare for an application to run into the limits of the language itself performance wise
I'd say the biggest exception to that is Python
How are you doing?
ok yeah the performance approach python has gone with is "do it in C instead"
I remember translating a Python script almost line-by-line into C++, where it was several orders of magnitudes faster
(It was a pre-processing script for my codebase, where in Python it would take maybe 5 seconds, while in C++ it's milliseconds)
pretty much any performance conscious library in python is written in C/C++
Eh, you can say the language is less of a problem but the c# compiler does not have the time to do a good job and it's obvious ReadOnlySpan and friends are latecomers to the language and don't fit nicely
To me choosing between the languages is mostly about choosing between the tooling available
it can definitely cause performance to get worse still yeah, still gotta pick the right language for the job
(This is (secondarily) #lost-rustaceans, after all!)
Then again I've been in Cursed land lately
Will continue being in cursed land
And won't cease to be in cursed land for a while
C# (and similiarly, Java) run fast enough at this point that I'd have trouble coming up with a good reason to pick C/C++ if the comparison point is performance on a modern PC
Even verilog would be preferable to labview
What repeatedly impresses me about Python is the startup time for things written in it. Which makes sense, and yet somehow feels a little counter-intuitive?
C# is a language with a high performance ceiling but also full of performance footguns that you don't even know are happening
Very fair
C# is a language with a high performance ceiling that also just fjckinf feels like writing c++ when you're trying to hit it tbh
it's not ergonomic to write in any case
The main thing I appreciate about C# is reflection
Newer C++ standards are proposing a form of static reflection
That is very nice yes
rust I think is nice partially just because normal comfortable code written in rust is still actually very performant and often enough trying to outsmart the compiler is just not happening unless you really know what you're doing
Right, Rust is a language where I almost absolutely trust that the compiler is smarter than I am
And more correct than I am
Between Java and C# I think I'll always choose C# though
I've never used Java so that's entirely true for me too!
Hahaha yeah
My biggest qualm with it is the lack of operator overloading
Although I've been meaning to (a) learn zig and (b) do more Haskell
Haskell as a replacement for verilog mind
Say what you will about operator overloading, but saying
v1 = v1.Multiply(v2)
just isn't as nice as
v1 *= v2
haskell is neat but then also a language I would never choose for any project ever
it's interesting to see what kind of madness they're up to trying to turn their type system into a programming language of its own
(I'm looking at it in the small world of as a verilog replacement)
Interesting
considering I don't even know what verilog is I will trust you on that
See: Haskell Clash
(Also I'm doing well & ate a lot of sashimi and can't sleep bc im so full)
nice
zig might be interesting to give a shot but I feel like I should actually try C++/C cause I've never used them
it's for programming FPGAs
Very different languages, C & C++, in this day and age
ah hardware stuff then
I'd almost never recommend C unless it's really needed, since it's (practically) a subset of C++
Not entirely true, but there is a substantial overlap between code written in C, and code that will compile correctly with a C++ compiler
Also don't get me wrong I like c# perfectly fine! It's better than java!
But I've noticed it is like....really not ergonomic when you are going for performance
Not that I dislike JavaScript, but it really isn't the right tool for... so many of the things it's actually used for
I doubt I'd choose to use the languages for any real project but there's probably still value in trying C++ to at least see what it's about and what all these newer languages are attempting to replace
Hey, Myuu, I'm in python land with badly typed libraries interacting with LabVIEW at the moment
Pretty sure a hammer to the foot is less painful
I do dislike Javascript i don't have many good words to say about it
As Elizabeth pointed out, the foot has way too many nerve endings for me to wish a hammer to the foot on my worst enemy
I have to disagree with that one
You say that but I have no ide support for something as simple as "who mutates this global?"
(In LabVIEW)
don't ask for so much smh
Fair enough, one thing I really appreciated with VS was being able to see all references to a method/variable
mutating global variables is bad enough as it is for code maintainability, if you can't even check where it's mutated easily I think I'd cry
It makes the whole "what the heck is this code doing" a lot more convenient
Yeah, and I get that in my python too. It's weaker than VS and sometimes misfires but it mostly works well
In LabView I can't even throw my hands up and grep for shit
On the real I still edit any code with Sublime Text & no extensions
VSCodium exists!
our visual basic winforms thing has like over 100 global booleans that are like "handlingPayment" or any other possible state one might express.
A lot of methods have if statements that check like 5+ of them to know what to do
global variables 
it's a disaster that's what it is
making any change to any of these booleans feels like you're jumping into a moat unsure if there's alligators
I get that
Yeahhhhh
During 1.6 development, there was this odd bug where, upon reconnecting to the host after disconnecting while in the mines, ||Calico Statue|| effects would trigger
it's often incredibly unclear what many of these booleans actually do. They always start simple but then over the decade they got more specific or get weird niche cases where they're ignored or enabled to fix some random other bug...
Myuu of course knows that, Furniture.drawingForWorld, FarmerRender.DrawingForUI, all the stardew tool state booleans....
The root cause of the issue is that, for a brief period of time upon connecting, the client thinks Game1.IsMasterGame is true
We just put a bandaid over the symptom, because I have no idea how much code actually relies on Game1.IsMasterGame being true while the client is still connecting
yup and then keep making careful patches like that over 17 years
My instinct: probably a lot more than you would like.
Yeah. Normal software!
I did attach a debugger and determine that it was checked infrequently enough for it to maybe not be an issue to change to be correct
But still, you never know
And eventually someone goes "dear lord can we do a rewrite"
Management says no.
"no we can't the risk is too high and we don't have a test suite"
Your engineers cry into their Friday beers
our management has this (unfounded) belief that the person who originally wrote our code to determine which discounts to use when scanning products was a genius and doesn't believe that we are capable of achieving the same result in a cleaner way
the discount code is such a massive disaster at this point
but nope do not change it
That does definitely sound like a problem that has a singular good solution, of course.
don't you love 10x Engineers who write 10x the code necessary, 10x as fast, causing 10x the problems
the guy who originally wrote it is also a gigantic fan of XML so we have some nasty process where the entire transaction is serialized into some handwritten XML monstrosity and then manually read out again by the discount handler to then figure out which discounts to use
Oh god
to be clear, this discount system is built right into the cash register, he could've literally just passed the transactionitem list directly
but nope it's a fucked up XML creation
Huh.
I love XML
it's full of bugs too which are then corrected by a post processor to the XML reader that tries to reverse engineer a bunch of information
It's slightly reassuring to hear that I could have probably done a better job than someone who was hired as a programmer to write code.
tbf I feel like people these days do the same thing but with JSON
serializing data when it absolutely does not need to be
a guy touted to be a programming genius at that
I also dislike JSON!
THANK YOU
Toml is pretty good
Absolutely abusing my markdown privileges there, yes.
json is alright as long as you just use it for what it actually is good at(much like XML for that matter)
Hm.
(Okay actually I don't mind RSON, but I'd appreciate it if Rust game devs did not use it as their config file format)
nah they'll use ron
ah YEAH that's the one
How badly I want to pull an Ameise and not use JSON for my mods' config files...
I also do not appreciate RON as a config file format
And in a similar vein, Lua being used for config, also not a fan
I really like TOML
I have no strong opinion on configuration file formats
"Configuration files" actually they're test protcols
It's similar to what most .cfg or .ini file formats looked like when I was a kid so
I like those the best
So I can easily do [[Test]] # pile of test conditions
I'll configure everything in vimscript
Honestly I think my biggest qualm with config file formats is that it shouldn't be visually nested
Formats which encourage flat structures will be my favorite for configs
- my test files have a lot on them (temperatures, sweep times, voltage limits, current clamps, settling time, etc)
I don't think end users understand (nor need to understand) the nesting of the object
It's flexible and I can version control them
TBH I don't even really care if it uses a markup language or known object format at all, it could look like:
forward KEY_W NULL
backward KEY_S NULL
left KEY_A NULL
right KEY_D NULL
jump KEY_SPACE SCROLL_UP
fall KEY_LEFT_CONTROL NULL
run KEY_LEFT_SHIFT NULL
interact KEY_F NULL
ping KEY_Z NULL
ability_1 KEY_Q NULL
ability_2 KEY_E MOUSE_BUTTON_5
ability_3 KEY_C NULL
and i'd be down for it
if it's flat, and human readable, it's A okay w/ me
gonna make a configuration format where anything requires 2 levels of indentation
or more
Speaking of indentation, I just discovered Dhall...
the entire file will have to be in a
root with everything then indented once into that(whitespace sensitive, only 6 spaces are accepted)
so my disclaimer is that I've started following the Linux kernel style guide and using 8-width indents (set in editor, bc Tabs not Spaces), so looking at heavily nested structures already irks me
Hahaha I do four space indents
I do 4 as well
But also my code recently is conceptually simple tbh
I do four space indents normally yeah
Stardew also uses 4 space character indents for new code
I don't really care about the whole tabs vs spaces debate since any reasonably large project should be using an auto-formatter
That reminds me I was gonna set up ruff
any reasonable editor automatically does indentation for you when you go to the next line
I found that regions work in python
Nice when the file starts off with 8 data classes and four enums tbh
And a NamedTuple
my biggest qualm with Sublime is that it does not recognize the blocks of
#ifdef MACRO_NAME
/* something */
#else
/* something else */
#endif
So I can't just collapse the macro for easy reading
Ahhhh that sucks
VS does though, which is nice
I do enjoy a nice dataclass
Sublime not recognising that is bizarre.
Yeah, I don't know if I have it misconfigured?
I'm going to look into that right now, come to think of it
I'm also a massive stickler for making and using enums tbh
I don't want to be passed an int state, let me know my possibilities with good names
rust enums my beloved
My only issue with enums (in C) are that the width isn't defined by the standard
I introduced an enum recently just to pass it from 1 method to a single other method
I was pretty sad to have to int my enums in some recent c#
Because the Volatile library couldn't take enums
Ahhhhh
I feel like I'd like it if enums had an implicit conversion to int but maybe that's a bad idea
I'm happy with the ability to cast to int & back easily
yeah I just don't like adding (int) in code 
I enjoy that
Yeah I enjoy that as well
Not really a fan of reference type enums tbh
Ah I was about to ask what the alternative is
Not that performance even matters in the code I'm writing (I have to insert sleeps to allow my measurements to settle)
damn sorry that reminded me of another reason why i can't believe windows is the standard in gaming
did you know that the sleep timer on Windows by default has a precision of like 15 ms
you can't just sleep for 1 ms
Ooh, a thing I actually did know!
Oh my, that was so incredibly frustrating to debug with my engine
sleep timers are very inaccurate yeah
I was swapping out Steam's networking library with a hand-rolled networking framework I wrote, but suddenly my game's framerate dropped from 200 FPS+ to like 30 FPS
30 fps is good enough time to ship
Because Steam's networking lib added the call to tell windows "hey I want the more accurate timer"
30 FPS (consistently) is good enough to ship, but in 3D it's dizzying when the framepacing is off too
definitely, I wasn't really suggesting it lmao
it was so frustrating trying to figure out "what's the difference between the code on Windows vs my Linux machine??"
oh lmao mb
Windows has been a frustrating experience overall for dev'ing C
If you just sleep for 800ms every frame, any other timing variances become basically rounding errors.
Banger idea
Truly smooth frame times achieved.
Powerpoint truly is the best game engine
You say that as a joke but that is literally my current code
15-70ms sleeps everywhere making any performance changes entirely irrelevant
Oh, allocated two strings when I could have done one? Irrelevant. Hit up the dictionary nine times when six would have worked? Irrelevant
surely by sleep you mean
while time_now - time_start < 15:
pass
Nah, straight up calling time.sleep
I just need long enough the measurements settle
i can't believe you don't busy wait
No no, surely you would want to add an element to a list every iteration and just count time using those. I call it ListTime.
A bit longer doesn't hurt
Would busy waiting be more correct? Yes. Does it matter? No
but adding to a list isn't reliably O(1)

gotta initialize the list with a capacity large enough for the maximum ListTime
(Technically what I should be doing is polling the measurement repeatedly and waiting for the deviance to fall)
While I've been describing monstrosities, I've been doing this monstrosity of an experiment. It's about as broken as I would have hoped.
linked list 
i loved being taught about linked lists in school only to find out that when people say "list" they generally mean "array list" because cache coherency actually matters
Learning Rust With Entirely Too Many Linked Lists
someone could tell me this was written by Atra and I would believe it
did you write this
Mumble mumble kernel embedded something something intrusive
No I'm not that smart
i also like that i was taught to implement queues & stacks as linked lists, but in reality it's still basically an array list
i had one class (operating systems) where they actually had us write a queue as a circular buffer
but didn't actually teach us how to do it
which I mean, fair, but I feel like I learned most of my knowledge about data structures from practical, high performance applications
I was never taught what a linked list even was in uni
I don't think it was part of the datastructures course at all
I can do one but they really aren't preferred anymore unless you're doing some crazy lock free nonsense
i'm grateful for my data structures courses, bc they did in fact teach me a lot
And frankly I'm not insane enough for crazy lock free nonsense
and tbf I learned to make an AVL tree with a backing array in those courses
linked lists are a necessary evil in functional programming and that's about it
but no one taught me WHY using an array as the backing structure was a good idea
maybe if my degree were computer engineering? idk
They're the one course I would take properly in isolation to everything else... because it's absolutely my biggest weakness currently.
I remember learning about all sorts of trees in my data structures class that I have not seen even once since then
Just do the MIT ocw 6.006 course
It's soooo good
I'm sure if I worked with filesystems more I'd have seen them more frequently
But to this day I have skirted by without knowing how to implement a B-tree
when would you ever even implement them yourself beyond incredibly niche scenarios
For me, the benefit of knowing these things would be the following ability to be able to figure out "oh hey, I should actually use this rare thing here".
Instead of just bumbling along with a terrible solution because I have no idea about them!
Because currently, I bumble, and I bumble hard.
goes through every type of binary tree one by one
fwiw, your standard List/Dictionary data structures are good enough for 95% cases
it really is
I've seen a lot of code at work though where people use lists still when dictionaries should be used
list lookup is fine if it's only a few elements in size but...
oh and (Hash)Set
I use 6-32 as the rule of thumb tbh
(I'm very intersted in what this means)
easy it's -26
i-
If I have a collection of less than six elements it will almost certainly be faster to throw them into a list and straight search
Between 6 and 32 elements it is a tossup
why these specific numbers
that bodes well for most palletized data structures i suppose
they're nice numbers
easy, because 6 - 32 = -26
Empirical really
and i assume above 32, always use a dictionary?
Yeah, favor dictionary
i guess it also depends on the frequency in which this is called, and from where
for a Minecraft converter thing I worked on, I used gperf to get a perfect hash table for all the string block IDs to a numerical ID
(I could disregard the other information, like waterlogging or block orientation or whatever, so it worked for my purposes)
perfectly optimized hash functions
Yeah guaranteed O(1) lookup
What's mine craft

mince raft is a type of raft used to escape deserted islands, made by packing together the meat of animals
desperate times call for desperate measures
Anyways, the c# dictionary does a cool trick where they use a more collision prone but faster hash function on strings unless there are too many collisions
In which case it switches the hash function
idk I'm pretty sure memory is infinite anyway
I love tries!
I love it when the c# compiler writes them for me!
(Switching over strings in dotnet8 emits a trie)
that's pretty smart, and really cool tbh
joins server for that emote YOINK
Lots of mods still needing updated
haha
Glad I use vortex cos I can just click a check for updates button
oh no not vortex
I paid for it a long time ago so I'm not worried
shoo, on topic!
This is the place we can hide from modding responsibilities
Here, have my meeting sock

the all important meeting sock
Aren't the colors pretty???
That’s a great idea. I should totally crochet during meetings.
That's pretty!
I only get away with it for online meetings tbh
Anyone happen to know how to compile the Machine Interface driver for LLDB on Windows?
Honestly, I might apply. I'm pretty happy with my company rn, but they are paying under the average in my area. Culture is super important to me, but it doesn't hurt to look around.
does anybody here use microsoft visual studio
i think some people here do ye
Yep
I assume you do, what language?
i just am wondering why when i try running my code it brings me to microsoft edge instead of runing the code in the terminal
You're writing C++ code?
it just says file, and yes ive hit the show extensions button
trying to learn yeah
Show me your project settings like linker and stuff
Type .cpp at the end
in file manager or in vs
Good?
Sorry, no rush
Type #include <iostream> at the top
do you not use it
Im looking at your errors at the bottom
But I used Visual Studio more
Check ur environmental variables
whats the difference
Open that launch.json file they suggest
what are those
Visual studio code is more of an IDE, the full package
VS Code is like a flushed out text editor
oh
They're completely different programs, despite the similar names
Kinda like notepad++
But they do the same in the end, its more about their features
and i have the bottom or top
Bottom
gimme a sec
Open your launch.json, i think that might be incorrectly set up
also i am trying to learn but cant really find stuff, how did you guys learn
ill try
Lots of googling lol
seems rather tedious
What did you do to build the code also?
like to figure out what to do?
It can be. The secret is the more you write the more you can look back at your old stuff
The launch.json seems to have the exact string enter program name, for example C:\Users\my pc\Documents\New folder\a.exe
I've never done c++ on windows
You gotta drop the enter program name, for example part, that's not supposed to be part of the text
But back in the old days I recall just running gcc from termknal
Theres two steps to running c++ code. First you have to turn the code into a windows exe, then you have to run it
In launch.json
Your launch.json file will do the second atep
Idk how you did the first step, but it would be helpful to know
Assuming you're using mingw or a similar toolchain that's pretty nice
in the video i watched he just added .cpp and it ran in the terminal of vs code
That can work well
There is a bunch of setup in VS Code
Can you link the video tutorial you're trying to follow?
Ah, thats good. What did you type into the terminal?
i did get a bunch of c++ extensions
nothing
i followed what he did and he didn t type anything i dont think
but imma double check now that you mention it
He may have set up a task or something instead
For your question abt Visual Studio vs Visual Studio Code, left vs right
i have the one on the right
Visual studio code is more beginner friendly imo
Hard disagree
so vs code is preschool to vs or what
for cpp at least
nah, they are different
oh mb
VSC is more basic
what would you recomend
yeah, thats why i want to learn it
(and with others or not, and commerically or not, etc)
They just have different features. I use vscode at work for c++, while some coworkers use visual studio, its just prefernce
i just want to find an understandable way to learn
I started with VSC, changed to VS
It sets up a lot of the stuff for you if you choose the right workload
so should i just stick with vsc until i have a semi decent grasp on c++
ure
Sure
Codeblocks?
what do you use
No
lol
Anyway, first step is to turn your code into an exe. The exact steps to do that depends on what build program ("compiler") you have installed
I just use Sublime pretty much
nice
I do use the Visual Studio compiler though, MSVC
Same
like the gdb/llbd?
no
gdb is a debugger
those are debuggers
oh
it's like gcc.exe, cl.exe
That program is called a debugger. It will show you information about the program as its running to help fix issues
clang.exe(if anyone can help me with the LLVM stuff)
oh
Check this, I remember it worked
What compiler are you using out of curiousity?
actually that's a bad way of putting it(or not idk HTML)
C++ compiles into bytecode
all i know is thats how you view it and see if its working or not
there are many compilers to choose from but some main ones I know are GCC(MINGW on Windows), Clang(LLVM toolset), CL(MSVC)
Do you have one installed rn?
ah ok
There's a gcc version for Windows, as part of the mingw toolset
oh i see
im getting mingw rn
its saying "the install directory is completely deleted" or will be deleted. what does that mean
Can you send a screeny?
Sorry for the lacking advice I'm trying to remember VSC lol
Select a new folder
youre all good, its nice to have any help at all
Make a new one
ok
Do not do that
BRB in like a minute or two
ok
Do you understand what MSYS2 is?
if it isnt a compiler no
MSYS2 is "MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software."
oh
oooooohh
Just make sure you know what you are installing before it happens
the tutorial says to install msys2 and then install mingw through it
That absolutely works
and if i install msys2 into a brand new file nothing can go wrong?
(just please make sure you know what you are installing, very imporatant)
A new folder yea
but make sure it's empt or it will erase everything
now BRB in 5
thats what its been telling me
okie
Back
ok
im currently insalling MSYS2 onto a completely new folder
and im gunna run the code to instal mingw
Click the top tab on the left
Delete .vscofe for now
ok
also got rid of the one file that wasnt a cpp beacuse it was empty and i made it while trying to figure this out
2 of the g++ ones come up for me
show me
Top one
i hit one and then it made a .json
or idk if it made it but one appeared
bottom one mb
Honestly I would try to verify compiler files and check stuff like that
vs code seems like its gatekeeping coding from me
From this point I don’t think I can do much
It’s so much easier with python on vscode
Maybe
well
yeah, ill look into other ones because i havent even been able to try acual code yet
i really appreciate your help though
np
thanks a bunch 
peace
hehe
Why do SVE Wizard needs to be Magnus (as in a separated char)
It breaks some portraits mods so much aaaAAAAAAA 
I know how to fix it, but not everyone does
Especially if they don't know much about computers, they will get scared to edit/ will accidentally break the mod even more when "fixing" the code
@digital canyon so last night I downloaded VS to see it, and I tried my piece of code and ran it. It ran immediately and I only needed to spend a minute total figuring it out and it worked
Noice
I wonder if that's because MSVC installed with it
could very well be
visual studio loads your pc up with all sorts of stuff immediately
I have it on my work machine just to manage msvc lol
I have it on my work machine... cause I use visual studio
i also have at least two different editions of visual studio to go along with it
i have 2017 and 2019 lol
still using the 32 bit versions 
I just let the toolchain people tell me what they want me to use
I'm enjoying toml over json tbh
It’s the age old question of better design/ease of use vs what has actually been adopted and has large community support
For configuration stuff, I vastly prefer yaml or toml than json these days
I'm learning people have strong opinions about the format used in config files
I don't think I've ever cared
just property name and then the value and that's essentially the config file done
idk what kind of complicated configuration files people are dealing with
Have you ever used something like docker compose or AWS CloudFormation? You can basically manage entire backend setups just through the config files.
yeah my home server uses a docker compose file
my opinion is entirely based on the fact that json doesn't allow comments
fair
I feel like the appsettings.json in asp.net projects does support comments though...
hmm maybe it doesn't
i mean, it really supports whatever its library does. There is a version of json that does support comments, but many of the standard json libraries don't seem to support it
right
in my mind almost all configuration file standards are essentially the same thing with slight variations. Sometimes there's nesting and sometimes that nesting uses whitespace and other times braces... Some other formats have like [[thing]] header section things
it just doesn't really matter in my eyes they all essentially do the same thing and you look at it maybe a few times in your entire project's lifespan
I don't think I do anything with the config files at work beyond changing what environment I need
and then there's the ones like docker-compose.yml of azure-pipelines.yml which you just essentially set up once and then don't look at again for 3 years
I guess the only config files I really work with that I open more often are the init.lua for neovim and the hyprland config
but honestly I'd hardly call neovim's config file a config file anymore
it's a whole ass programming language pretending to be a config file
content.json would like to speak with you
what's a content.json referring to
Oh wait, you're not a modder
Content Patcher's content format is json, but it encodes a lot of programming-like constructs
that sounds like something I would not be a fan of
Like, I'm pretty sure Content Patcher is turing complete
I'm looking at it now and it gives me the shivers
this is using json like it's a programming language but worse
I'm sure there's a good reason this came to be
and not all modders are programmers
It's a gateway for content creators to learn programming
Except, programming makes sense to me, but Content Patcher still confuses me sometimes
I assume this is primarily intended just for stuff like portrait mods or extra dialogue
Oh God what did I start
how big are some of these content patcher jsons
ah it's not as bad as our MainForm of the cash register so it's all ok
I have one I generate with a Matlab script that’s about 3000 lines iirc
Does that make you feel better? 😂
Anyways, crumble, I need to know if opengl has issues with modern Intel processors
that sounds incredibly unlikely
I’m not convinced CP is Turing complete but I’d also have to remember the definition of Turing complete
it's not all that difficult to technically be turing complete
There’s various specific things about self-referencing that im not sure are possible
Though I guess you can define variables and do arithmetic
Microsoft Excel formulas are turing complete
doesn't need to be ergonomic or in any case remotely reasonable to be turing complete
If you’re willing to ignore the useless nature of focusing solely on complex configs and not on the actual functionality I guess
Ahhhhh
Some examples thanks to wikipedia
Hmm this is why I never made it as a mathematician
Too grumpy about practical applications
habbo hotel lmao
Work cad software crashed three times due to opengl issues yesterday
That’s a scary sentence
Admittedly I used to work on cad that would crash about once an hour due to sharing an IP address between 6 computers
Uh, new probably????
I'm pulling driver updates for it
IT says try X not Wayland if problems continue
ah
im going to say that probably wont help
but then again they are black boxes of mystery
I find it highly unlikely for intel processors to have issues with opengl of all things but I'm no graphics programmer
idk what software it is but it's probably running in an XWayland instance anyway
just putting this out there... ts is hard 
making a discord bot and i STILL cant fully code on my own and this is rough
i can understand a bit thankfully
but so much RED
and chatgpt(cause i need help) is busted right now :(
I find chatgpt to lead me down bad avenues than it is a help lol
it does go insane a bit, but its better than nothing since i have no teacher right now
if i had someone to guide me i wouldnt need it
sadly youtube videos expect you to already know most of the stuff they talk about as well
assuming discord.js, they have great examples
yeah its that plus my own api stuff, i had someone coding all this stuff for me but they wanted to take a break from coding so now im starting from scratch
Discord bots are nice tho as youre really just reacting to some event thats happened, and you can sign up to handle more or less of them as you go
i actually have no clue if this is api stuff, i have no clue what any of this stuff actually is, but im slowly making the reds go down
but like.... how does one fix this 
Property 'payload' does not exist on type 'never'.ts(2339)
(i have so many of these)
Im not super familiar with typescript, but I think that means that the type of that object could potentially be never, which understandably wont have a payload property. You could do something like checking that the variable isnt never (and handle it as needed if it is)
hmm, i shall try that, provided i figure out how to do that. also yay! down to 50
variable as unknown as any
is the easy fix
if you want to, you can actually write types for your API
I'd have thought they provided a base project that essentially had a simple hello world type situation ready and done as is
in an examples folder or something
i think thats what they did
i know i had to make imports from scratch cause the code wasnt happy with importing stuff from discord.js
it took,,, forever
djs has amazing docs, sapphire from my quick look has great ones too
are you trying to migrate the code?
yeah, what i can at least, im doing a massive refactor and breakdown
god javascript project config files have gotten out of hand
but trying to keep already made code so long as it works
that seems like not a great idea when you don't understand the language
i understand it enough to read, but not write
and yeah its a really bad idea, yet im determined to make it work
trail by fire sort of thing
(deletes system32 by accident)
What do you want it to do?
uh, let me check it
looks like its the command checker part of the code, i could send a snippet but eh. wont unless someone asks
if it's not too long sure
its checking if the prefix is met or if a slash command is used, then it does things
I meant the bot in general i guess
ohhh
its a general chat bot, using my AI, it can also be used for moderation eventually and just to have fun with
Change event: never to event: any in the args
is never an actual valid type
it sounds more like it'd be an extreme version of void. Not only doesn't it return anything it will just never return...
It is
idk what it's used for but it is
Notably, you cannot cast it to any, you must go to unknown first
my only guess is functions that only ever throw exceptions since that's the only scenario I know of where a function would fail to return
strange to treat it as a type
but it's something
That sounds like a hack lol
I can't imagine they actually want you to do that
Probably not
looking at some docs the examples they give are functions that throw exceptions or functions that loop forever
bit of a weird one
there's cases for functions that never end for the entire runtime of the program I suppose
not a blocking function though I hope...
my when i code for 5 minutes:
All meetings and no code make Bella an....actually she'd be happy
She loves people
Me on the other hand am looking forward to a solid evening of getting shit done
Pylance thinks my string literals are undefined variables?
Tell pylance to mind its own business
i mean are they warnings or are they errors
Errors
Bella!!!! 
I hope she's doing okay
She's doing somewhat better!
I'm glad to hear that! 
github copilot is fun, I'm pretty new to c# and I was able to get it to rewrite my loops and if statements to all use chained c# functions. I know it doesn't mean necessarily "better" code but it's great for learning
// ORIGINAL
foreach (GiantCrop giantCrop in location.resourceClumps.OfType<GiantCrop>()) {
Monitor.Log($"Found big version of {giantCrop.GetData()?.FromItemId}", LogLevel.Trace);
string? item_key = giantCrop.GetData()?.FromItemId;
if (item_key != null) {
// Note the key is the source items id (e.g. Melon is '(O)254')
if (cropTypeCounts.ContainsKey(item_key)) {
cropTypeCounts[item_key]++;
} else {
cropTypeCounts[item_key] = 1;
}
}
}
// REPLACEMENT
cropTypeCounts = location.resourceClumps
.OfType<GiantCrop>()
.Select(giantCrop => giantCrop.GetData()?.FromItemId)
.Where(itemKey => itemKey != null)
.GroupBy(itemKey => itemKey)
.ToDictionary(group => group.Key!, group => group.Count());
Yeah it tells you to do that but doesn't mention it is pretty bad performance wise
I had to rip all that pretty out
it's rarely noticeable
Something something linq being slow?

