Saturday, December 31, 2016

In the Candy shop

       
Tell me. Is it just me, or is the modern game-industry offering a bunch of "Meh"? Once in a while, I buy something cheap on Steam. Sometimes, like "Dying Light" a few weeks ago, it brings me a decent game. More often, I play a game just a few times, then forget I ever bought it. But that's PC gaming. I'm talking about consoles. PS, Xbox, Wii U, et cetera.

My little girl is not too much of a gamer, yet she likes to sit with me playing Mario, or asks if she can drive the Dump truck in GTA5 from A to B, gently. So, last Christmas (I gave you my...) I was in the toys tore again. Clueless on what Santa should buy them. I can’t think of anything they DO NOT have. Not that they’re getting that much, but I already own laptops, phones, tablets, consoles, games, Lego, multiple TV’s, creative drawing stuff. So that automatically becomes available for the kids as well.

How times changed. The two or three times we received presents in a year, were the absolute holy grail of Joy in my youth. Lego, trains, clay, games - there was always something to desire, and browsing through the toys magazine sixty times a day prior to the December month, was sooo exciting it literally made me sick and sleepless. Unlike myself, my parents didn’t have tons of stuff to play with. Father didn’t play games, mother didn’t own a tablet with YouTube and an endless amount of movies.


The Not-Knowing-what-to-Buy Nightmare

Now, twenty-something years later, I have absolutely no clue what I would give myself, nor my spoiled kids who seem to have everything already. I hate myself for that. When young you would kill a person for a new Nintendo, or even just the empty box of it. Now, when you have all the consoles, laptops and money to buy new games, I couldn't care less. It must be that dream/nightmare I always had; given 100 bucks to buy something nice, but the dusty empty store had nothing nice to choose from. In sweating panic, you would turn over the whole place, searching for something juicy. But nothing but shit you don't want. Ten year old games, genres you don't like, stuff you already have, obscure unknown stuff that doesn’t look cool at all. Feeling your slow awakening, realizing you'll have to hurry up if you want to enjoy anything at all, HAVING to buy something, ANYTHING, you would end up with something useless. Like Dr.Mario for the Gameboy or something. And then wake up with a very bad, empty, feeling.

Did you pick a nice game already?


Yes I dreamed that several times. The horror. And when standing in a games store now, I have exactly that unpleasant feeling. So I'm staring at the Wii U "arsenal". Or well, arsenal... 20 games or so. 75% of them is made by Nintendo. Mario World, Mario Kart, Mario Moron Dance, Mario Roller chair Cricket. Half of them I already own, the other half is just too bad, or I've seen it and done it too many times before. Smash Brothers for example. Excellent game, but after playing the N64, GameCube and Wii versions, I don't expect anything new. Same can be said about most other Nintendo games btw. You keep buying them because, once upon a time, long ago, they gave you a fantastic youth. But deep in your heart, you know Nostalgia is playing tricks on you. Nothing in that game will be new or surprising, likely it will be too simple because you already solved the same Metroid/Zelda/Paper Mario puzzles a billion times before. And no, you can't turn into an eight-year old boy with an awesome Nineties kids E.T. bedroom on the attic, getting cookies from your mom before going to school with friends. Growing up doesn't work that way. Unfortunately.

Getting Bored in the Sandbox

Then the other 25% in the Wii U games rack, asides from a few exceptions, is either crap, weak versions of games I wouldn't buy on the PS4/Xbox either, or "Retro"... Yes I liked the idea of "New Super Mario Bros", reviving 2D sidescrollers, ten years ago. It boosted life into Indy game-studios to produce "8-Bit" alike games. Platformers, isometric view, pixelated graphics. Reviving forgotten genres with simplicity and fun as core elements. Yet I'm not sure how I feel about those. I bet there are little gems out there, but when you can buy massive, beautiful, technological state-of-art games like Doom4 or "The last Guardian", then a simplistic 2D pixel-zombie shooter game doesn't feel like a good buy (even when it's just 8 dollars). It's the type of game I would randomly click on a "Flash Games" website on a boring Sunday afternoon, play for two hours, and then... forget about.
 
