I know about Turing equivalence and all (my name is literally Turing!) and computers are very fast these days, but it still shocks me to see someone talking about building a falling sand game, something that involves thousands of pixels being tracked individually, and they pull out JAVASCRIPT?
Conversation
Notices
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:24:32 JST Foone🏳️⚧️ -
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:25:27 JST Foone🏳️⚧️ Javascript has some strengths, I'm just pretty sure "manipulating a ton of integers" isn't its strong point
-
Video_Game_King (video_game_king@digipres.club)'s status on Monday, 13-Jan-2025 13:27:08 JST Video_Game_King @foone Turing equivalence dictates that one Turing complete system can perform the same tasks as any other. It says nothing about performing those tasks as efficiently as the other systems.
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:39:43 JST Foone🏳️⚧️ @Video_Game_King I know, I meant that turing equivalence means that the language you pick doesn't matter in terms of functionality. so JS isn't any worse than C or whatever, until you consider performance
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:40:16 JST Foone🏳️⚧️ oh god they made an immutable array for the world map so they're recreating it every single frame
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:43:24 JST Foone🏳️⚧️ correction: it's a mutable array. Both arrays are mutable. but they throw one of them away every frame, rather than alternating them like double buffering
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:43:59 JST Foone🏳️⚧️ look it's important to ensure your garbage collector doesn't get bored, so you need to generate a bunch of interlinked objects every frame, if not in your inner loop
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:48:12 JST Foone🏳️⚧️ I've discovered that watching live-programming videos can give me the same secondhand embarrassment as watching people failing at puzzle games, because I can often see their bugs as they type them, and I'm like "that's not gonna work" but it takes them a few minutes to find out
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:49:11 JST Foone🏳️⚧️ @xris I guess!
I tend to assume anyone who is a programmer knows several languages. like everyone knows python + js + c + java/C#, right?
-
Flatbush Gardener 🌈 (xris@ecoevo.social)'s status on Monday, 13-Jan-2025 13:49:12 JST Flatbush Gardener 🌈 @foone
The Devil you know, I guess. -
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:53:10 JST Foone🏳️⚧️ AHHH YOUR HSV RAINBOW IS DISCONTINUOUS BECAUSE YOU RESET VALUES >360 TO 1
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:54:40 JST Foone🏳️⚧️ remember children, if in your inner loop you need to refer to your array[y][x] multiple times, just type it out like that each time. array lookups are free! especially in a dynamic language like JS!
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 13:55:07 JST Foone🏳️⚧️ I know programmers who assign reused array lookups to temporaries and they're all cowards
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 14:05:07 JST Foone🏳️⚧️ I think other people trust their compilers a lot more than me.
I think I spend too much time looking at badly compiled code to assume my compiler is smart enough to know it should automatically grab array[y][x] to an implicit temporary
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 14:21:13 JST Foone🏳️⚧️ @andreasdotorg A well groomed compiler, sure, but JS? especially when it can't even be sure the array is sensible, since it's actually an array of array pointers, and who knows how those are laid out in memory?
-
Ela (andreasdotorg@infosec.exchange)'s status on Monday, 13-Jan-2025 14:21:14 JST Ela @foone A properly groomed compiler will do the right thing here, not just common subexpression elimination, but also down to replacing the multiplication for array index aslculation by an addition for monotonically increasing indices.
I'd write that in whatever way brings the most clarity to the human reader.
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Monday, 13-Jan-2025 16:58:47 JST Foone🏳️⚧️ @tomjennings no, I'm not, they are!
-
tom jennings (tomjennings@tldr.nettime.org)'s status on Monday, 13-Jan-2025 16:58:48 JST tom jennings Aren't you off by one? What is this, BASIC?
-
Foone🏳️⚧️ (foone@digipres.club)'s status on Tuesday, 14-Jan-2025 09:41:07 JST Foone🏳️⚧️ @lunarood yeah that's the thing, I still do this when I'm pretty sure the compiler will inline/make a temporary. I just don't want to have to type array[y][x] multiple times when "tile" will do
-
Luna Rood (lunarood@mastodon.gamedev.place)'s status on Tuesday, 14-Jan-2025 09:41:08 JST Luna Rood @foone I'm cowards.
However, it's not always to help the compiler (though there is a ton of stuff that I do explicitly for this reason), but also just to help myself, by making the code more readable/writable.
-