12 ms·
More Dirty Coding Tricks from Game Developers (2010)
- busterarm 11y agoPretty sure Nicholas Vining was referring to the LithTech engine and the game would be Die Hard: Nakatomi Plaza
- avesanen 11y agoYep, this is the comic he was referring to: http://www.penny-arcade.com/comic/2002/02/11 http://www.penny-arcade.com/comic/2002/02/11
- Sniffnoy 11y agoThis is actually not the first mention of that character -- that would be this comic[0] -- but seeing as that comic doesn't mention an engine and the rest doesn't really fit either, presumably the one you link is the one he actually meant. [0] http://www.penny-arcade.com/comic/2001/07/11 http://www.penny-arcade.com/comic/2001/07/11
- spoondan 11y agoNicholas Vining was referring to the first ever appearance of the character, not its first mention. The Lithtech comic is the first appearance, and the one you've linked is its first mention.
- mikeash 11y agoInteresting. Does it not count as an appearance even though its box is there, with the item inside?
- busterarm 11y agoI also find it amusing that my favorite multiplayer PC FPS ever was released using the next iteration of that engine... (AvP 2, btw).
- golergka 11y agoI want to do something very violent to that person who "hates const with a passion". No wonder he didn't provide his name.
- krapp 11y agoCasey Muratori considers const a complete waste of time, so apparently that's a thing with some C/C++ programmers.
- cautious_int 11y agoThat is why you should never learn from one exclusive source, especially if they don't provide valid arguments, and imply "trust me". I saw a couple of his introductory videos and I think he is great to teach specifics about game programming, but should definitely not teach how to write C.
- lgieron 11y agoHis argument is that he reckons that over his career he made very few bugs that could be avoided if he had used const. He admits that it's specific to his coding style and may not apply to other people.
- hibikir 11y agoIf you want to go by authority, instead of by the fact that const just makes sense, there's this guy who claims to be a complete const nazi who you might have heard of. His name is John Carmack. http://www.phoronix.com/scan.php?page=news_item&px=MTI3NDQ http://www.phoronix.com/scan.php?page=news_item&px=MTI3NDQ
- Patient0 11y agowhere did it mention that in the article? I don't see it
- bluehawk 11y agoThe article is in four pages. I missed it at first too.
- Turbo_hedgehog 11y agoWhat happened to altdevblogaday.com anyway? It had content similar to this.
- tylorr 11y agoI've been wondering the same thing for a while. I don't know why it just disappeared out of nowhere.
- daodedickinson 11y agoIsn't it awful when such resources vanish? When Megaupload was destroyed, it was like losing the Library of Alexandria to me. The ATF can't just destroy the entire nation's set of self-storage units because they found drugs or pirate DVDs in some of the units. But that's what happened with Megaupload. Some people lost family photos, some people lost backups of theses... Why couldn't the authorities have taken it over, eliminated illegal content, and turned it over to some sort of Vichy CEO? There need to be protections for data storage customers in a FDIC sort of way, I feel.
- ivanca 11y agoPolice (and the like) are paid for capturing criminals, not for doing what is morally right (some hope they are the same thing, but many times it isn't)
- Negitivefrags 11y agoI have a story kind of similar to the one called "...Or is it over here!?" A friend of mine was having crashes with a program. When debugging it he found that a bunch of his local variables had weird values. He suspected that there might be a buffer overflow elsewhere that was trampling over the memory. The fix? Just add "char buffer[ 1000 ];" to the function to absorb the damage. It fixed the crash and it shipped like that.
- shoo 11y agoThis reminds me of an older "dirty trick" where a buffer was sacrificed, instead of added, at the end of the project in order to ship. See "The Programming Antihero"[1]. [1]. http://www.gamasutra.com/view/feature/132500/dirty_coding_tricks.php?page=4 http://www.gamasutra.com/view/feature/132500/dirty_coding_tr...
- tfigment 11y agoI've done something like this on a production data base server before. Maybe not the same thing but I allocated a really big file because mysql would occasionally grow its ibdata file to full the disk before we could handle the alert. Deleting this file allowed room to maneuver after restarting the database and dealing with this run away journal file. The other similar urban legend is the enterprise teams which have for(int i=0;i<10000000;++i); loops in code which they can remove a zero when performance boost is needed and they can quickly provide a fix.
- bananaboy 11y agoNow this is a dirty coding trick!
- ygra 11y agoThere's even a compat shim in Windows for that kind of thing where the memory manager would allocate a few bytes more than requested so that subsequent code (that ran fine in Win 95, for example) could overrun the allocated buffer without crashing. Back in Vista there were around 5000 applications that had shims applied by Windows to make them run correctly. I wonder how the count would look like today ...
- bnastic 11y agoAh, debugging games... It screams desperation when you see code that is sprinkled with "int 3" 'cos no one knows where or why it's crashing.
- CountSessine 11y agoThere's a whole lot of desperation in the air when you're final-ing and your development director is standing over your shoulder at 1 in the morning. :-)
- wh-uws 11y agoThe battery backup initialization hack from NBA JAM TE is random and hilarious http://www.ign.com/cheats/games/nba-jam-tournament-edition-gen-6289 http://www.ign.com/cheats/games/nba-jam-tournament-edition-g...
- daodedickinson 11y agoIs there an explanation for this somewhere?
- barbs 11y agoI was also looking for more info on this. Sounds like a good idea for a blog post if anyone can shed light on how/why this works.
- icelancer 11y agoAgreed. My limited Google searching turned up nothing.
- Natsu 11y agoMy best guess would be some kind of anti-piracy measure failing.
- michaelx386 11y agoThat one's included in the article, bottom of page 1 called "Flash forward"[0] > someone figured out if you played the games in an odd, and very specific order, the flash memory would sort of work. So an extra leaflet was added to every box explaining how to use this "feature." [0] http://www.gamasutra.com/view/news/249475/More_dirty_coding_tricks_from_game_developers.php#tophead http://www.gamasutra.com/view/news/249475/More_dirty_coding_...
- ketralnis 11y agoA couple of those are cited like this: > - Anonymous (sourced from Reddit replies to the original 2009 Dirty Coding Tricks article) So not anonymous at all then. reddit comments have usernames attached to them, URLs that can be linked to, and even an on-site messaging system that can can be used to ask the author for permission to use the content. Heck, every comment has an "embed" link below it to conveniently embed the properly cited comment right on your page. Is this a thing that's okay to do? Take someone else's content from someone else's website, copy-paste it into your article, and claim it was "anonymous"? Would this author be okay with it if I copy-pasted their articles to my blog? What about if I stole all of the comments posted to their articles to make my site look more active?
- rjbwork 11y agoNo, it's not okay. The media, especially gaming publications, have been doing this stuff for years now, and it's ridiculous. Some publications have wised up, but many haven't. It's greatly amusing when someone just gives up all pretense and just scrapes a subreddit, then SEO blog spams every single post - because then the members will upvote stories about how terrible the website is. I unfortunately can't find anything specific at the moment, but 2 of the big ones I remember was /r/makeupaddiction and /r/gaming. EDIT: For the curious, here's the mod post about the /r/makeupaddiction incident https://www.reddit.com/r/MakeupAddiction/comments/39o74y/mod_notice_your_pictures_are_being_used_without/ https://www.reddit.com/r/MakeupAddiction/comments/39o74y/mod... I'm unable to find the others at the moment, though there is a list under the top comment on the thread I've linked.
- bigiain 11y agoSomething something something ethics in games journalism!!! (Oh, hang on, male sounding name - as you were...)
- anonymousab 11y ago"According to a reddit comment, which we've stripped the username from" is quite silly regardless the genre of your article. There's nothing wrong with being accurate - in this case, it provides users with a way to follow up on the item in the story. But maybe the article writer asked, and the user preferred not to be named, for all we know.
- airza 11y ago> we'd inexplicably get a crash in printf [..] The client in debug would print out the hashes of every content package the server told it to load, and apparently one of them (on this build) had a % in the hash. We couldn't figure out a reasonable fix for it, but #ifndef PS3 worked just fine until the next data build Friends don't let friends printf(str).
- Kenji 11y agoI didn't really understand that problem. They couldn't fix this?? Like, they didn't know how to escape/replace percent signs or print differently? Maybe I am missing something but it does not look like a particularly elusive problem.
- bananaboy 11y agoYeah I thought that one was weird too. Also I wouldn't really call it much of a dirty coding trick if it was just something that was hacked in during development! Many times I've #ifndef <someplatform> because something or other didn't work on that platform. Then later before shipping you fix/implement it!
- pandaman 11y agoHow I understand is that they had printf(x) somewhere and some values of x included the '%' character. If this has been inside the UE and the x itself was a hash value then both replacing with printf("%s",x) and changing the x's value could be problematic.
- curryhoward 11y ago> Here is a horror story from the good old days when men were men and used DirectX 7. Ugh. > Personally, I hate CONST with a passion, so I like this trick. Ugh. > PhysicalObjects could take damage. The air strikes did enough damage in a large enough radius that they were quite literally "killing" the camera. I did fix the bug by ensuring that cameras couldn't take damage, but just to be sure, I boosted their armor and hit points to ridiculous levels. I believe I can safely say we had the toughest camera in any game. Awesome.
- shoo 11y agoRegarding the camera with hitpoints, is there a name for that class of bug? Poorly thought out code reuse? Overly specific inheritance? A similar seeming bug is the old "kangaroos with rocket launchers" story (from military simulations, not games) [1]. [1] http://www.petting-zoo.net/~deadbeef/archive/4488.html http://www.petting-zoo.net/~deadbeef/archive/4488.html
- tinco 11y agoIt's inherent to common game architecture. Far out the most flexible way of dealing with the multitude of complex entities in a game is to not work with inheritance but rather with 'components'. Ideally this means that an entity is nothing more than a UUID for which data is stored in component tables (a la relational databases). Unfortunately that approach is rather cumbersome to reason about and brings with it unhandy syntax requisites. Given an entity UUID, how do you get a value for some property? It would be component_table_get(health_components, entity_id)->hitpoints. Or something similar. (note: what happens if you accidentily call that function on a entity_id for which no health_components entry exists?) The alternative which is really fine for smaller games and which often leaks into the codebase of larger games, sometimes for performance reasons is to make the entity a struct which has some members common to all entities. Now you can do entity->hitpoints, but the downside is that every entity, including abstract game components such as the camera also have hitpoints. If you're curious why games don't do inheritance (anymore) look up articles about Component Entity Systems, they usually do a good idea of explaining why games are too complex for inheritance.
- bananaboy 11y agoI've read that Wing Commander anecdote before, and it still doesn't make any sense to me (also I don't remember that original message "Thank you for playing Wing Commander" message and every abandonware version I found had a different message - "You step out of the airlock and into.."). It doesn't make sense because EMM386 is the expanded memory manager that came with DOS. It's not something you ship with your game and can hex edit at will. Now if it was a 3rd party library that USED EMM386, and which they didn't have the source for, then that might make sense..
- InclinedPlane 11y agoIn the DOS days the operating system was mostly just a boot loader and a set of tools. Whichever program happened to be running at any given time would have complete control over the system. So a program could simply find out where any other program was in memory and modify it, which for something like changing a string was fairly easy.
- bananaboy 11y agoYeah sure, I know, so I suppose they could have modified the string in memory. But he specifically says that he "hex edited the error in the memory manager itself", which makes it sound like he modified an executable. A programmer wouldn't say he hex edited a string in memory when what he meant was he wrote some code to replace the string in memory.
- e28eta 11y agoI wonder if these anecdotes would be a good litmus test for developers. They make me cringe, but I work on business software, not games. I really don't like the idea of papering over the bugs so that your testers can't find them anymore, I'd much rather find the underlying issue. On the other hand, the described changes were often very practical, solved a customer need, and were manageable to implement. So that sounds like a win!
- gambiting 11y agoFew things contribute to it. Mostly it's lack of time, and the fact that we don't really have to support code for long periods of time. If the input code works then it works, when a game is released its code it's mothballed on a server and I don't even see it again unless there's some urgent patches(and 6 months after release the chance of that happening reduces to zero), and then I have to request IT to give me access to that code again.
- shoo 11y agoThe earlier articles[1][2] are also pretty good. I'm utterly horrified by the "(s)elf-exploitation" story. Ugh. Clever. [1] http://www.gamasutra.com/view/feature/194772/dirty_game_development_tricks.php http://www.gamasutra.com/view/feature/194772/dirty_game_deve... [2] http://www.gamasutra.com/view/feature/132500/dirty_coding_tricks.php?page=4 http://www.gamasutra.com/view/feature/132500/dirty_coding_tr...
- olorundaglory 11y agoAUCTION..... AUCTION........ AUCTION.......The Nigeria Custom Auctions Is Up Again and Granting Nigerians the Privilege to Own Vehicles at Affordable Rates. Approved By The Federal Government Of Nigeria, All Individuals Should Note That These Vehicles Are Impounded Due To Smuggling And Improper Importation Which Has Resulted In The Forfeiture Of The Said Property As Penalty For The Illegal Act. Consequently, These Impounded Vehicles Are Now Being Auctioned To Eligible Nigerians In The Ongoing 2014/2015 ( N.C.S. Batch B-) Vehicle Auctions And This Action Is In Line With The Directives Of The Government Of The Federal Republic Of Nigeria. These Vehicles are neat, in a perfect condition and Has Never Been Used In Nigeria. The Vehicles Are Currently In The Custom Warehouse At Ogun State, Idiroko Border Ports Awaiting Removal By Clearance.. Contact Address: Operation 2-Enforcement Office, Idiroko BordeCommand. Contact MRS OLORUNDA GLORY ON 08068017569Name:zonal commander Public Relation Officer, Federal operations Unit, investigation and inspectorate. Contact MRS olorunda glory 08067834923Office Mailing Address: Nigeriacustom916@gmail.com THIS CARS AND SUVS ARE VEHICLES RANGING FROM 2001 MODEL TO 2013 Prices of some Toyota cars: Land Cruiser-N700,000 • Toyota Prado N900,000 • Toyota Corolla –N500,000 •Toyota 4Runner-N850,000• Toyota Tundra-N700,000• Toyota Tacoma-N750,000• Toyota Camry Tiny-Light –N350,000• Toyota Camry Spider-N800,000 • Toyota Camry Muscle-N700,000• Toyota Avensis – N200,000-N500,000 • Toyota Yaris – N300,000 • Toyota Matrix – N400,000 • Toyota Camry Big Dady-N 450,000• Toyota RAV4 SUV –N600,000 • Toyota Hilus -N750,000 • Toyota Dyna Truck – N350,000 • Toyota Hiace Bus – N600,000 • Toyota Coaster Bus 32 seaters – N600,000 . Toyota highlander- N800,000• Toyota Sequoria-N500,000 • Toyoya sienna -- N550,000 • Toyota Avalon -- N500,000 • Toyota Venza --N750,000 Prices of some Peugeot Cars Peugeot c230 N300,000 C300 N450,000 Peugeot-406 N500,000 prices of some Honda cars Honda Civic cars – N350,000. Honda CRV 400,000-750,000. Honda EOD 600,000. Honda DC 700,000. Honda Evil Spirit 800,000. NOTE=The nigeria custom service Recruitment and Replacement of new take is on for BATCH 1 hurry up For more enquiry call MRS OLORUNDA GLORY ON 08067834923 Thank for your patronage.
- plq 11y ago> I then remembered that when you put the window in the notification area or in the start-menu bar, Windows immediately reclaims unused/freed memory. Wow. Is this a horrible hack or a wonder of the tight integration between the GUI and the kernel in an operating system designed to be used in a desktop? I'm torn :)
- dfox 11y agoI think that this is some kind of oversimplification of what actually happened. AFAIK there is not even an operation like "put window into notification area" as part of WinAPI as the icons are mostly orthogonal to windows (and are not even intended to represent "more-minimized" windows). The icon has to reference some window, but only because it generates window messages that have to be consumed somewhere. Fun fact: at least on 2k and XP, when the window goes away, the icon stays visible unless it is explicitly deleted by user code and is removed only when some message would be sent to now non-existent window (ie. when users mouses over the icon).