Great Programming/Bugs/Oversights in Games

What are your favorite programming-related achievements or mistakes in vidya?

I'll start with one I recently found out: in DK64 whenever the screen lags too much due to the limited processing power of the console, the kongs get a relatively high speed boost to convince the players that the game is still running smoothly.

Other urls found in this thread:

h14s.p5r.org/2012/09/0x5f3759df.html
en.wikipedia.org/wiki/Floating_point
n64devkit.square7.ch/n64man/os/osSetTimer.htm
gafferongames.com/game-physics/fix-your-timestep/
number-none.com/blow/blog/programming/2016/07/16/braid_code_cleanup_1.html
number-none.com/blow/blog/programming/2016/07/17/braid_code_cleanup_2.html
number-none.com/blow/blog/programming/2016/07/18/braid-cleanup-part-3.html
number-none.com/blow/blog/programming/2016/07/19/braid_cleanup_4.html
number-none.com/blow/blog/programming/2016/07/07/braid_particles_1.html
number-none.com/blow/blog/programming/2016/07/13/braid_particles_2.html
number-none.com/blow/blog/programming/2016/07/08/fabian-on-lcg-fast-forward.html
twitter.com/SFWRedditImages

Remember that one time when Blizzard tied the auction timer in D3 to the user's system clock?

...

...

this has to be some kind of joke. noone can be this fucking fuck, i can't find an appropriate adjective.

...

Some DOS games are tied to CPU clock speed.

In Dungeon Siege 2, if you move or press the "stop current action" button, it cancels your current animation and resets your attack cooldown, allowing you to machine-gun a crossbow and other weapons.

Has anyone got the WurmOnline stuff? Shit is a fucking gold mine. The best part is not even a surprise: it was Notch all along.

Anyone got that image of Yandere Cuck's code?

In XCOM2 you can skip the loading screens by pressing Caps Lock.

Found only this one by some user from /tech. He made more i think

I want more

...

Oh god.

...

This has never worked for me.

dk or the image?

dk is absolutely true

Is joke, yes?

Remind there's a reason we stopped doing this. In the fucking 90s

I'm no programming, but isn't this what setting up character states as switch case statements are for?

that sounds a bit fucking retarded.

Pretty much, this faggot is trying to sell this sort of rubbish, unoptimized mess that I guarantee you is going to end up piling up in size and scope until no more people can run it, interests wanes and all comes tumbling down onto him.

...

Took me some time to find the video. Basically the physics and animations in this game are tied to the fps(for instance the speed that an object falls at is tied to the number of frames per second) and the loading screen waits until the object makes a full rotation(or reaches a certain value so that the user had time to admire the high quality texture) until it starts the game. Because the fps is higher then it takes less time for it to rotate thus it loads faster.

Also A LOT of things tied to framerate in ds2. Only game was made with 30 fps in mind and on release version they just doubled it leaving a lot of things broken.

Wasn't everything doing twice as much damage, because the frames where the weapon was in the target were doubled, or something?

i remember hearing that the AI in FEAR was so good because of a bug that made them constantly check for cover, rather than only doing it a few times

Fuck off gook.

are you fucking kidding me? that is the most retarded fucking thing ive ever heard. tying it to the framerate is bad, but having the loading screen remain in place even though the loading is done, just to show of some medium quality asset it fucking unforgivable.

Even better, apparently the game loads slower when in fullscreen as opposed of windowed mode.

Holy shit I didn't think that was real.


I remember someone saying the AI in Galactic Civilizations 2 was doing shit not even the developers were expecting them to do. Don't quote me on this though.

You know, there's this reverse moore's law: increase of computational power of computers is offset by increasingly incompetent programmers.

I've never heard that. What I heard was that it was a fairly barebones AI that mostly just reacted to what you did and tried to keep cover between the two of you. Because of that, when it fights other AIs, they mostly just stand around shooting. No flanking or cover or anything.

That's how they tried teaching us programming at school. Kek. "Just use if/else, we don't need to talk about switches yet."

Max Anarchy/Anarchy Reigns had some shit tier netcode that for some reason caused Black Baron (only nigger in the game) to 1HKO with his Killer Weapon when ping got too high. I abused it before the western release when playing with the nips on my import copy, even managed to get all other 15 players in a battle royale to team up against me once.

That explains Mighty Blunder 9 failing to even hit consistent 60 fps despite having PS2 age graphics. That thing is a fucking mess.

i can bet you he doesn't even use inherited classes anywhere

It also took them until the expansion to implement proper separators for their numbers.

It's not even about switch statements, which are more or less just syntactic sugar for if/else. You could save yourself a lot of work just by using BASIC FUCKING BOOLEAN LOGIC.

It really makes you wonder where all the money went. It's got PS2-era graphics, shit art direction that just draws attention to the bad graphics, mediocre music, and subpar gameplay. I guess they just spent all the cash on underage hookers.

I found this in the code, Swedish programming.
There was something else about a couple functions with a thousand string constants for naming inside a case.

Haha what the fuck are you talking about classes, the stupid fuck uses literal strings instead of boolean bitfields.

pretty sure he'd do best by using a switch with an enum

I think there's a good reason for doing this. Perhaps it makes hit detection logic, just as an example, easier to track and more accurate.

Into their pockets. As long as they fulfilled their Kickstarter promise of releasing the game(which they did) and the fans are satisfied(which are idiots anyway) then it doesn't matter how much of that crowdfunded money they actually spent on making and advertising the game.

You know you can have time run independent from the frame rate

The developers of The Guild 2 thought it would be a good idea to implement multiplayer by taking single player and just synchronize everything on top of it. Needless to say it is just impossible to play for longer than 15 minutes, because everybody is literally playing a different game by then.

I hope The Guild 3 will be good.

yes, and I'm not talking about time.

Pretty sad/ I would have actually liked a decent Mega Man successor. I'm a big fan of the series. I guess I have Shovel Knight, Legend of the Dark Witch, and (maybe) Cuphead. None of them have explosions that look like pizza.

...

When it comes to graphics I always think back to Torchlight 2. The game came out four years ago but it runs smooth as a baby's butt, has great graphics, has a shitton of action and particles flying everywhere. I can go back to that and not even notice the game's age - if only devs would stop spending millions of dollars into graphics and going bankrupt when gameplay became shit and work on making the game fucking good then I would be happy.

