Programming thread

  • 🐕 I am attempting to get the site runnning as fast as possible. If you are experiencing slow page load times, please report it.
This philosophy folks, is why we have a software quality crisis. Microsoft teams "works", Spotify desktop app "works". Discord desktop app "works" . All it takes is a quick google search to find average users complaining about them becoming unacceptably slow with ridiculous memory usage.

As for the anecdote about the optimized but incorrect program. I would never be an advocate for over optimizing a program considering the fact you can slow down a program by forcing inlines causing the binary to be bigger having and when loaded will span over additional page boundaries.

I'm simply talking about for programming in a professional setting having an awareness of these fundamental comp sci concepts allows you subconsciously and naturally write better code in the first place.
After seeing enough "professional" code. I do believe for most simply remembering that reading from file system is slower than reading from RAM, reading from filesystem is faster than sending request over network, branching is fast, math is free would be decent start and probably enough.
People refusing to learn frameworks they use, and choosing to import some other library that does what could be done in framework but in a roundabout way is another plague of industry.
Add to that excessive feature creep, pseudo agile, gold rush that causing IT to be flooded with incompetent programmers, constant turnover in projects.

I really feel like gc vs non-gc languages is one of the least things causing poor performance of modern programs.
Moreover, do people really forgot how unstable programs were like 15 years ago, when everything was done in c/c++? It was common for programs to crash or freeze on you.
Using task manager, and it freezing, was meme back then ffs.

Also would be nice if everyone stopped targeting web browsers for desktop programs.

BTW do Teams really suffer from performance issues? I have never noticed those, my complains are mainly random log-outs and inconsistent notifications.
 
Moreover, do people really forgot how unstable programs were like 15 years ago, when everything was done in c/c++? It was common for programs to crash or freeze on you
I think I mentioned this elsewhere but anyway, even earlier, before Mac OS X, Mac OS up to 9 didn't have preemptive multitasking. What that means is that the kernel couldn't step in as a dictator and force a process to stop hogging the processor according to whatever criteria and relinquishing its use was done on a purely voluntary basis per process, which, of course, could easily hang the entire system.

Bitburner
Bitburner does look like a lot of fun, in principle, but the trouble is that, like much of the non-gaming infrastructure of coding, it's in JavaScript. I bought Screeps but still haven't played it because truly enjoying it would mean coming to terms with the API and basic strategy in JavaScript then figuring out how to transpile (and there are zillions of to-JS transpilers for a reason) a less scuffed language like Python to "native" Screeps code.
 
I've said something similar earlier in this thread and I feel that GCd languages can actually be faster when it comes to allocations and reusage of existing memory.
Could be. It's worth noting that OCaml, which is GC'd and statically typed (with type inference), seems to have substantial favor used in finance because of a balance between performance and ease of use / expressiveness
 
8272fefe9e9fdff2d3bb77957b79303c.jpg
I originally wanted my project to be a top down shooter but I feel like if I start over and make something thats turn based It would be easier to script the stupid fucking animations and I can add alot more depth than an arcadey shooter. Adding more depth and making it tactical and turn based means working with data in a practical way which would look good on my portfolio even if I was applying to a job that isn't gaming related.

Anyone else coding a video game? Do you think turn based is better for a newbie?
 
Anyone else coding a video game? Do you think turn based is better for a newbie?
Everything is turn based if you have fixed time step :smug:

I don't think it should be that different from animation stand point.
You just want finite state machines and it should be reasonably similar.
 
  • Like
Reactions: y a t s
Do you think turn based is better for a newbie?
From a netcode perspective, turn-based gameplay can let you get away with quite a bit more than real-time gameplay. Sending JSON or CBOR over Websockets is just fine with turn-based games, unlike with real-time games where it's basically suicide.

If you're a newbie, however, I doubt you're worrying too much about networked multiplayer right now, but it's something to keep in mind for the future.
 
Can I get a C++ tip from any passing 400-pound C whales?

In Windows, you can say "wait for a certain object to become signaled, or until X milliseconds pass", by simply: WaitForSingleObject(handle, msecWait);
Which you've been able to do since approximately the Jurassic period.

