masklayer

UAhh I'm gonna be sick ! OH

uhhhhhhhhh

Tom | 31 | 🦌🌐

<3 @clip <3

 


 

Tags I use sometimes:
CameraPhotoTimelapseVideo
VRChatCybuckClip
LifeArtMaking(?)
Creature

 


 

"mweeh.."

 


 
opinions my own & do not reflect those of my employer ;3


eramdam
@eramdam

(reposted from a Twitter thread hence the weird paragraphing)

Idk enough about gamedev (barely anything really) or about Love2D/Lua to judge but I'm guessing this might just be super quick because runtimes are usually super good at optimizing those kinds of codepaths anyway so like, who cares. If it runs good and fast, just do that.

Like, there's code like that in all the apps you use, I guarantee you. You just never see it. But something that 'looks' stupid but is easily readable/tweakable and happens to be fast reigns supreme over any "clever" bit of code.

But I also don't subscribe to the "haha fancy software degrees won't teach you this", it's true, they won't because they're usually teaching you a completely different facet of things. Writing code that needs to be used in a 24/7 service/software is different than writing a game.

If you need to worry about shit like user inputs, security vulnerabilities, etc then yeah suddenly you might need some abstractions and get more complex with it. But for a game, especially if you're the only dev on it? Do what you gotta do.

i wont comment on the relevancy of schools/degrees for gamedev specifically bc it's not my wheelhouse. but i know most of the schools my peers would go to are basically "make you ready to work at " degrees, where those things are normalized and the norm.

that said i am also a very bad example because I specifically told one of those schools "actually, i won't be there in September" to get my current job because what I had was good enough lmao

but that was also a luck of the draw type thing, i was barely decent at JS 'real programmer' type shit but i was pretty good at HTML/CSS so I had to learn a lot on the job. not every job allows that and it feels like those are getting rarer

anyway i got sidetracked but my point was that, after a certain point, Code that works and is simple to read/iterate with reigns supreme over clever abstractions that need to be tweaked every time a requirement changes.


reccanti
@reccanti

I feel like "easily tweakable/modifiable" is really under-appreciated as a factor in writing code. There's a lot of programming information that kind of considers the code in a vacuum, but rarely consider other things like:

  • If someone looks at this code, how easy would it be for them to understand what's happening?
  • If I need to make a change, would it be easier if I isolated this specific logic in one place, or does it make more sense to abstract it away so it can change every time?
  • If I'm submitting this for code review, will the generated diff be easy for someone to understand and interpret?

You must log in to comment.

in reply to @eramdam's post:

For solo dev especially this sort of thing is perfectly workable. The minute I'm working with a non-coder game designer, I would split this out into a thing that has an editor interface or digests a .csv file or something.

The distinction between code and data is basically fake anyway, and one of the most powerful tools as a programmer is "i will hardcode all this data" and its twin "i will turn all these functions into data objects that my coworkers can arrange in a list"

I'm not disagreeing but I think I get antsy around attempts to make this point because I don't think the point should be "you don't need fancy abstractions if the 'simple' thing works". I think it should be "the 'simple' things are also abstractions that have the own strengths".

Like here specifically the big if statement is making a choice that grouping the behavior of all cards together is more maintainable than grouping all the aspects of a single card together. It's easy to look up cards since every statement has a string comparison at the start that works well with a text search.

I can imagine a version of Balatro where new cards can be added by DLC where this becomes a little more annoying to manage. Or a version where you want modders to be able to add new cards easily. That doesn't make this version worse, of course. It's appropriate to what Balatro actually is.

I guess I think the solution to abstraction fetishism is to abandon the idea of simple vs complex as a useful axis on which to measure them?

i see no problem w this, trying to 'simplify' it would make this a zillion times more complex to work with and therefore liable to fuck up wouldnt it. cuz each of these statements has multiple trigger conditions of different types

i have written a high performance threaded web server that had a very specific use case and was about 150 lines of if statements. was able to saturate a 10gE connection with it on p old hardware cause it was so single minded.

edit: i forgot the point which is this was part of an 7 9s (3s downtime per year) SLO with a 6 9s SLA (30s downtime) and one year we achieved zero downtime on the part i was in charge of.

The tweet has since been deleted or hidden, so I can't view it and can only speculate based on Plato's shadows of discussion around it; either way this should apply.

Part of what I learned from Big O Notation with regards to algorithmic efficiency is that your pool of data is a factor in building a system. If you only work with pools of 10-100 items then a chain of that many if/case statements, while slightly annoying codewise, would have barely imperceptible performance impact except for the most exponential of cases.

If the covered portion of the Big O graph doesn't hit the most extreme points 99% of the time then it's fine. Doubly so for games.

Sure if there is 100,000 data points that are being processed continuously of O(n^n) you should look into abstractions and optimization; but hash lookups for 100-200 entries is nothing on that scale.

I have seen the inverse, of performance critical code handling more data in more professional settings, such that it was to the detriment of the application and its maintenance; and that is where more care should be taken.

I still had it in my Twitter app’s cache so I took a screenshot of it. Hadn’t notice it went down, that shit went viral real quick so I assume OP didn’t want to bother with it, which is fair, going viral on Twitter is miserable lol