Is there any reason why I can control only 3 characters at a time. Why can't I at least control 7 at a time?

hence why older PCs had the "turbo" button. It underclocked the CPU so games ran at the slower speeds of cpus before.

Command n Conquer 2 was lagging because of construction sounds. But may be it was because of modern windows and old game.

It was breaking weapons at double speed. Weapon breaks on contact with enemy and 60 fps instead of 30 means that weapon was in contact twice as long. And slow weapons could be destroyed in a fucking 5 hits. I used to bring 3 copies of the same weapon to one of the boss fights.

Well fullscreen/window can be quite different, so its justifiable more or less. There are a difference, but that should be fixed before the release.

Its not unusual.

In doom 2 player pc speed affect your ingame speed and color. Fastest one was green. And it was not unusual for other 3 to gang on him. Which was stupid because that way he has 3 targets and can gain 3x frags. But we stupid kids, so its okay.

Woman studies says that object oriented programming is objectifying weman and should be destroyed.

Classic. Deponia games has same problem. And Aurora.

The "good" reason for doing this is because it's easy. There are no other benefits. Trust me, I'm a doctor.

it's not necessarily easier, but it can possibly guarantee better accuracy. Seeing how some frame independent games track things like hit detection, player location, etc, makes me wonder if it's more reasonable to tie some things to framerate.

Yeah, the Torchlight games don't have the greatest models, but the art direction makes it work. The lighting in what I've seen of MN9 just really drives home how bad those models are, rather than hiding it or working with it. Art direction is way more important and MN9 fails hard there.

Oh, that's what it was. The only game in the series I ever played was Demon's Souls, so what I heard about the fps thing in DS2 was from my brother.

I don't get it why not just declare them as x1, x2, x3 and so on?

Say you do 60 fps, if the PC can't run that fast for any reason anywhere anytime, then you're fucked. Most notably that monitors don't sport exactly 60 fps update rate, it's always 60.085 or some shit. Then your game will run slightly faster or slower depending on particular monitor, or will have ugly unfixable tearing. And get this, maybe in the future 240 fps will be the norm, then what? Because your game still can't run any faster than 60 fps which is utter shit even by today's standards.

the only good thing about the models in mn9 is call's model has panties

Sort of. While he isn't doing anything specifically wrong switch cases can help in this sort of decision making. Comparing strings instead of enumerated types is the biggest mistake here. Ideally there would be no switch statements but instead a foreach loop against each type of valid state combination

if you're building your game around a 60fps target, that's fine. I honestly do think PC should be a tertiary audience.

try 24 fps

Yeah but they didn't use the best design (E).

Sounds like you are thinking about tickrates. Not the same as framerate, but works in a similar manner. The only reason to tie anything to framerate is because you don't want to make a tick system or worry about delta calculations.

This makes GTA San Andreas so annoying to play on PC nowadays. At least on console I'm forget to have it choppy, I can't be tempted to turn on the frame limiter on PC though.
Anything related to swimming is based on the framerate in that game: the higher your FPS is, the slower you will swim. Running at 60 FPS and higher will make the mission taht requires you to dive impossible, it also makes boats slow to a crawl and makes the seaplane impossible to take off.

a tick and a frame can behave as the same thing, there could be latency issues that disturb tickrates as well, making frame rate a more reliable option.

Are you retarded? Why am I asking? The answer is yes.

I'm an armchair developer, but if I had choose between spending money on super detailed models that demand high computer specs and are time consuming or making the game vibrant and colorful and easy to look at with a distint visual style I would go for that every time.

I don't see how, as framerate is tied to rendering, a arguably more demanding process with a higher potential for latency issues. You make no sense.

Definitely. I'd rather have a decent color palette and lighting than higher quality models that will look like garbage in 5 years anyway. Viewtiful Joe versus Call of Duty. MN9 just has neither.

And who should be primary? Consolebabbies? Then why bother with framerate? They'll eat up any kind of atrocious shit anyway.

VR is already pushing for 90 fps as bare minimum, that is a game shall never run under this figure, under no conditions, ever. In the future the main display for VR devices will have even higher update rates and so baseline performance will be set even higher as well.

Easier as in "its easier to copypaste 10k lines of code and edit them, than to make one procedure".

Most of their games has the similar problems. Its just they dont try to "lets just double veriable that affect every aspect of the game, what could possibly go wrong?" I personally play ds1on 35 fps because everything higher breaks the game and even 5 points over 30 fps fixes a lot of framedrops for some reason and makes game run smoothly.
DS3 runs fine, but they worked on that engine for many years.

Shitfuck

Which game dev and making my own engine I found inherited classes to be relatively rare. Sure there's usually like a base entity type to the object but most the time I don't need to override it with new behavior. Usually if I do it'll be a general class used in an algorithm for
generic typing that's all.


Where's that one picture

fair enough, I suppose you're right given you can control how a tick rate is computed based on an engines internal timer tied to cpu.


considering how many more sales are achieved on consoles and how games can get funding from places other than early access and kick starter, yes, consoles should be the primary target for games.

...

Legend has it that DK64's development was rushed for the holiday season. Speedrunners can tell you just how broken the game is as a result.

Looks like I was right

Hell even Okami. You look at that shit and the last thing that comes to my mind is "dated".

...

I've caught myself coding that sort of mess a few times

Some games like roguelikes are tick based so you can see a thousand ticks before character can make a move. Some games run at 60 frames per second. You can of course this occur at the same time because all you do is separate the rendering the update logic.

True. Viewtiful Joe is just one of the first games to come to mind when I think of art styles.

Then congratulate yourself, you're part of the problem of the whole vidya industry casualization and appeal to normalfags instead of actual gamers.

Now I was watching game grumps and they had Grant kirkhope the composer as a guest on it once. According to him they only shipped the expansion pack with the game because there was a game breaking bug that would only occur with N64s that did not have expansion pack. As soon as they put the extra ram in, the bug disappeared and they could not figure out where the issue was so they took a loss and just shipped it with the game

if x==1 then print "1+2=3";
if x==2 then print "2+2=4";
if x==3 then print "3+2=5";
etc

Is C too primite at this point to make games?