What's the best way of doing the same in modern C++ using the std::thread library?
The most obvious analog, using a std::condition_variable, seems like a hack.
(example: https://en.cppreference.com/w/cpp/thread/stop_callback)
I've also seen suggestions of using a std::future that you can either wait for or have it return early if "signaled".
 
Can I get a C++ tip from any passing 400-pound C whales?

In Windows, you can say "wait for a certain object to become signaled, or until X milliseconds pass", by simply: WaitForSingleObject(handle, msecWait);
Which you've been able to do since approximately the Jurassic period.

What's the best way of doing the same in modern C++ using the std::thread library?
The most obvious analog, using a std::condition_variable, seems like a hack.
(example: https://en.cppreference.com/w/cpp/thread/stop_callback)
I've also seen suggestions of using a std::future that you can either wait for or have it return early if "signaled".
std::condition_variable, though it's difficult to get right. I think part of the trick was that you need to provide a lambda to wait(), because you're going to get spurious wakeups.

Really though, I'd just use WaitForSingleObject on Windows and something like eventfd on Linux. I've grappled with this exact issue on previous projects, and I'm not sure that changing the code to use the STL was worth the bother.
 
View attachment 6587949
I originally wanted my project to be a top down shooter but I feel like if I start over and make something thats turn based It would be easier to script the stupid fucking animations and I can add alot more depth than an arcadey shooter. Adding more depth and making it tactical and turn based means working with data in a practical way which would look good on my portfolio even if I was applying to a job that isn't gaming related.
Templar Battleforce is a really good top-down turn-based tactics game you could take inspiration from, also a lot of the Fire Emblem games. (I remember Blazing Blade very fondly.)
 
There should be an entire movement to make things more like this. master had about as much to do with slavery as "master's in African-American studies" and most likely came from the idea of mastering in AV production but really, now that I think about it, master should actually be called slave_plantation. Also error messages like this one are wrong:
Python:
In [1]: import sys

In [2]: sys.stdout << 'Hello world' << '\n'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[2], line 1
----> 1 sys.stdout << 'Hello world' << '\n'

TypeError: unsupported operand type(s) for <<: '_io.TextIOWrapper' and 'str'
It should be more like NiggerliciousError: go back to the CIA you fucking monkey nigger.
This has very high NIGGER+ license energy and I love it.
 
  • Feels
Reactions: Belisarius Cawl
Templar Battleforce is a really good top-down turn-based tactics game you could take inspiration from, also a lot of the Fire Emblem games. (I remember Blazing Blade very fondly.)
I was thinking of something like Tales Of Maj'Eyal with an apocalyptic theme and animations. Animations made with fuckin code. :smug:
 
  • Feels
Reactions: Belisarius Cawl
I only play permadeath games to feel something, even if that thing is rage.
There's a TBS game I have hundreds of hours in, Conquest of Elysium 5, which has roguelike influences (but still allows you to savescum). The influences of Master of Magic and maybe to a lesser extent Heroes of Might and Magic are evident as well. One thing I will say is get the mods that disable ant nests, spider nests and planar invasions (and probably also enable safer Inferno gates). Without those I probably would have ragequit the game entirely a long time ago. I'm playing now as the Priest King faction which has a Mesoamerican theme and emphasizes rounding up huge numbers of poorly equipped slaves shoved to the very front of your armies and used as cannon fodder until you can fill your ranks with increasingly powerful holy warriors and even more powerful priests and their summons. You can even offer up the priests' lives to bring gods into the game world. Here are two screenshots to give you an idea:
Screenshot 2024-11-02 04:48:05.png
Screenshot 2024-11-02 04:48:26.png
(Battles are resolved automatically. The strategy part is preparing for those battles.)
 
There's a TBS game I have hundreds of hours in, Conquest of Elysium 5, which has roguelike influences (but still allows you to savescum). The influences of Master of Magic and maybe to a lesser extent Heroes of Might and Magic are evident as well. One thing I will say is get the mods that disable ant nests, spider nests and planar invasions (and probably also enable safer Inferno gates). Without those I probably would have ragequit the game entirely a long time ago. I'm playing now as the Priest King faction which has a Mesoamerican theme and emphasizes rounding up huge numbers of poorly equipped slaves shoved to the very front of your armies and used as cannon fodder until you can fill your ranks with increasingly powerful holy warriors and even more powerful priests and their summons. You can even offer up the priests' lives to bring gods into the game world. Here are two screenshots to give you an idea:
View attachment 6590047
View attachment 6590049
(Battles are resolved automatically. The strategy part is preparing for those battles.)
Seeing the graphics in that screenshot has me sold on the game because all the games that look like that usually have a crazy amount of depth lol.

That is why I am restarting my project as a turn based one. Easier to code the animation scripts, and if you peel back all the flashy aspects of a video game like high end graphics, then even older pcs have enough power to handle a detailed simulation, that is why Dwarf Fortress is so admired.
 
Seeing the graphics in that screenshot has me sold on the game because all the games that look like that usually have a crazy amount of depth lol.
What really sets CoE apart to my mind is the amount of real historical / mythological detail in the different factions. Necromancers make use of hands of glory which are a real-life would-be magical item. The Priest King faction, like I said, is based on Mesoamerican lore and plays fast and loose with some details but overall there's decent correspondence with actual Aztec or Mayan beliefs. There's another faction called Cloud Lords whose names sounded to me kind of Indian or Persian and I found out they were Avestan names, which is an ancient Persian language. As it turns out, there are actual Persian legends about winged people with questionable morals, like in the game. There's a Demonologist faction where, if you try hard enough, you can even summon characters like in Dante's Inferno such as Geryon, Monster of Fraud. There are Lovecraftian entities too from the Void, made use of by the High Cultist faction, as if all of the other things weren't enough. You can bring gods into the world and kill opponent gods too. A smaller but still funny detail is this game is made by Scandinavians and moose, bears, deer and even fish-people who can be killed and smoked to feed entire villages are a constant low-level menace. These are the sorts of things that make CoE really worth playing from the days of the Atari ST up to the days of Steam in the current year.
 
  • Agree
  • Like
Reactions: ${Sandy} and Safir
Back