And yeah, I tried Terraria for instance. Liking the fact I can play it together with my daughter. But then, after a few hours… what exactly are we supposed to do?? I actually Googled that, ending up in forums where people explain it's a "Sandbox game! Do whatever you want to do! Endless fun!". Erh... yeah, but what's the fun of making an (ugly) flat 2D house, made of chunky pixels? I'd rather play The Sims then. Or better, listen to my girls complaints and fix my own house, my real house I mean. Or how about finding and slaying giant Eyeball bosses? Ok... but what's the reward of doing all that? Pixelated curtains for your 2D house.

Did you finally repaint the window frames, and fixed those ugly skirtings?! I sure did honey.

I'm very old fashioned; a game needs a beginning and an end. I beat the game so I can say I've beaten it. Endless games (and that includes Sim City, Theme Park, and all those kind of games) will lose me sooner or later, as I feel the effort is getting pointless. Certainly now that I'm a grown-up, as I can spend my time on more useful things like, uh.. working. Or Tower22. Or being there for the family. Or not being a lazy asshole that sits in the sofa the whole day and try to sport at least an hour a week.


Consoles for Grown-ups: PS4 / Xbox One

Conclusion, there is nothing to buy in the Wii U section. I'm hoping "Zelda: Breath of the Wild" will give a worthy end to the not-so-shiny lifecycle of the Wii U console. In the meanwhile, I spend a few dollars on "Advance Wars 2" on its Virtual Console. Old, but a damn good game. Too bad I already know it. And too bad, a NEW game like THAT is not on the fucking shelves.

"Hahaha, you silly goose, what else did you expect?!" is what the PS/Xbox dudes would laugh at me. So I'm taking two steps further to the PS4 shelves. Being Nintendo, I never liked that "PlayStation", which you could pronounce as "Pleestation" or "WCstation", in Dutch, meaning "ToiletStation". Until my little brother and I just HAD to play GTA San Andreas, bought a cheap PS2 (very late), and also found out classic 2-player brawling games like "Mortal Kombat: Shaolin Monks" or "The Warriors" were out there. A domain Nintendo once owned with Double Dragon and Final Fight, but gave away for mysterious reasons when the N64 arrived.