Why are you people doing this to me? Reading this shit is painful.

Not just DOS games, tying your game speed to CPU clock speed is a prevalent method of programming for console exclusives and ports.

Some games do it so bizzarely that only some sections are tied to clockspeed while others have a hard framerate cap. You can see it by overclocking emulators.

C is never too primitive. However you want C++. The thing about making games is that I've never once in over a decade ran into a situation where code is the bottleneck - it's always rendering.

If you're looking to optimize, optimize your shaders first.

i can't find the image of code where some woman tries to do a factorial function but it only goes to number 10

its supposed to return 1 right?

I'd say yes just because even though you can hook into opengl with it it's just a really basic low-level language and you don't need to interact with hardware and registers directly.

Games like ni-oh and gravity rush 2 don't really appeal to normalfags, but I'm being realistic here. Console games sell more, the focus on a single spec gives more time to optimize, get the most out of hardware and when the system manufacturer can provide direct support you can get some amazing results.

At least it's not that one image of a chick comparing her simple math operator filled with #WOW I'M SO AWESOME AND RANDOM \^_^/ comments filling the place to something by John Carmack(?)

s-s-sauce?

there are people like this browsing Holla Forums right now

No it would return true because it's a Boolean comparison. The whole statement is garbage because it could be simplified to just return x.

With Vulkan that bottleneck is shifting. One of the reasons why OpenGL sucks was all the call overhead. That and the fact that it's a gigantic state machine.

To be fair factorial functions usually do break at 10 or more and overflow. I've even seen Game Jam code do this just because they need to implement things in a rush and don't have to be proper for all use cases

It'll take half a decade for Vulkan to be embraced by the main stream. And even then rendering will still be the bottleneck, simply due to the sheer amount of computation involved. In comparison, running game logic on a single thread is trivial.

What the fuck are you assholes trying to do?

I know exactly what you're talking about and it's awful.

Could be justifiable if you never need a factorial higher than 10, but at that point you're better off just storing the answers as a lookup table.

triggering people like you

the fast inverse square root wasn't by john carmack

Is that the one where she had a random() function that just returned 5?

It wasn't? Guess I was wrong about that.
Where's the fucking image I thought Holla Forums would it have it or something

You can just take it from the developers themselves
They admit the game is so broken that they couldn't figure out what was causing the game to crash without a memory expansion so they shipped it with the game for free.

nah, he just used it. He didn't even get how it quite worked.

He didn't invent it but it's widely attributed to him just because it crops up in their source code is actually by another programmer on his team I think

You're probably right about the timeframet for Vulkan, although I wager that the time is based on how long it takes for accessible middleware to spring up. As for single-threaded game logic, it is dead simple, but the last 10 years should also have indicated to you that scaling is now about parallelism and not IPC or even simple clock speed. You miss out on a lot of potential performance by not taking advantage of that.

no, i mean the function went something like this
int factoriel(int target){if(target==0)return 1;if(target==1)return 1;if(target==2)return 1*2;if(target==3)return 1*2*3;if(target==4)return 1*2*3*4;if(target==5)return 1*2*3*4*5;if(target==6)return 1*2*3*4*5*6;if(target==7)return 1*2*3*4*5*6*7;if(target==8)return 1*2*3*4*5*6*7*8;if(target==9)return 1*2*3*4*5*6*7*8*9;if(target==10)return 1*2*3*4*5*6*7*8*9*10;if(target>10){cout

No, it was invented in the 90s by Silicon Graphics.

The things you learn every day.

It was implemented in Quake by another id programmer, but was invented earlier than that like said.

What the fuck

I can't believe this is real, just because people are too lazy to do such stupid shit.

I should really say discovered, not invented. It has to do with how 32 bit addresses work in the IEEE-754 format. It's essentially pointing to an address which derives a value which is good enough for approximation for the fast square root. It's not 100% accurate, but it's good enough that it doesn't matter.

factorials beyond 10 were out of the scope of the program

This reminds me of forcing vsync in Morrowind or Oblivion and having the loading bar only update once every tick, so it always takes at least 60 frames to load no matter how short the time should be. Wouldn't be surprised if that happened in other games not expecting vsync as well.

I wouldn't doubt it just because it's the most direct solution and they can't think about abstract ways like for loops and iteration. I've heard stories where programming students in high school like young girls with putting "instruction twice just to make sure the computer got it"

Close; it's derived from how floats are represented in memory. Here's some explanation: h14s.p5r.org/2012/09/0x5f3759df.html

int test(int a,int b){if(a==b)return a+b;elseif(b==a)return b+a;elsereturn 5; //BECAUSE I'M JUST SO RANDOM ;)}

Why can't people into for/while loops?

because loops are a tool of the partiarchy

...

This is the work of a retarded 3 year old who doesn't understand math or the worlds greatest troll.

Here's another one.

well at least he's using bools
why does he use this. everyhere?

the other thing is the string comparisions are magnitudes more expensive than usual number crunching with enums. but it could work if he was using sets, dictionaries or other hash based constructs, just not for enums or the if spaghetti yandev loves to write

...

the reason why factorial beyond 10 doesn't work is it's way past the maximal 32-bit int value
you need a float/double or bignum for that shit

Holla Forums don't you fucking start.

He's referencing the current instance of an object.

what?

but you don't need to do that
you could not write this. everywhere and the result would be the same
at least in unity, no idea how it is elsewhere

Which is implicitly referenced when you just use the fucking variable. It's an overly verbose "practice" that faggots use.

Reading all these is giving me an out of body experience, I was hoping to see neat programming tidbits from games, instead I feel a mix of anger and anguish

If C# is anything like Java, "this" is mostly used to resolve ambiguities, for example:

public class Foo { private int bar; void setBar(int bar) { this.bar = bar; }}

I've seen comparable code in SS13 and that engine has less capabilities
when your code resembles a shitty unoptimized game developed by amateurs in an awful language…


object localization means he could be aiming for multiple players simultaneously or he's just being fastidious, but holy fuck

eh, that kind of just seems silly considering you could avoid it by having different names

Consider a case when you initialize an object with arguments that have the same name as the member variables that they are assigned to.

Sometimes you can't help it.

...

Variable prefixes are cancer so I'd much rather use "this" in setters.

In some languages case statements are optimized, but more often than not this would get compiled to the same as a switch.

But that's not the problem. He is using a String value for Witnessed. Comparing strings is kinda expensive in some languages, and this could be done with an integer/short with flags, so that's one of the problems this code has. However, it is this decision that is making the code suffer the most in a shitty domino effect: the choice of String for Witnessed is forcing him to make MULTIPLE FUCKING STATEMENTS THAT WOULDN'T HAVE TO BE DONE WITH FLAGS, BECAUSE THE PRESENCE OF SOME FLAGS ALWAYS TRIGGERS THE SAME REACTION. Notice how checks with Insanity always give the same reaction ("Teacher Insanity Reaction"), then checks with Weapon always give "Teacher Weapon Reaction", then Blood.

This fuck has managed to transform what would amount to 3 checks to 7 fucking checks because he doesn't know what flags are. This is terrible, it just shows the guy has no fucking idea about programming and I would expect even worse code from the more complicated parts. This is going to run like absolute shit.

what gaem

That's entirely a self-caused problem, though,whch can be solved simply by calling the input variable something else.

Plus, I think it's pretty safe to assume that's not the case here. He would have to have a separate class variable for every single one if his input varuables for the amount of "this" on that page to be necessary.

int m_iWhyWouldYouSayThat;

this

They also removed jumping later on (at least for NA servers). While jumping didn't really get you over gaps or up ledges, there was still the jump attack which is gone forever now.

You assume VR will replace computers or, indeed, even become mainstream.

...

You're forgetting the (float)6 instead of… you know… 6f.

Holy shit this is bad code.

Filename, m8

Wanna hear something funny? C# should be able to cast an int to an float on its own when passed as a function parameter. It is completely superfluous.

yes I want to hear something funny.

The trailing f in floats is a semi-verbose convention that I do support because it makes it easier to differentiate between ints and floats, and conversely, functions that take ints vs functions that take floats.

That is the case since Morrowind.

@SWEDEN
PRINT "YES"
GOTO @SWEDEN

It's not Holla Forums's fault if people are giving nonsense advice.

what are some examples of bugs/unintended mechanics that make the game better?
rocketjumping and bunnyhopping are the two that come to mind most prominently.

Yes, that is a good joke.

Skiiing in Tribes

I've seen a bunch of nonsense coding advice ITT, "use C++" isn't one of them. It is Holla Forums's fault if they think game dev is stuck in the mid 90's and thus you should use plain C and ASM for everything, and that's not even the worst of their autism. That would be when they get into how everything not written in their pet LISP meme languages is oppression.

Modern /g/ Holla Forums hates Lisp.

assuming it's true

The bullshit physics of the football in Mario Strikers Charged, coupled with a move that I think was either added very late in development or intended to be a mere "clearing" motion. It turns the game from arcade fun into high paced competitive action.

How do they read SICP then?

I hear Spyro was one of/the first games to implement Level of Distance, where they'd swap between hi-res models when the camera is nearby and lowpoly with only colors when further away. The one thing I'm not sure how they did so well was having the level mesh seamlessly transition between the two models, as I don't think the mesh was split into grids of separate models or anything.

could be some shader trick

I know that's bullshit because Super Mario 64 had it. I'm sure some Saturn games probably had it as well.

Not sure about Saturn games, but I don't think SM64 does it. The level mesh was usually just there and the entities would pop into existence as you approached.

the original Seirous sam used to do this, except the models actually degrade in polys at far distances and then regain polys as you get close
for some reason they ditched this in serious engine 3/hd versions, which made me a bit sad

C is fine. You have to know what you're doing but if you don't learn C you'll probably learn shit coding habits. If you need a fast engine, C is one of the better languages to code in.


Jesus fuck, no.


No one gives a shit about how mainstream it becomes (and incidentally Valve is pushing heavily for more Vulkan usage since they want to move off of Windows before Microsoft finds a way to fuck over Steam and force everyone into Windows Store shit sorta like the Netscape vs IE browser wars). If you learn Vulkan you'll be ahead of that curve and if you code your own Vulkan the mainstream becomes irrelevant.

It's better to be explicit about what your variables mean. If you leave the this. out, while peering through the code, you could get into some sort of ambiguity (you can't instantly tell if the variable is supposed to be a property of the object of a local variable, for example). Using this. ensures that you can visually tell what it is, even if it doesn't do nothing.

Unless you're doing low-level programming, you write the code for humans to read, not the machine (and the compiler can usually optimize away some constructs that look inefficient).

I like seeing these because I see them as a test. If I can't figure out what's wrong with them or can't think of something better I'll hang myself.

Tell that to ToadyOne.

I rmemeber Final Fantasy III (US SNES version) has this arcane bug with Relm's Sketch skill, where if it failed AND you had a certain spell on the 23rd position in your spell list, the game could freeze AND corrupt your saves. It made a generation of players suffering with PTSD and trauma of little girls, I'll tell you that.

:^)

Shit code tends to stick out because it's either really long or forms some kind of right triangle, or both. Generally speaking, if you're writing a bunch of code that looks really similar, you're probably doing it wrong.

Can't have any discussion related to programming without cancer from Holla Forums showing up to ruin it.

SM64 had LODs for Mario himself at the very least.

if (1) {

} else {

}
who never had to develop a block of code without knowing yet what to test for?

I've always wondered how she came to the conclusion that she needed to do that.


Looking back at my highschool python code I'm glad to see there are no right triangles and that I avoided redundancy with loops. I think the time I spent being shit at programming in Roblox amounted to something.

This kind of construct is okay for debugging. It's better than commenting out code. An ifdev can also be used.

Due to having a copy with this bug, I just eventually committed to never using Relm ever. There was no end of weird things that happened with her active. I know that these days the glitch is understood to be triggered by using Sketch, but I coulda sworn that just having her in the party at all was a problem. Especially in the Phoenix cave.

This pisses me off.

I can't really give people hate for programming in a way that is easier to understand for them. Sure I normally say, programm it efficiently, don't spend too much time to figure it out however and then comment it. But if it's compiled properly, the runtime shouldn't take much of a hit.

Here's a small method I made a year ago for some CSV converter. Good luck figuring out what it returns:
def transferQuartal(self, year, quartal): return str(int(year) + 1*(quartal == '4')) + '-' + '0'*(quartal != '3') + str((int(quartal)*3 + 1)%12) + '-01'

I wasn't sure what was so awful until I noticed that instead of having a heirarchy of game overs he literally checks every single combonation.
He uses a fucking string to check basic flags
What the fuck this is textbook working harder instead of smarter

Dear god

To this day I still can't tell if the replies are serious or not

I can't tell what language this is, so I can't guess without knowing what those syntactic equivalent of C char literals do.

It's python 3

Probably modulo division.

...

You should be more consistent with the spacing of your operators.

SM64 only does it with mario himself

Bleh, I could never get started with Python. I gave it a few tries but never could come up with anything fun to do it in. Plus I hate the concept of "pythonic code." Plus they're still struggling to get people off the 2.8 train.

That's bizarre. I wonder why they didn't do it the other way around (make other stuff low poly but keep Mario the same).

believe it or not, but it follows the common python code convention at the time. With only the string add operator "+" needing special spacing.
Could be that they changed, but since I just monkeypatched this line with 300 others the very day the projects deadline was about to come in, I didn't quite gave a fuck.

Fucking normalfags.

...

don't fucking remind me of this bullshit. Just because half of your projects dependancies is now legacy because no one wants to change the code to python 3 even though there are bots that do exactly that annoys me to no end.

Python however is quite nice if you need a solution to a problem quickly, it is not the fastes language out there, but it is quite good with string operators, XML and other funky shit, espacially functional programming / lambda operators and other more advanced shit, that your ordinary indie game dev wouldn't know about because he doesn't care about it.

Probably couldn't do it with the N64 hardware at the time.

Quartal = 1 -> [current year]-04-01
Quartal = 2 -> [current year]-07-01
Quartal = 3 -> [current year]-10-01
Quartal = 4 -> [current year+1]-01-01

If that's faster to program for you than four if cases, and assuming that str*bool actually works the way I hoped it does.

Sounds like you have no interest in programming.

Fair enough.

You made me giggle. Keep studying.

wew

I have no interest in learning anything that I can't find some application for. I taught myself C/C++ and know enough Lua to be dangerous. I have a C++ project that I'm working on right now. I don't have any ideas that interest me that Python would be a good fit for, but it's been on my "to-learn" list for a while because it sees application in enough places to be worthwhile for me to know.

Not that I use it, but some other folks which specialize in automata theory and more theoretical stuff constantly use it in order to find a solution to a more mathematical advanced problem.
Also I have yet to see how games can use some lambda operator, if they want some solution fast they rely on assambly, which is way faster and honestly quite easy to do once you get the hold of it.

Also don't believe me with XML? Python supports natively an XML parser, which is relatively quickly (though sucks your RAM if you don't implement it properly) So it is often used for that shit, plus our project used a special RDF library so I had to use python.