Therefore, I also own a PS3. But I can count the games I *wanted* for that system on a single hand. Basically the whole Rockstar collection (with “Red Dead Redemption” as an unexpected treasure), plus The Last of Us. Oh, and Resident Evil 5 (also bought 6 but let's scrap that passage) and Little Big Planet which had awesome music, looked very fresh, but just wasn't that much fun to play in my opinion. Tried several more demo’s or games from my brother, but it was all like “meh”.

"Meh"

Now that's a box you want to buy; our English school teacher about to kick the shit out of some punker thug.

Now looking at the PS4 collection (and thus also the Xbox collection which is 95% equal) I don't get sparkles either. Not getting a Love-on-First-sight when looking at the cover art, as I would have with Mike Haggar or Simon Belmont. If the shop owner would pick up a megaphone and shout to grab as much games as possible within a minute, I would be staring, hands in pockets, for sixty seconds, not knowing what to do. I considered a PS4, knowing at least a few interesting games will be out there (Resident Evil 7 might be the push I need...). So I looked and looked in the Top-10 lists more than once, to see if there is anything for me. But... but... Most games either just don't appeal me, or I can have their PC-versions as well.


Stuff that requires a lot of "mousing", like RTS games or pure shooters, just work better for me on a PC -though I regret getting Fallout4 for the PC, instead of PS3 and enjoy in the couch. And then again, most action/shooters are dull anyway. I never understood the popularity of Call of Duty. Hundred years ago we had those "Rail-Shooters" in the arcade: camera flies a fixed path, you shoot everything that moves along. That's all. CoD is the same, except you have the freedom to run 10 meters, like a dog on a leash. Bark.

No Bot-friends to play with

Or Battlefield then. It looks so criminally beautiful that every blood cell says “buy buy buy”. But wait, says my wiser-me. You never liked the "Bad Company" demo on the PS3. Battlefield-4 was broken, and sucked. Battlefront (the Star Wars one) looks so yummy but also received bad critics for its emptiness... Alarm bells should be ringing by now. The last BF seems to fix a lot of that, but wait again, where in the Devil’s name are the Bots?! I just don't like Multiplayer in general; gunning down each other running in circles and getting yelled at by angry 14-year old pubic-hair-snots. Nothing to do with tactics. But I totally digged Bots(CPU foes) in the very first Battlefield or Unreal Tournament. Even if the A.I. wasn't brilliant, you could fill hours with just trying all kinds of crazy stunts. And being able to actually win without getting shot every five seconds, makes you feel like a big boy.


The funny part is, I hear a lot of (14-year old?) guys yelling Bots are gay, defending DICE's choice to leave them out. Main argument I’ve red is that DICE is supposed to have more development-resources on making the Multiplayer even greater by scrapping a "Bots Mode". I'm not sure if DICE themselves had this as an excuse, but how about this: If they didn't spend millions of dollars, hours and code-lines on a lousy Singleplayer campaign -which the original BF never had in the first place!-,
they could spend that on Bots. Which would mean even less work and thus even more resources on your beloved Multiplayer. Less? How so? Well, no need to design/model/produce/program single-player maps, no expensive voice-actors, no need for all those extra one-time-use-only animations, music, models and sound-effects. And the NPC A.I. that had to be programmed anyway, could be perfected for their already existing Multiplayer maps. So why DICE is scrapping bots? I don't know, but reason enough for me to scrap DICE as well then, no matter how cinematic and realistic their stuff looks. Plus I don't like their commercial. Classic song, but... Smashing Pumpkins in a World War 1 setting, really?!


Lonely LAN parties

I always bought Nintendo consoles because they make, maybe kiddy, but unique games. Too bad it's not so unique anymore after six or even more generations... I'm not too much of a fan of the PS or Xbox either, because a lot of their franchises are dumbed down milking cow games, and most of them have a superior PC brother as well. Except that playing a game with a controller in the sofa, TOGETHER, is more fun than sitting behind a PC or Laptop screen. Co-operative gameplay I mean.

How I loved to play a lot of (PC) games together with my brother back in the days. Duke Nukem, Red Alert, Doom, Hidden & Dangerous, Age of Empires, Theme Hospital. Anything would be ok. But it always got ruined. Either the games just didn't have Co-op, or were so old they only supported weird serial or IPX networks. Or we didn't have two PC's. Or the second PC was broken/too weak to run the game. Or you needed to download a dozen patches and a stinky "Sven Co-op" MOD that still only half worked. Or the game crashed (Hidden & Dangerous, ahum). Or... after all the hassle, my little brother wasn't in the mood anymore, being less of a gamer than I was anyway

Nowadays Multiplayer functionality is SO much better. But yet, I can't enjoy it. Many games still don't give you a true Co-operative mode, where you can beat the game with a friend. Split screen is often too heavy for such advanced graphics, or the game-style is just too fault-sensitive to have a second drunk running around, ruining a perfectly scripted scene. Yes, scripting & 2 players = problems. And joining (14 year old?) strangers on the internet, nah. Either they're too serious, or just not co-operating at all. Besides I don't know them, they're not in the same room, can't have a laugh with them.


Despite all it's bugs, I think Hidden & Dangerous (free download now), is one of the best Co-operative games out there. Too bad only a few persons on this planet share that thought.

Last but not least, my little brother is not so little anymore. Lives in his own house, with his girl. I have a daughter though (and boy, but he still shits Minecraft in his diapers). But take Resident Evil 5. Pretty fun, type of game where you can really help each other, supports Co-op, split-screen, we have two PS3 controllers, perfect! Except... that she is only eight years old, and gets nightmares of zombies. And even if she weren't, she would suck at it, and I would kill 99% of the zombies, or getting game-overs by her mistakes. Mario Kart and World on the Wii U are more forgiving, but I'm just too old and experienced compared to her. As if you would challenge Mike Tyson for a boxing match. I solve all the puzzles, I always beat her, I always defeat the foes. And I always lose my patience if she can't leap over those platforms for the fifth time. Bad dad. Maybe in ten years the roles are different, but as a forty year old by then, I don't think I'll enjoy playing an ancient game like Resident Evil 5 then. Too little, too late.



For the kids
Now hold on. I'm writing down this depressing story about a poor dad, not knowing what to buy, and everything sucks nowadays. But wasn't I supposed to buy presents for the *kids*? Thus not for myself, right? Oh yes. Almost forgot. So I quickly left the games-section (disappointed), bought some girl-horse-shit and a big-ass Star Wars Lego spaceship for my 2 year old son. At his age, he still eats Lego bricks, but he doesn't like toys anyway. Grabbing stuff out of drawers and whining on his mother’s leg is more his thing. Besides, he's a boy, and boys will like Lego sooner or later. See this as an investment for his future. And... father always wanted to have Lego and big Star Wars ships... The best presents are the ones you both enjoy, right? Too bad that seems to be impossible with games though…
Big world. Big empty world? I sure hope the next Zelda doesn't forget it's cozy towns and deeply hidden passages.

In all seriousness, I think kids who didn’t play Doom, Mario, Zelda or Command & Conquer a trillion times before, can still have a blast. But as a grown-up, I feel the magic is a bit over. So, as I was asking in the first line of this post, do you feel the same about that, or am I just an old nagger?

Well, let’s see what 2017 brings. Hopefully more than terrorist attacks, famous dead artists, weird controversial presidents. Zelda: Breath of the Wild… Resident Evil 7… Red Dead Redemption 2… God of War… Last of Us part 2… Tower22 playable demo? (I’m not making promises)… Maybe 2017 won’t be that bad. Have a happy, healthy, productive New Year dear readers.

Saturday, December 24, 2016

Ten programming hints. For Christmas (part3/3)





My last three programming hints for today. For this year.

8. Multi-Threading, be Multi-Careful


As mentioned earlier, only enter this domain if you know what you’re doing, and don’t enter it if you don’t need to. If you want to learn a bit more about Multi-Threading, read this, and a lot of other practical strategies, because you'll need them.            



I consider MT as a necessary evil. In Tower22, that uses a roaming world (thus not level1,2,3, but just one big world, streamed around the player), it would be unacceptable if load-operations would stall the game all the time. So they are performed in background threads mostly. But boy, they can produce ugly code. Be extremely careful when variables are shared between two or more threads, because they can give you serious killer-bugs. For instance, I should not try to draw parts of the world that are still somewhere halfway in their loading (or unloading) process.

Instead, try to think in terms of tasks. Determine what kind of tasks lend themselves to be worked out isolated, in parallel. A Server makes a nice example. Maybe we have 1 client, maybe 10. Or maybe 10-thousand. A client would typically ask stuff. What is my position? Can you insert this new password? Please return me www.brazilianfartporn.com/index.html (don't click), and so on. Now does your town-hall have a single ticket-window, queuing up all those people? Or do you open a new window for every person that walks in? In reality, option B is not feasibly unfortunately, but in a Virtual World we can.

A single ticket-window sucks. Everybody is biting his lips when the little Korean woman keeps saying yes-yes-yes, but doesn’t understand the airport lady telling she can’t bring in boiled dog embryos. The drunk Brittish chap has enough of it, and starts throwing excrement. And you realize you left your ID in the fucking car, so, back-in-line. Same with computer stuff. We don’t want clients waiting on each other, especially not if they are making havoc, or are timing-out. It makes perfect sense to treat each client-connection as a separate thread, a separate pipe. And if it breaks, the others stay intact.
I wasn't allowed to use the Puppy photo for MultiThreading, so; a bunch of fine gentlemen that understood parallel working. Except the lady in the foreground.
 


Network clients lend themselves for multithreading because A: we have to, and B: tasks have little in common – usually. I don’t care what my neighbour does on the internet. His login, logout, his website queries or whatsoever, can be done completely isolated from my connection. Unless, we’re playing a game together. Now some server has to share data. If the neighbour and I are playing online Chess, it would be pretty useful to see his latest move for instance. 

Well kids, the key to successful MultiThreading is too complicated to trash within the next few lines, but at least some here hints. And other than that, read & learn from books or the internet.

·         Use semaphores or mutexes whenever shared variables need to be read or written
o   Or use “Atomic” datatypes / instructions – with care.
o   Bools are often atomic types, so they can be used as flags (“flag_IsReading”, “flag_Done”, …)
·         And better, minimize the amount of shared variables
o   And vice-versa, minimize the amount of calls that can change states / (global) variables.
o   That also counts for single-threaded programs!
o   So if data gets screwed up, you know where it comes from.
·         Threadsafe LockedLists are useful
o   Use them to put tasks in a queue. Typically the main thread would feed this list.
o   Another thread could lock the list, pick a task from it, unlock the list, and perform that task.
o   And eventually report its results back via another locked list.
·         Extra danger when working with variables that might be destroyed in the meanwhile
o   For example, my A.I. bot scans the world, but at the same time the world is unloaded as the player leaves it.
o   Make sure you don’t clean up garbage if threads are still potentially working on it.
·         It can be useful to make a copy of your variables to work with in a background thread, and then synchronize back when the thread is done with them
·         If your code starts stinking because of confusing flags, patch on top of patch, and tricks to workaround… Better redo it. Trust me.

If your MultiThreading implementation seems to be overly confusing, chances are you didn’t design it very well. Like performance, you can’t just rip out a random chunk of code, and move it to another thread. It needs to be in the design at forehand. And as other hints keep saying here, keep it easy. If the reasons & hows behind your MultiThreaded tasks are simple to explain, you probably have a better time implementing them as well. Read about it.

9. Don’t blame your computer. Even if the bastard did it


Yes, like anybody else I have fail-days and moments that I wonder why I just didn’t become a garbage man, instead of debugging impossible bugs. The 19 inch monitor sure suffered some domestic violence when I was still a teenager.

But being a few million bugs further, I learned that I had to blame myself in 99,9% of the cases. Rather than smashing your machine, calling C++ an asshole, cursing Bill Gates and the writers of libraryX, telling it’s all the fault of those retarded n00b end-users, and swearing that the bug just cannot be true, calm down. Cup of coffee, cigarette, calm down. And learn how to fix bugs, or even better, how to avoid them.


Just like you can’t avoid stinky flies in your house, you can’t avoid software-bugs completely either. But at least you can reduce them by not throwing poop or leaving rotting meat on the kitchen counter:
·         As mentioned with Multi-Threading or making unnecessary libraries back in topic #7, avoid advanced techniques if you don’t need them.
·         ALWAYS work neat. Do not litter your code with hacks and “quickly try this for fun”
o   And if you do override with a TEST, make it very clear so you can’t forget to remove it later on
·         Do not write the same variable or state via a dozen different callers / functions / directions.
·         If you have memory profilers or leak-detectors, use them once in a while.
·         Do not keep ignoring the same bugs for too long while you keep on adding other code
·         Try Catch & useful error messages/reports/dumps.
o   Do not assume user-input or your file-loader will always work, because some douchebag eventually will feed your program a rotten carcas.
·         Same thing for anything communication related. Expect noise, expect disconnects, expect chaos.
·         Robust code. Proper naming, small to-the-point functions and using “field-tested” methods.
o   As handy and flexible as it may seem at first, don’t write 100 different ways to do the same thing

And when things do go wrong, start with Readable code. Because it’s easier to debug when things do crash. Next, develop a sixth sense for errors. Don’t give up too easily. Use all the artillery you got. Your best friend is the Debugger, standard for most IDE’s, and in most cases, very useful to pinpoint and zoom-in on the target:
·         Call – Stack / Trace
o   As the program halts or crashes, it shows the functions called earlier that brought you to this place. Maybe the function itself is not faulty, but the parameters given by its caller are?
·         Use Breakpoints to halt the program when reaching a tagged line.
o   Do we even get there at all? If not… decision gone wrong / bug earlier?
·         Step through your code, line by line
o   See on what exact line things go BOOM
o   Keep a close eye on all your variables.
o   Weird numbers? Wrong array indexing? Pointers Zeroed or never initialized at all?
·         You can use “Watches” to monitor (global) variables over a longer time
o   Sometimes global variable X may lead to a crash, but was actually mutilated by some other process earlier on.

Also don’t forget you can dump text lines or variables into a console in most cases. With this, you can tackle most errors. There are a few son-of-a-bitch exceptions though. So, first of all, do not suffer from police-investigation-tunnel-vision. Stay open for trouble-causers in unexpected corners… Which is why I warned you for Multi-Threading and using external libraries, as they can hide certain errors.


Worst thing are invalid memory reads/writes. This usually happens when forgetting to initialize pointers, or when they refer to something already destroyed. Also streaming larger data arrays and getting out of boundaries can affect innocent surrounding variables. Such errors are mostly detected right away, but in some cases your program keeps running and triggers a chain reaction of weirdness, Twilight Zone errors. The type of error that seems untraceable and illogical. But don’t forget, there is always a cause. Check your pointers. Or more drastically, quarantine code sections by leaving them out (if possible). Also memory profilers can be valuable here.

Oh, and one more thing, don’t suffer from tunnelvision either (debuggers and the tips above don’t show everything!!). If the police investigation doesn’t reveal anything, try to approach the crime-scene from a whole different approach. For example, sometimes bugs get fixed by catching another, seemingly unrelated, bug.


If all fails, have a plan-B. And no, crying is not a plan-B. Replace the faulty part with other code, or if your whole procedure was wonky anyway, redo (see lesson1). As much as it sucks, it’s part of the job.
 



10. Be consistent


One more hint, randomly grabbed from my stinky programming hat. Be consistent. In everything you do. As you think, as you talk, as you walk, as you make your sandwiches, as you program. As mentioned somewhere earlier, it’s good to view your code from a third perspective. You probably think your code rocks, but would another programmer think the same? Probably not, because programmers are stubborn and can always do better than you. But… at least it helps if your code A: just works, and B: is comprehensible.

As explained in #5, Size matters. What also matters, is consistency. If you look carefully at other professional libraries, you will notice there are certain naming conventions, as well as a certain approach. OpenGL for instance is a working on a State Machine principle. In general you would:
·         Bind the resources you want to work on or with (textures, vertex buffers, shaders, …)
·         Toggle options on/off (enable depth-testing, disable anti-alias, …)
·         Eventually issue a drawing-command
·         Bind to some other resource

You may argue if that’s easy when comparing to other API’s such as DirectX, but the point is that they use this approach everywhere. So you know what to expect. Things would be very confusing if a mixture of techniques was used. If textures would be OOP classes while vertex-buffers aren’t, it makes it harder to learn the patterns of your API. If you have to toggle off State Machine options after using X, but not after doing Y, it generates false expectations and errors.

Providing good documents is Silver, providing self-explanatory code that doesn’t need a manual, is Gold. Certainly some things are just too complicated, but at least try to.


Styles changes though. In the eighties we had big-fat mullets, in 2016 kids grow beards to look more manly, but spend more hours behind the mirror than their girls, combing and twisting that beard. Next year I expect pipe-smoking, sabre duels, and Nazi moustaches to be the trend again. Your coding style will change too. And that makes it harder to work consistently, especially when working on a large project spread over months/years, or done with multiple persons. You can write down coding conventions, though I’m the type of guy that would never read such a document again. In that case, keep looking back at other previously done code segments to take an example, instead of just writing away blindly. And even if you’re new style is much cooler than those old snippets, think again before suddenly doing things differently in the same code-base.

Be neat. If not for another programmer, then at least for yourself, in case that bitch from the office calls again with a weird problem, four years later. Do yourself a favour. It doesn’t cost too much, and that neater style you develop throughout the years will reflect in every bit of code.

 Work neat I said. Merry Christmas. Or not, if you're not celebrating it.