In the G1 pokemon games, if you didn't have any money or fucked up too much in the safari, you couldn't get surf and you were fucked without hacking…

Once you get to a certain point, you'll be able to pick up every non-esoteric language easily.

I can't tell if you're serious.

...

IT'S LITERALLY THE SAME CODE TWICE
WHAT THE FUCK


>function is obviously something regarding square roots I can't quite remember what float does, and didn't learn enough code to figure out the body, but THEY CAN'T EVEN READ THE FUCKING TITLE
FUCKING NORMALFAGS


It checks for a being less than b in the first line of the actual int max function, but the double check is still bloat.
then there's the whole "return 5 if a ==b," which is beyond fucking retarded since there's literally an infinite number of integers that are not 5 which can be both a and b.

Well, at least it throws an exception.

I don't quite see what is so weird to use a language which supports somethin natively rather then throw in more dependencies.


The thing thing is, python does not support switch-cases and you would rely to if, else, elif statements, which I personally dislike.
Also boolean is stored as 0 or 1, so it works very nicely if you want to keep things short.

It's a fast inverse square root function, identifiable if in no other way than the constant 0x5f3759df in the middle of it. Float is just a floating point number. It would have been more amusing if the "// what the fuck?" was left in.

The font isn't nearly girly enough.

It's the fast reverse square root brought up earlier in this thread. A float is a floating point number, which is what you usually use for numbers with a decimal. Back in the day people used fixed point decimals because processors didn't have floating point support built in and were thus slow as fuck calculating float shit. I think the fast square inverse root is actually slower than the normal one nowadays.

Courier new is just like old keyboards XD

look at the name, it's a joke

Float is a primitive data type.
en.wikipedia.org/wiki/Floating_point

They want you to use dictionary mapping.

It is; SSE (introduced with the Pentium III almost 20 years ago) brought among others the RSQRTSS instruction which gives you a decent approximation of a square root.

Square root reciprocal I mean.

Can you explain why there's a random hex value thrown in? I can't wrap m head around it.

some magical number that just makes it all work.

yeah too bad you can't always use that shit espacially when you have very similar variables in place and just want to quickly throw something in.

See

Well yeah, Rare was a bunch of fucking wizards.

Anybody who hasn't seen it needs to watch the Conker's Bad Fur day Director's Commentary. It's quite a fucking good watch.

The main reason is that if you're on an embedded device (like a game console), you might not have the option to tie game physics to real-time. You might not have that kind of timer available, or its accuracy might be worse than the frame rate, or it might have more serious performance implications to grab the time delta every step. Frame-based physics was a good enough approximation on those consoles.

Ah. Yeah. Sure.

I completely understand all of that.

Jesus fucking Christ, dude, string formatting:

def transferQuartal(year, quartal): return '{:04d}-{:02d}-{:02d}'.format(year, quartal * 3 + 1, 1)

Or better yet, real datetime formatting:

from datetime import datetimedef transferQuartal(year, quartal): return datetime(year=year, month=(quartal * 3 + 1), day=1).strftime('%Y-%m-%d')

This way you get useable errors on a bad timerange or other bad input.

You're probably right, but apparently the N64 did have a fairly fast timer available: n64devkit.square7.ch/n64man/os/osSetTimer.htm

It may have been possible to get an interrupt on something other than VI as well, but I'm not sure.

Weren't there reports of MN9 bricking Wii U's? That in itself is pretty remarkable for a Unity game.

A string

If it's true, I'd /love/ to have some kind of technical explanation as to how they managed to do this so badly. And how it got past QA.

Nice solution, to be honest I never used string formatting like that, but I first wanted to use the datetime formatting, but since I would've needed to output it as a string anyway and I was already reading through 4GB of .csv I didn't used it.

Cheap code monkeys and no quality control whatsoever.

True. It's probably more likely that it wasn't really as big a deal back then. People weren't bitching about frame-locked logic the way they are now, so devs just did it the way they always have. The same reason why code that would have been properly done better concurrent wasn't 20 years ago, and nobody bitched about it. People just didn't know what they do today.

As an aside, frame-locked logic is still best for certain games, like fighting games, where a skilled player can lock his timings down to the specific frame. Without that, a certain queue might land between frames or something of the sort.

assuming this is c++, using pointer equality (==) with string literals is the almost the same as enum as most compilers will share storage for equivalent string literals
however this only applies within the file, the linker won't share the same string literal in two different files,
it could be reduced to a single loop through a table, or a linear access with a hash (which could be stored separately from the code)

Should be an overflow exception thougj.

NOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!

Besides it's a given that your going to write shitty code at some point. What separates you from hacks is a drive for improvement.

Read up on some string formatting. Most implementations of string formatting let you do what C's printf does. The datetime formatting is better mostly because you have the date and time as an internal time format, and can therefore change the code to do datetime comparisons, subtractions, duration differences, or output in a different format (including localized date and time output based on your locale), or whatever you want with minimal changes, plus you get all the free datetime validation because you're treating a timepoint as an actual timepoint.

As far as performance goes, the fastest is probably format. Repeated concatenation of strings tends to do a lot of useless copying, and format can optimize to avoid that as much as possible.

also assumin he's using (char*) instead of std::string

Because developers was making their games to work without updates. Coders could not use power of machines instead of optimizing everything. It was working on these machines. There was no reason to bitch about it.

in mass effect, the loading time cannot be finish until the whole background video file is completed. which means replacing the video clip with a shorter one will finish the loading time faster

Well you heard it laddies, get those nudes by rooting then panties.

Sounds quite handy, will do.
Thanks user.

Well, even today, you frequently do frame-based or tick-based logic instead of real-time logic on embedded devices. Tons of DS and 3DS games use frame-based timings. Embedded development is a completely different culture and environment, and embedded developers tend to work differently.

...

That doesn't work if the strings are dynamic. If you compare a dynamically built string on the heap with a static string in code, even if they have the same exact representation, they will compare false. This only works if you are statically assigning char * literals everywhere, in which case you're still better off using Enums.

The only case where you want to compare char pointers like that is if you are checking to see if two variables are pointing to the same string, not when you want to check their contents (semantically or otherwise).

I hate programming threads because they remind me of how much of a retard I am. I don't understand a thing that's going on in this thread.

Because it seem like a good idea at a time and after that some things start to depend/be build on it and you are too lazy to fix it.

I'm currently making a game. It's a bullet hell shmup that requires frame perfect precision and fast reaction. Currently game logic is tied to the frame rate, which is locked at 60. Is it worth it to separate game logic and rendering and implement a tick system instead? I know it's not hard to do code-wise, I'm just wondering if it's the best way.

std::string has operator== overloaded for comparing to a null-terminated array of char. It still works, but it becomes much slower.

That's how I felt as little as two years ago.

Never stop programming, and you will never stop getting better. Programming is a natural cycle of alternating between feeling very smart (when you accomplish something) and feeling very dumb (when you see more skilled code by a senior developer).

This is fine. Keep that ego, and also keep the modesty, and just keep trucking along. You'll make it.


That is true, but he was talking about the constant-time operation of comparing char *'s.

Why are you making it?

Assuming Witnessed is a char* and is assigned from a literal string, it should still work for strings assigned from the same translation unit. It's not smart, but in theory it could work.

I'd say yes because I wouldn't want the game logic to slow down if the player's computer can't handle 60 FPS for whatever reason.

I love shmups and want to make my own.

It's going to be a toaster game. It would be rare that someone's computer shouldn't be able to handle it.

Here's some reading for you: gafferongames.com/game-physics/fix-your-timestep/

depends really
im not great at programming, so i might be wrong, but i do know two things for sure, if someones PC cant hold stable 60fps in your game its a waste of fucking money
and also from my experience in Lua and reading its docs about delta time, its never 100% accurate.
still do it, the former issue will make or break your game

Oh, I know. I'm a professional C++ and Python developer. I was just replying to the post that was talking about char * comparisons being constant time.

I never started m8. I made a few shitty websites in html when I was 12 and got bored.

Locking game logic/physics to frame rate will make your game deterministic i.e. if the same input is given to each frame, the game will always produce the same thing.

I’d say to choose which case is more appropriate for you: the game runs in slow motion or the game will not always be exactly the same.

what


The only reason anyone does this is because it's easy. That is one pro in a long list of cons.


user, let's be honest, VR is going to happen. This isn't going to go away like waggle controls did.


You'll change your tune if you ever do enterprise-level programming and have to work on 15 year old code.


No one who isn't a neet-autist would ever advocate C outside of embedded programming…


… and here is a NEET/Autist in his natural habitat. I suppose I should have seen this coming.


Python is fine for prototyping, scripting, even small programs. I've even seen it get a lot of use due to the impressive availability of statistics libraries (for people who can't be assed to learn R anyway). But for serious apps or games, I'd never use it.

But fuck "pythonic code" in the ass: what a shitty concept.


Reminds me of when I was in school and someone said they could calculate any prime number by just testing them in if statements up to 14. I lol'd. He failed.

Soyou making it for your own enjoyment therefore it doesnt really matter how you code it as lons as it works for you. If you were making it to improve yourself I would recommend to make it the right way, but consider the amount of time you will need for it.

nice shitpost, go post that to Holla Forums for a better blowback

Perhaps he only enjoys well-made shmups, and wants to make one of those.

I'm perfectly fin with maths but I just don't have a handle on getting a good dye job. Should I just pop the lenses out of my glasses? I really don't need them.

Are you sure about that? Wouldn't a delta time based game just drop frames?

It will be PC only and I don't plan on selling it. It's a hobby project.

I want to make it good. I want to be able to increase the FPS of a game without having it increase in speed.

theres a moderately popular online game that had a game breaking bug where filling a chat buffer with '\t' crashed the server, presumably they were doing something dumb like converting the escape chars into literal representations and then having an overflow

that bug lasted for about 2 weeks because the server crashed before broadcast so no clients saw it, and only a select group of pranksters and their friends knew the repro, they would kill it whenever they were about to lose lol

This happened in Runescape. It made everyone DC if they had chat on and someone typed in µ.

It's not c++, it's made in Unity. C#. Where strings are really fucking slow.

Why would it cast it to a float if it doesn't need to? They probably left it up to the programmer to use it on a case-by-case basis, rather than wasting cast overhead on needless calls.

Yeah honestly, even those coding standarts are weird as fuck for me, and I use a lot of python regularly.
Who the heck learns python instead of R? R is literally a statistic script language for scientists that don't want to go too deep into programming.

If your logic always waits for the frame to render before advancing, and always advances by 1/60th of a second, it won't drop any frames. From the perspective of the game objects, everything is moving 16.66ms at a time, all the time. The user will see the game slow down as the framerate dips.

Constantly manipulating strings in C# can be slow, but the strings themselves aren't. If you need to dynamically build a string for a return, the StringBuilder class exists for just this reason.

Yandev is using C# and Unity I believe. Don't have to worry about headers and linkers.


While this is true for C++, C# strings are immutable, and any modifications result in a new string object.

That's what happens currently. What would happen if the game logic and rendering were separate?

Even more reason to use proper Enums.

The fastest and easiest is the way to go. Except usually the right way is the fastest and difficulty is irrelevant if you know what to do.

Hit send early:

Not to mention the obvious implications of ordering with the strings. "Weapon and Insanity" != "Insanity and Weapon". It's also horribly inflexible. Adding a single new condition increases complexity quadratically, and it really shouldn't.

Enums are just a pretty wrapper around any integral type (Int32 by default in C#)… personally I dislike them unless I'm using flags

Typically, you still have them in the same loop, but you measure the previous frame time as you go, and step forward the physics by the amount of time the previous frame took to render. You tie everything to real time when you do this, rather than expected frame time.

That's complicated to answer. It depends on how they're implemented. If it's still single-threaded but with a variable time step, weird things can happen if the delta time is too big or too small unless you fix it (by buffering small timesteps and breaking down big ones).


C++11 adds strongly typed enums, so they get better type safety because you can't implicitly convert them to their integral representation. I'm a bit surprised that C# doesn't do something similar.

Dropped frames (more appropriately increased time steps) can result in slight change in how the physics act. The majority of games will use something akin to Newton’s method to simulate physics, and changing the time step will change how estimate compares to the ground truth.

For example think of a circle, the position, speed, and acceleration is always changing. At low frame times, the estimation is reasonably close to an actual circle, and when frame time increases, the estimation gets more and more inaccurate. In the extreme case where the object does a full 180 in a single frame, It will travel half the circumference along the tangent.

Well yeah. There are better ways to do the same thing, like virtual functions and the like (as much as people don't like them), but strings are not the right way. The point is that Yanderedev is actually using strings as flags, instead of using the exact thing that is supposed to be a flag.

And I don't know how C# does it, but with C++11 enum classes at least, there is a degree of safety and typechecking with enums that keep you from treating them directly as anything but same-class enum representations without explicitly converting them.

Hell, here it looks like what would actually be best for what he's trying to do would be a bitfield, as it is essentially just a series of boolean flags.

Usually you clamp the frametime. I clamp mine so that if it's faster than 300FPS it's treated as 300, and if it's slower than 10FPS, it's treated as 10.

hey man, masking bit strings to get a specific flag is hard :( i'd like to see you try and & two numbers

It works everyone on Xcom1 IIRC; in 2 in only works on return trips. Though when done, it makes it look like the game is lagging for a moment.

Oh Yandev is absolute trash, nobody is disagreeing there, haha.

I do enjoy casting my enums around as needed though. For example:
[flags]public enum Direction : byte{ None = 0x00, North = 0x01, East = 0x02, South = 0x04, West = 0x08,}

If I'm doing a tile map and I want to merge neighbours, I might build enums up with flags like above, then convert the entire map/chunk to a single byte[]. Hell, half the time I don't even use enums in that way and just hardcode the direction byte values

he should absolutely be using an enum (a bitfield would be better technically but would add the extra step of keeping track of what each index represents)

does anyone know if this guy studied cs or softeng or anything or is he a stackoverflow hero?

I usually built flags with bitshifting since it let me have solid numbers to associate with

[flags]public enum Direction : byte{ None = 0

N64 Zelda games Bomb mechanics.

remember how you could bid negatives in D3 and the TES MMO?

Yeah there are a few ways to minimize the divergence, but given the genre of shmup, I would probably choose a fixed time step or an on rails method.

What is the source of this?

I respect both styles and split the difference with binary literals: 0b000, 0b001, etc. One of those things that's new with C++14, and most vendors already support, but should have been there from the beginning.

I hope you joking. Next thing you say you could write drop table there.

That's a perfectly fine practice, except None doesn't need to be there, as it's a bitfield and None is implicit by the lack of any bits set. Also, depending on your language and implementation, you might not be able to set a value of that enum, because some enums restrict held values to only legal members of the enum (C++ enum classes do this, as do most dynamic language enums, like Python's).

Personally, I'd use that kind of enum, and use it to access an integer bitmask, if I have the option (unless something like bitvector or some bitarray is a better option in the language).

Speaking of C++, I'm pretty fucking stoked for C++17's std::filesystem and constexpr lambdas.

std::string_view is pretty cool too, but I'd rather have a generic container view library altogether. It would make general-purpose iteration control much cleaner. Right now you pretty much have to make a new iterator type every time you want to do something special with iterators.

question

what field do you work in where you bother with such optimisations? for comparison i work on a streaming big data/AI application which although it has some propriety data structures and functions at the lower levels in the vein of what youre posting, do you really find it necessary to do that often?

Boring shit, though it's surprisingly fun to program for. Mostly medical insurance billing systems, so we have to process and pump through so many thousands or millions of records per second (depending on the client and application at hand).

Mostly I just like optimizations. I find them very fun.

...

The thing I hate about the autism of low level optimizations is when it gets in the way of writing the code and getting it to work in the first place. I have an issue with that. Like right now I literally just said fuck object pooling for these bullets in favor of having the game actually work before I implement pooling and save all those instantiations and destroys.

Aside from that, going back and cleaning up and optimizing when bored and don't feel motivated to think as much is kind of relaxing.

Well yeah. There's a lot of truth in that Knuth quote.

Never optimize early (unless the optimization is easy and obvious). Always program with the idea of later optimization on the back of your mind though.

thats how youre supposed to do it, correctness first performance after. 80-20 and all that

Reddit called, you need to go back.

Don't be obtuse. There are tons of reasons to compare languages.

Nigga this is the most civil language discussion in a while. You're lucky this hasn't gone full Holla Forums tier greentext shitposting.

stop pulling words out of my mouth fag.
Its easier to me just copy and paste image, than to play a game "how much my sectors my hdd can write".

fucking faggot

You do know that the clipboard image writes into temp space on your HDD in Windows, right? So you're still playing that game, dummy.

Its only one fucking file, it doesn't writes same amount of sectors that would non-temp file do.
Temporary file just sits there until you replace it.

...

Tbf it probably still is best to learn C before C++ just so you get an appreciation for how mid-level languages work and how to use them efficiently before you dive into the can of worms that's OOP language constructs. That way, when you do get into classes, RAII, etc. you're probably more conscious about the impact that the use of them makes on the compiled program's complexity and thus avoid doing things like your typical Java retard who overengineers the fuck out of everything which is when OOP goes to hell.

Yes it does. It's the same size, it writes the same sectors. The difference is that it's immediately replaced.

If you're not on Windows, it's a different matter entirely, as non-shit OSes have their /tmp partitions use RAM by default and only fall back on swap if absolutely necessary.

Linux doesn't, depending on your distro. Hell, some daemons even used to break because they assumed that /tmp didn't get erased at reboot. Also some quick Google searching shows that Mac OS X probably doesn't use RAM either. OpenBSD just says /tmp is cleared on boot, and the FreeBSD handbook says " A memory-based file system is often mounted," so I assume you mean the latter.

It depends less on your distro and more on how you have it set up. if you don't mount /tmp as tmpfs or ramfs, you're probably fucking up.

Every major distro lets you customize your filesystem mount setup on install, and most of them won't complain if you change it after install either.

Any program that assumes /tmp/ doesn't get erased is fucking shit. Even assuming /var/tmp doesn't get erased is stupid, but passable because it usually isn't. There's a reason that /var/cache exists for system programs and ~/.cache exists for user programs. If it's not temp data, don't put it in a temp directory. If it expects to persist across boots, it's not temp data, it's cached data.

What I'm talking about is tmpfs, which is a ramfs that is backed with swap for low-memory situations.

Well of course every distro lets you customize it, but I feel that it's only fair to talk about defaults because I sure as hell can make Windows use RAM for %temp%, it'll just take some work.

Which distro doesn't have tmp mounted to a ramdisk by default? Not counting the hobbyist distros where you set everything up manually.

My nearly bone-stock install of Slackware doesn't:

bash-4.3$ mount
/dev/sda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
gvfsd-fuse on /home/ccfreak2k/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=user)

It's not really comparable when the equivalent in every Linux distro is literally just adding

tmpfs /tmp tmpfs defaults 0 0

to the fstab, or replacing the existing /tmp line with that.

It's common to do something like this in variable framerate games. The physics gets stepped by dt at a time, where dt is (the frames you're stepping at once) / (framerate). That way if the game drops a frame, you should (theoretically) end up in the same spot. The game doesn't feel like it's slowing down, it feels like it's getting choppy.

In practice this can be abused to exploit physics glitches, to clip through walls and objects for example because you're moving a greater distance in one step than normal due to high dt.

Is this what you're talking about, or are they literally boosting the Kong's velocity when the game starts lagging?

Sounds like the fullscreen vsynced mode they're using sleeps on present until the frame is presented in order to limit the framerate, which of course limits the amount of time available to the game to load the level. Windowed and fullscreen borderless window don't have this problem because present always returns immediately in those modes, leaving it up to the programmer to figure out how to implement frame limiting.


The trailing f isn't to distinguish between ints and floats, it's to distinguish between floats and doubles.


The PlayStation had no depth buffer, so most games manually sorted every single polygon (tri or quad) in the frame by the average depth of the vertices before rendering. The GTE has a command for calculating this. And the PlayStation's GPU has no concept of modern vertex buffers, instead every single polygon is rendered with a separate draw command. Given that, it would be easy to do a depth compare and generate an untextextured draw command if each poly is further than a certain distance away.


Because Mario needs to be visible at all times, but there's no point in drawing him in high detail when he's 10 pixels high. When other objects get too far away, they just stop being rendered and simulated.

You could also do this if you really wanted (in C/C++ anyway, not sure if C# allows this).

#pragma pack(push, 1)struct Direction { unsigned int North :1; unsigned int East :1; unsigned int South :1; unsigned int West :1; unsigned int :28;}#pragma pack(pop)

jesus christ i didn't know he was that much of a hack.

Nigger I agree with the principle but come on, object polling is beginner-tier shit and you should already have a function library for it.

reeeeeEEEEEEEEEEEEEEEEEEE

Don't know if anybody gives a shit but Jonathan Blow has been posting to his blogs writeups on updating and cleaning up Braid's code. I know a bit of programming but I'm not intimately familiar with game architectures, so I'll let you guys dissect his posts.

number-none.com/blow/blog/programming/2016/07/16/braid_code_cleanup_1.html
number-none.com/blow/blog/programming/2016/07/17/braid_code_cleanup_2.html
number-none.com/blow/blog/programming/2016/07/18/braid-cleanup-part-3.html
number-none.com/blow/blog/programming/2016/07/19/braid_cleanup_4.html
number-none.com/blow/blog/programming/2016/07/07/braid_particles_1.html
number-none.com/blow/blog/programming/2016/07/13/braid_particles_2.html
number-none.com/blow/blog/programming/2016/07/08/fabian-on-lcg-fast-forward.html

On a side note, I find it hilarious whenever he curses, it contrasts so much with the "savior of vidya" angle the media gives him.