The Mezunian

Die Positivität ist das Opium des Volkes, aber der Spott ist das Opium der Verrückten

Boskeopolis Land: Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part XXXXV: Gravity, Hypocrisy, & the Perils o’ Being in 3D

Gravity, Hypocrisy, & the Perils o’ Being in 3D

I’m surprised this made it past the rejection bin. This started as an idle, silly idea that I planned to procrastinate to the sequel, ’specially due to the rigidity o’ this game engine, thanks to me to being a terrible programmer who was an e’en terribler programer when I started mo’ than 2 years ago. However, I figured out an easy way to do it by just adding some flags to hide all the blocks, make all the sprites invisible, & then just create a background that draws everything seen in this level. This is thanks to the MapLayer class being ridiculously flexible: it’s basically just an update & render virtual method.

This level & associated classes all have “Doom” in their name, but they should truly be called “Wolfenstein3D”, as this level uses the much simpler raycasting method that that game uses, rather than Doom’s mo’ complicated ( & mo’ powerful ) BSP trees. Raycasting works better for this game’s engine, as it works well with grid-based maps, which this game engine uses, whereas Doom’s system is based on lines which can be @ any angle ( & thus can have walls that aren’t all @ 90° angles, as Wolfenstein 3D & this game have ). That’s fine for me, since this is just 1 level & it’s s’sposed to have a retro look. I can tell you that I’d worry ’bout how primitive the 16-pixel block textures ( smaller than Wolfenstein’s, actually, but the size o’ blocks in this Mario-inspired engine ) look stetched out before I worry ’bout perfectly square walls. Since this works well with grid-based maps, I can just use a regular grid-based map & keep their usual behavior. This pseudo-3d gimmick is nothing mo’ than a visual gimmick o’er a normal isometric 2D level — basically just “Maybe I’m a Maze”, but with simpler, slower enemies that you can kill off. The walls are just regular solid blocks, the gems & hearts are the same gem & heart blocks used in all the other levels, & thus I didn’t have to add any new behavior there. Only the hero, enemy, & bullet sprites needed much new behavioral programming, & that was mostly to handle moving in various angles.

For those curious, the gist o’ raycasting is that you calculate a ray for each vertical stripe o’ the screen measuring the distance ’tween the nearest solid block on the grid & the player ( to be mo’ accurate, a point on an invisible line perpendicular to the player & a li’ in front o’ the player to prevent a strange fish-eye perspective ) & using that distance to calculate how tall that line o’ wall should be, with larger distances giving shorter lines & shorter distances giving longer lines, simulating walls shrinking in the distance. ’Course, there’s many other complications, like applying a texture to these lines ( in my case, I just calculate which texture X it should have & just stretch the texture block o’er the height o’ the line, which is mo’ efficient for SDL & GPU than manually calculating each pixel ), creating perspective textures on the floor & ceiling ( it’s a blur to me how I did this, though I do remember that the #s for the ceiling & floor are the same, just using a different offset for different textures ), & adding in “objects”, like the crab enemies, the bullets, the gems, & hearts & cutting out parts that are hidden ’hind walls ( this was actually the hardest part ). Since I have no idea what I’m doing for e’en basic programming, it’s obvious that I relied on learning how to do this nonsense from other sources, with this tutorial as a major influence, as well as Fabien Sanglard’s excellent in-depth study o’ Wolfenstein 3D’s source code, The Black Book of Wolfenstein 3D, which is what inspired this idea in the 1st-place ( though Wolfenstein 3D used so much assembly & so many arcane optimizations that most o’ its code wouldn’t work well for my project ). I did, however, twist the code I copied a lot so that it’s now virtually impossible to recognize, sometimes for petty anal-retentive reasons ( I don’t like free variables that change round a lot ) & some for optimization reasons, due to the difference ’tween low-memory computers that these guides were aimed for & modern computers with their strange GPUs & SDL with its immensely limited GPU control compared to OpenGL.

I ran into many subtle bugs ’long the way, ’cause this 3D-like business, e’en if just a graphical illusion, is far beyond what I’m used to. For instance, I don’t think my high school or my joke o’ a college I went to taught trigonometry, so I was just going off vague memories. ( I still don’t know what sine & cosine do, but I know I remember I used it for calculating angles on the shmup level I still haven’t finished yet, so it makes sense here ). & then I would just rely on trying things out & seeing what happens. The last bug I ran into was when I changed the shooting so that the bullet appeared a block or so in front o’ the player when shooting, so the bullet starts @ a size you’d expect to come from the slingshot & not @ the size o’ the screen ( which would make it look like Autumn is shooting rocks bigger than she is ), only for it to start @ the sides o’ the player when pointing in certain angles ( which makes e’en less sense, visually ). When creating this, I set the bullet to be an offset from the player’s center, which seemed most balanced; turned out, simply changing it to the x & y position ( which is the top left ) made it work exactly as expected. This still makes less sense to me.

For a long time before that, both bullets & the player moved in weird angles. This was less obvious for the player, since you can’t see them; for the longest time, I just thought ’twas just my imprecise angling while playing. I finally realized the cause was that the acceleration & velocity system I use for regular 2D movement doesn’t work with this strange angled movement. For those who don’t already know, almost all sprites move by setting acceleration, which is added to velocity every frame, which gets capped @ a set top speed, & that velocity is added to position. This works great for, say, 2D platformer movement ( & is, in fact, how movement in Mario games works — though they oft have weird acceleration oscillations for reasons I don’t understand ). However, for angled movement, this, with the velocity cap, creates a subtle problem: if your angle is so that you move mo’ on 1 axis than the other, then that axis’s speed will be greater than the other axis. However, due to the speed cap ( which is necessary to keep you from going just zipping through everything ), after the bigger axis reaches the speed cap before the other axis, the other axis keeps gaining speed till it reaches the same cap, which gradually transforms all non-straight angles ( all angles that don’t have the lesser axis as exactly 0 ) to 45°. This, logically, causes the very effect I could see from the beginning: veering parabolas. The level as shown just has constant speed for the player & bullet sprites, which fixes this ( though, an example o’ this game engine’s stupid built-in rigidity, ’cause I have it built into the core sprite class that collision detection relies on the built-in velocity properties to work, I do still have to set velocity, or else do a bunch o’ work creating a new collision detection just for this level ).

The 1 exception to this fix are the crab enemies: they still fall under the ol’ movement glitch, as you can see by their weird sideways movement in the video. I did this on purpose as I prefer this movement for them — it fits their crablike nature perfectly. The only bug with them is why I have crab enemies in a dungeon. The answer: I can’t think o’ an enemy design I like better than them & they have a simple animation that isn’t a headache to depict.

The challenge offered by the crab enemies is interesting to me: since this is a 1st-cycle level, I made this level very easy. The crabs aren’t very fast & you have to basically try to get hurt if you see 1 coming up to you & can’t shoot it down before it touches you. That is if you’re not racing round with strafing ( like in most games with 3D movement, strafing is quicker than just moving forward, which is why I move like a Goldeneye 007 speedrun in the time challenge part o’ the video ); if you are, they can sneak up on you when you can’t see them clearly.

Since this level is so easy, I didn’t feel any qualm with forcing the player to explore the whole maze & collect every gem in the level to get the gem challenge. But man can it take long, & makes me wonder if I should’ve picked a less monotonous song for this level ( “Boskeopolis Underground” had this same problem ). I was not happy when recording this video & actually dying to a crab somehow when halfway through attempting this, making me do it all o’er ’gain.

The time challenge, meanwhile, is easy if you know the strafing trick, ‘cause I didn’t want to force players to figure out such an obtuse trick to complete the game.

Source code

Posted in Boskeopolis Land, Programming

Best Quiz on the Internet

While looking up webliterature I bychance found an Animal Farm quiz & for some reason tried it real quick. I’m glad I did.

For instance, we start with this excellent math wherein a perfect 7 out o’ 7 transforms into a mere 88%:

Quiz Results. Your Score: 7 of 7 (88%). Average Score for this quiz: 5.73 of 8 (72%).

I wondered how one could make such a simple math mistake on a computer program till I noticed the average score & saw “of 8”, which indicates that this quiz probably used to have 8 answers & the developer forgot to change the max used for the % calculation for “Your Score” ( which means the code for calculating that is different from what is used for the average score calculation & that the max # is manually put in everywhere, which is to say, bad programming ).

& then we have totally correct answers, like that Snowball represents Vladimir Lenin.

Your answer was correct. Who does Snowball represent? Your answer was: Vladimir Lenin. The correct answer is: Vladimir Lenin.

¿Does everyone remember when Stalin chased Lenin out o’ Russia? I can only imagine that Stalin’s attempts to erase Trotsky from history just worked so well that the geniuses who made this quiz forgot he existed.

& then we have the best answers to any multiple-choice question:

Question #6: Who does Old Major represent? 1. The writings of Karl Marx. 2. The mind of Carl Marxx.

You know a quiz is good when 1 o’ its questions has 2 choices for answers: guy & same guy with misspelled name.

I also love how the use o’ the word “who” implies that Karl Marx’s writings & his evil twin ( ¿or is he the good twin? ) “Carl Marxx”’s mind are independent living organisms. I think I saw that in a Red-Scare-era flick, ¡Attack o’ the Living Brain o’ Carl Marxx!. It’s completely true, though: I always have to remember to keep my copy o’ Das Kapital fed & watered every day.

Posted in Programming, Web Design

Boskeopolis Land: Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part XXXXIV: Through the Sharp Hawthorn Blow the Winds

’Cause everyone loves wind gimmicks.

Those who have been paying attention to these posts since their earliest entries ( surely nobody ) would recall that I had been working on a level with this gimmick, forest theme, & palette since near the start, but couldn’t be arsed to finish due to other levels shoving it aside. ’Cept for the longest time, ’twas called “Windy Woods”, which was too unbearably cliché for me ( & “Gusty Glade” was already used by Rare ). Sick o’ so many Rareware alliteration names & puns, I stuck with an age-ol’ Shakespeare quote, showing no regard for the fact that this level has no hawthorns, & that such a name would better fit a bramble sky level than a forest level.

Thanks to using such a long name, I finally forced myself to stop being a slob & update the o’erworld inventory & level select screens to accommodate larger level names, which was done through giving the level names in both an extra row. As o’ now, this looks weird to me; hopefully I’ll get used to it ’ventually.

This was also a level, ’long with “The Minus Touch”, that I’d always planned to be 1 o’ the most challenging levels in the game ( though not nearly as challenging as “The Minus Touch” ). This can be seen in the 20-minute video, wherein, for once, I didn’t edit out the deaths @ all, so viewers can see all o’ my many failures ( since I already did the many-deaths cut for “The Minus Touch” ).

Trying to make a difficult level can be difficult itself since it can be hard to tell whether difficulty is legit or cheap. In particular, I worry ’bout the birds & the bouncing spike balls being beginner’s traps, since it’s hard to see them before they strike. But then, ¿isn’t challenging players to have quick reflexes perfectly legitimate? There’s also a spike ball near the start that you can’t see till it’s already falling ( ironically, just after a fake spike ball that doesn’t fall @ all ) — unintentionally, since it doesn’t fit in the camera from so high up. I left it in since it’s extremely unlikely a player will get hit by it since there’s no reason to just stand under it & ’cause I thought ’twas funny to have a spike ball fall after where you’d expect it to fall. The graphics may also be crowded, making it hard to make things out. The limited palette doesn’t help.

In the end, I chock this level up to be a Rareware level ’long the etchings o’ “Lightning Lookout” or, perhaps closer, “Gusty Glade”. Hell, a’least I made sure my wind mechanic stays perfectly consistent throughout the whole level.

Since the level is hard ’nough to beat ( by my low standards a’least ), I didn’t put much stress on the gem & time scores. I filled the level with gems, making its 20,000 ₧ requirement easy to meet if you wait round grabbing most o’ it in all the big caches. As the video shows, you can beat the time score by 6 seconds, which surprised me. I didn’t put much effort into trying to beat the time score when I 1st set it &, as the video shows, I was able to spontaneously figure out a way to easily slip past the bouncing spike fruit. I’ll still keep the time score, though, since it’d be refreshing to have a time score that isn’t as stringent as possible. They’re made for ordinary players, not professional speedrunners.

I’ll note that playing any other level after playing this level too much feels weird, since I’ve found I adjusted to the wind & found Autumn’s newfound lack o’ resistance o’erbearing & would way o’ershoot jumps.

Posted in Boskeopolis Land, Programming

The Problem with Storytelling in Video Games

You can’t completely break an artwork from the media it’s made in any mo’ than you can completely break the abstraction o’ anything from its concrete basis. Artwork literally can’t exist without a medium.

A corollary o’ this is that if you change a work’s medium, then you change the work itself. This is why adaptations are so controversial. For instance, ¿why is The Shining movie with Jack Nicholson that’s inaccurate to King’s original book popularly viewed as superior to the mo’ faithful miniseries? ’Cause movies are different from books: what makes good literature doesn’t necessarily make good film, & reverse.

This applies equally to video games. The problem is, many game developers still haven’t figured this out yet, probably ’cause it’s still a young medium & new media oft stumbled while trying to ape older media as it tries to figure out how to be its own thing. Much o’ video game storytelling is still done through cutscenes &, e’en worse, dialogue boxes, which are just inferior versions o’ movies & literature, respectively.

Cutscenes aren’t nearly as bad. Theoretically, it’s possible nowadays to make cutscenes that are just as good as real movies if one uses live action or pre-rendered footage. However, in reality, the economics o’ game development has ne’er led to the existence o’ video game cutscenes that look as good as a Pixar film or have the acting & directing quality o’, say, The Godfather1. &, ’course, video games are much pricier than movies, so if the video game doesn’t offer useful gameplay, — if the game’s claim to quality is based entirely on its story — then buyers are still ripping themselves off. Video games don’t just compete with each other; they must also compete with movies & literature, which are just as hungry for time & money. ¿Why waste my scarce money & scarcer time on a game whose claim to fame is cutscenes cluttered in chunky polygons & trite writing when I could better serve my time on earth watching Breaking Bad? ¿Why read the 1000th medieval RPG with hokey, inaccurate “ye olde English” when I could just read Shakespeare & get the authentic thing, which sounds 1000 times better?

But I would rather focus on dialogue boxes, since they’re worse, & worse in ways many have probably not noticed, but as someone who reads literature a’least round 2 hours per day, I have noticed quite blaringly.

The easiest thing would be to point out that many games highly acclaimed for their story don’t compare much with highly acclaimed literature. People who praise the story o’ games like Ocarina of Time or the average Final Fantasy game would probably be shocked if they were to learn that, if these games’ stories were put in book form, they would be laughed out o’ any serious fantasy or science fiction guild. ( You’d think anyone who has watched The Game of Thrones, based on the Song of Ice & Fire series would realize this, since the stark difference in nuance, character, & world-building ’tween that series & the average Zelda or Final Fantasy game is glaring ).

This is likely ’cause, unlike music or art assets, the average game’s written not by professional writers, but whoever they have standing round — usually the narcissistic director ( I’m looking @ you, Other M ) — based on the delusion that anyone can write well. This is on the level o’ logic that any guy with the generic title “game designer” you have lying round can compose Beatles-quality music. Interestingly, 1 o’ the few video games I consider to have literature-level quality writing, Mother 3, was written by an actual published writer.

But e’en if the words written are good, dialogue boxes are still an absolutely terrible way to tell story. It’s striking to me, ’cause e’en I hadn’t noticed it consciously till recently: I’ve always had this inexplicable preference for reading books o’er reading in video games, but couldn’t quite tell why till recently.

The answer is that dialogue boxes suck. They’re tiny windows wherein you can only read a few lines o’ text @ a time, whose movement speed is oft highly constricted, & wherein trying to go back & read text that’s already gone by is either a pain or impossible.

Contrast this with books: what I like ’bout books is that they give you complete control o’er the speed & flow o’ story progression. This is why I still prefer reading to watching TV or movies or e’en watching tutorial videos online. Not only that, but I can read in whatever sequence I want. Most people think o’ reading as just a purely linear, uninterrupted path. This is why so much contemporary literature is terrible — ’cause people don’t know how to read well anymo’. No, the true way to read is to go back & reread sections for clarification or just to comprehend other layers o’ the writing ( which are nonexistent in most modern literature, since, as we’ve established, they’re incompetent ). Just imagine trying to read, for example, a Shakespearean play & understand the plot, the references, the meter, the rhyme, the imagery, the tone, the theme, the use o’ consonants & vowels, & all that when you can only read a few lines @ a time & can only read them once.

This is what makes the medium an important aspect o’ a work’s quality: different mediums are inherently better & worse @ different things than other media. Literature is inherently superior @ giving textual info than video games or movies. E’en if one wanted dynamic, interactive textual content, web pages using JavaScript could do a better job than cumbersome text boxes, if people had the creativity to realize this untapped potential2. This is not to say that video games are inherently inferior to literature. Something that literature absolutely cannot do is offer the kind o’ interactive physics or level design that a classic Mario game has. In fact, “level design” is impossible in literature. Understanding this, it should be no wonder why I have mo’ artistic respect for Mario games that use the medium o’ video games for its strengths gainst the average RPG or Zelda game that just throw together generic puzzles, level design, & the most basic movement you could program just to service bootleg Tolkien told through those gimped dialogue boxes.

Unfortunately, many self-described video game critics still don’t respect video games as a medium for what it does best. ¿How oft do these critics praise games based on shoddy story & hardly talk ’bout level design, control, physics, the general coherence o’ gameplay mechanics, &, least o’ all, the quality o’ the game’s programming beyond noticing flagrant bugs? This is probably ’cause the average game critic is probably a failed creative writer — & it’s here where the ol’ acorn, “A li’l knowledge is mo’ dangerous than no knowledge” returns too true.

This is troublesome, as it’s a bad influence on video games. When you consider how li’l attention the hardworking, brilliant programmers who were able to squeeze games like Super Mario Bros. 3 onto such primitive technology as the NES compared to some jackoff who scribbled out some tripe ’bout a goody-goody hero fighting gainst a grrrr evil villain in a couple minutes & puked it onto Unity, I can’t be surprised game developers nowadays just hack their games together in some bloated engine & demand their customers have o’erpowered computers on a certain operating system with a certain brand o’ controller to run their bloated code with every shortcut taken. Gamers can’t complain ’bout getting shit if they can’t tell what shit is. That video games are, @ their core, code, makes this sentiment ridiculous — but it is true. Just as how ridiculous it is that so much modern literature tries to ape film in the vain hopes o’ getting a movie adaptation, ignoring that tiny li’l problem that literature sucks @ being film just as much as video games suck @ being literature.

Posted in Programming, Video Games

Perhaps Writing News Articles Isn’t for Everyone Either…

From the annoyingly-titled, “I’m a Developer. I Won’t Teach My Kids to Code, and Neither Should You.” ( ¿what savage puts a period in a headline? ), which, according to the page title, is also called “Teaching kids to code: I’m a developer and I think it doesn’t actually teach important skills.”, which is either to get extra SEO juice from different keywords or a hilariously incompetent mixup from modern newspapers too cheap to give a shit anymo’:

That is, of course, ridiculous. Coding is not the new literacy. While most parents are literate and know to read to their kids, most are not programmers and have no idea what kind of skills a programmer needs.

Programmer walks into a social issue & completely misunderstands history. Yes, most parents are literate — now. But during the boom o’ literature that led to the Industrial Revolution, most people weren’t. & those people who weren’t were @ a huge disadvantage.

Coding books for kids present coding as a set of problems with “correct” solutions.

& books aimed @ teaching kids literature present them stories with just 1 “correct” story, & the vast majority o’ literary schooling is still teaching kids the “right” way to write. Your school won’t give a shit how creative a rapper Ice Cube is: you write your term papers in ebonics & you’ll get marked down. I don’t see him bemoaning the fascism o’ language arts class. Maybe that’s ’cause, looking @ some o’ the style he uses, he probably hasn’t studied writing in a while…

And if your children can just master the syntax, they’ll be able to make things quickly and easily.

Hardly any learning material tries to get beginners to “master the syntax”. In fact, most hardly talk ’bout the syntax, which is a problem for those trying to learn, in-depth, how the language they’re using works in total, but works fine for those who just want to get things done to see how it feels like. That’s why they do it — it’s training wheels.

But that is not the way programming works.

Yes, & writing books doesn’t work by taking a crayon & writing inane nonsense, but that’s how most kids learn ’cause kids are kids & aren’t smart ’nough to program like true professional programmers. But if you get them used to computers & creating things on them, then it will make it easier for them get better @ it as their brains develop mo’.

Programming is messy. Programming is a mix of creativity and determination.

So is reading & writing, so I guess kids shouldn’t bother trying to learn those, either.

While both literature & programming involve creativity, you can’t just do whatever you want. It’s an objective fact that there are programs that simply won’t run. Typing out exactly what a book tells you to type out will get you closer to avoiding that than having a kid just type random buttons on a keyboard & hope it works. Similarly, being considered “literate” requires certain rules. If your kid just writes random letters that don’t spell any true words, they fail school & aren’t considered literate ’cause, just as a random jumble o’ code doesn’t give any useful info to the computer, jumbles o’ letters don’t communicate any useful info to other people, & communication is the only reason for words & programming.

Early in my career, I wrote some code to configure and run a group of remote servers. The code worked great. At least that’s what I thought until about 18 hours later, when my phone dinged in the middle of the night telling me a group of the servers had failed. Staggering from bed to my laptop, I ran the code again to replace the broken servers. Hours later, a different group failed.

“21-year-ol’ me didn’t just copy what a workbook said. ¿Why can’t these dumb 5-year-ol’s?”.

¿What does this prove other than that this writer isn’t good @ programming, but the demand vs. supply for programmers is good ’nough that his employers can’t rely entirely on great programmers? This sometimes happens to me, ’specially when it’s an unfamiliar system somebody else made; but I would ne’er pretend to myself that this process is better than actually knowing what’s wrong & figuring out how to fix things through logic & expertise, nor feel proud o’ my ability to fix my own fuck-ups.

There wasn’t a syntax problem.

But there would be if you hadn’t figured out the syntax yet. It’s also true that college literature students don’t usually fail their final ’cause they couldn’t figure out what the word “the” means in Shakespeare, but we still need to teach children that.

This guy says “early in my career”, not “when I was learning”, so this example is completely irrelevant. I can bet you that when he did 1st learn how to program, he had to learn syntax, ’cause last time I checked, programmers weren’t born knowing any programming language.

Coding is like that. Try something. See if it works. Try again.

Only a shitty programmer codes like that. Most programmers think a’least a li’l ’bout what the code will do before typing it ’cause they’re not monkeys bashing their fingers randomly on their keyboard. I’m sure Mozilla makes their programs by just typing random strings, compiling, & seeing what shit sticks. <Hmm… “error: ‘asfsdfsa’ does not name a type”. I guess I’d better type in some other sequence o’ letters & see if that will name a type. I’ll find 1 o’ those crafty fellows ’ventually>. As for syntax, having code with coherent ’nough syntax so that your code compiles is the minimum requirement, which is why those dumb books probably focus on that when teaching kids, just like how dumb reading books waste time teaching young kids something as easy & frivolous as the alphabet before teaching things they’ll truly need, like how to judge a sentence’s trustworthiness by the information not written ’bout.

If a problem was straightforward, it would be automated or at least solved with some open-source code.

¡Stupid Kindergartens! ¡Wasting our tax $ having kids write down all the letters in the alphabet when they should just have 5-year-ol’s run “npm i alphabet –save-dev” in the terminal!

If this guy had looked outside his window @ the real world he’d be surprised by how many straightforward things are not automated. Customer service isn’t quantum mechanics, but still hasn’t been automated. & open source code comes with caveats: it may only be available for other projects that are open source, may have slight incompatibilities with your project’s goals, or may just be badly made — which leads to the catch-22 problem that, in order to know whether the open source code does what it does well, you have to be knowledgeable ’nough to know what a good version o’ the code would be, & thus need to know how to make the good code, essentially. This is why people still “reinvent the wheel” so oft: it’s a great way to learn how wheels work so you know which wheels are good & which aren’t.

Finally, ’less you take the time to carefully check the open source code, it may contain security flaws or outright spyware — & may develop them after you 1st decide to use them if you upgrade the open source code without carefully checking the code ’gain, as had legit happened to WordPress plugins after they had secretly been bought by someone unscrupulous. This is why the npm leftpad controversy has caused npm to become a laughingstock by so many programmers: it’s oft simpler to code something yourself & be sure that the code is exactly as you want it than have to trust complete strangers.

All that’s left is the difficult task of creating something unique.

Which you can’t do till you figure out how to do the things everyone’s already done. That’s why John Cormack literally started by copying code out o’ magazines & running them on his own computer. That’s why Shakespeare started by translating already-written Latin texts. Indeed, read ’bout the history o’ Shakespeare’s learning & witness how much monotonous reciting & robotic copying & memorization he had to go through in that relatively conservative school he went to. Somehow he still figured out how to create well-beloved works ( technically not “unique”, since e’en the most renowned English writer copied other people ).

Also, his claim is disproven by his own example. Configuring & running remote servers isn’t e’en close to creating something unique. The vast majority o’ programmers are doing things already done ’cause the reality o’ the costs o’ using foreign code is different from the abstract ideal this programmer made up in his head.

Besides, as that emo story o’ the Bible, “Ecclesiastes”, & many emos hereafter have said: there’s nothing new under the sun, son.

There are no books that teach you how to solve a problem no one has seen before.

Which is why it’s a good thing none o’ these books offering to get kids started programming don’t promise to do that. ¿Have these books promised that your kid will be the next Linus Torvald? I haven’t seen those books myself.

Writing unique literature is also something you can’t learn from books, & yet many societies have somehow caused the literacy rate to jump from a tiny few elites to the majority by wasting their time teaching kids to robotically memorize the basic elements o’ writing so they could use that knowledge in creative ways when they are older.

The entire basis o’ his argument is, “These books don’t teach kids everything ’bout programming so they’re baby Donald Knuths, so clearly they are completely useless”. This programmer should learn what “Perfect solution fallacy” is.

One day, my son was concerned that a chair of his was wobbly. We looked at it and he helped me isolate the problem: One of the screws was loose. I found one of our many leftover hex wrenches and showed him how to screw it back in. After that, he was curious what would happen if he screwed the other way, which he did until the screw came out. We ended up taking the chair all the way apart and putting it back together a couple of times, often mismatching pieces, before he was satisfied the job was finished. Try something. See how it works. Try again.

“& now he’s already working for Google, so clearly this is better than all those dumb books”.

People did this kind o’ thing for centuries before programming e’en existed, which proves that this isn’t sufficient for learning programming @ all. You would think a’least 1 o’ the many mechanics working in the 1800s would’ve invented the kind o’ computers & software we have now centuries earlier, since apparently knowing how to unscrew screws is sufficient knowledge to become a programmer. That’s why I always put “I spent my whole day bonking pieces together till it closely resembled a chair” @ the top o’ my resume when applying to Microsoft & Nintendo. I have no idea why they’ve ne’er called me for an interview yet. Those books he complains ’bout, meanwhile, will a’least get someone a working program, e’en if it’s not impressive in the slightest, whereas this li’l adventure doesn’t lead to a working program @ all.

Of course, getting something working is just the first step of building software.

& the 1st step is necessary for any further steps, so you better make sure, ’bove all, that you can do it. & no ’mount o’ wobbly-chair sleuthing will help you if you can’t e’en write a program with correct ’nough syntax that the compiler or interpreter can understand it @ all.

The next step is to make code clear, reusable, and neat.

Many great programs, — far greater than this guy has probably come close to doing — from ’bout every game on the NES & SNES to Linux kernel code ( which is somehow the most secure kernel code, relied on by the vast majority o’ web servers, while using those dreaded gotos ), fail these 3 criteria. There has ne’er been any true scientific, empirical evidence that “clear, reusable, and neat” code is anything beyond subjective taste.

Once, early in my career, I wrote a feature and gave it to a senior developer for review. He took one look at my sloppy spacing, mismatched lines, and erratic naming conventions and just said, “Do it again.”

¿Anyone remember how this article was almost entirely him ranting ’bout how unimportant syntax is? But now “sloppy spacing, mismatches lines, and erratic naming conventions” are o’ huge importance. Clearly teaching kids a grounding in these basic things is a waste, then. I would love to know how learning ’bout why chairs wobble would solve this problem.

The syntax was valid. It was still wrong. Good coders don’t just get something to work. They want it to be good.

Which books can’t teach you, ’cause spacing & keeping lines matching is too complicated to teach, e’en though these are subjects that can have specific, consistent answers ( e’en if people may disagree on which answers are best ). Indeed, if this writer is a professional programmer, he should know that companies have documents that specifically delineate the rules they demand you follow, like Google’s Style Guides.

He goes on to reiterate that real programming is hard — which is no different from real writing, & so goes gainst his claim that being literate in programming is completely different from being literate in human languages. This is ’cause it’s not: both are just writing. The only difference is that traditional literature is aimed @ only humans, while computer programming is aimed @ computers, which think in much mo’ radically different ways from humans. & that’s the point those who make the comparison: that just as it’s vitally important that humans be able to communicate with other humans through writing to thrive in modern society, as computers become mo’ & mo’ prevalent, it becomes mo’ & mo’ important to develop the ability to communicate with them, & those who do ’head o’ the rest may have advantages o’er those who don’t.

He continues with ’nother irrelevant example o’ showing his son how to bake cookies, & claiming that it, too, teaches his son how to program better than books that aim @ teaching programming, e’en though it teaches general skills he would probably already learn in a million o’ other places & is not sufficient for learning programming — which is why all chefs can’t also make iPhone apps.

He then ends the article with the kind o’ flowery poetic bullshit ’bout how having a “blatantly employable skill” isn’t important that only a ditsy upper-middle-class parent who’s rich ’nough that they’ll ne’er have to worry ’bout their kid being able to get a job when they grow up would write. Parents who can’t afford to keep paying for their children into their 20s or who can’t afford to game on the small chance that their child will whimsy themselves into their dream job may want to stick with the solutions that actually has empirical evidence ’hind it & make sure their children are well educated in matters that will make them employable, & thus able to keep themselves ’live when their parents are no longer ’live, as well as maybe their own kids, which will require mo’ money — money the vast majority o’ people get by being employable. When they’re doing that, they can also work on becoming creative, & use those boring ordinary skills they learned as the backbone to their creativity, since it’s actually quite hard to think ’bout things in new ways when you don’t e’en know what things are ol’. If the ditz who spewed this nonsense had read a biography o’ just ’bout any great creator they’d know that almost all o’ them, while they may have done wacky, fun experiments with wobbling chairs, also spent a significant ’mount o’ their time when young sitting the fuck down & learning fundamentals.

If this article has shown anything, it shows that most people aren’t quite as literate as popularly thought. You could say this article’s syntax was “valid” ’nough that I can identify it as English that says something, but it’s not good: its central point isn’t backed by most o’ the arguments he makes, — &, in fact, some o’ his arguments contradict his main point — & some o’ his examples are so irrelevant they verge on nonsequitor; his grammar is full o’ choppy small sentences that he doesn’t e’en try to tie together, which adds to the rambling feeling o’ this article; & for someone who emphasizes uniqueness & creativity, he’s just spewing the kind o’ empty bourgie philosophy millions o’ others have already done before just to cast the appearance o’ depth onto others without putting in the mental effort to actually say anything profound ( or e’en coherent ). Like this writer’s programming interviewer, if he had turned this in to any writing professor, they would simply say, “Do it again”.

& yet this is apparently good ’nough for Slate, & Mozilla thought this was good ’nough to show me in their amazing Pocket ads recommendations. Well, I say if all these fucking idiots on these braindead glorified blogs can rape something as important as literature every day, let your fucking kid make whatever sloppy code they want. Web developers make, on average, 50K a year; & I can say with personal experience that they have virtually no standards, as evidenced by the aforementioned npm leftpad scandal & the existence o’ JavaScript & PHP.

This writer’s central problem, in addition to being bad @ writing, is that he can’t comprehend the very basic idea that the people comparing learning coding to learning how to read are making. They’re not saying every kid should become a professional programmer any mo’ than schools teach kids how to read so they’ll all become professional writers or teach kids math so they’ll all become mathematicians. E’en when almost every kid in developed countries learn these 2 subjects, they usually are far too bad @ them to excel — as proven by this guy who obviously learned how to read & write when he was young, e’en though he ne’er became an accomplished writer ( though for some reason he thought that he could be one ).

’Course, there was a time when everyone who learned how to read & write were a minority o’ upper-class scribes & everyone considered learning to become literate useless for petty workers. Then society changes, as it tends to do. ¿How does this writer know that only professional programmers will be programing in the future? So many other professions are already invaded by technology that is becoming e’er mo’ complicated so that their users have to give e’er mo’ complex instructions that creep close to being like programming in the need for infinite options for creatives. Already professional artists learn how to program macros when working in Photoshop, many writers & accountants use regular expressions for complex search & replace, & many people on social media run into short snippets o’ HTML & CSS all the time. Someone I work with knows nothing ’bout programming, but knows ’bout “hex” color codes used for describing colors on the internet, though they don’t know what “hex” means.

Meanwhile, the ideal o’ only a few programmers making tools for everyone else to use is showing its weaknesses. The internet is slow & annoying ’cause too many people who need websites have the delusion that they can make 1 without programming & ’stead just get junk like Wix & its ilk spew out. There are too many examples o’ computer software that’s s’posed to make things easier for people breaking & spewing out error messages that only a programmer could understand, which just feeds the need for customer service. It’d be like a world where customers had to call for instructions in every place where we usually use written words — from instructions to setting up everything to knowing the ingredients o’ a food product — ’cause they ne’er bothered to learn how to read.

This writer himself demonstrates a complete hypocrisy himself in his regard: he claims that programming is too hard for the majority o’ plebs to do, & that they would be better off not trying, but has no trouble trying writing, e’en though people mo’ literate than him could tell him that he’s not good @ it. While we rightfully understand that writing & reading skills aren’t binary: we expect everyone to have a baseline level to be able to function in modern society, but only expect the highest skills in brilliant writers, this writer & many others treat programming as if you either can do it or not — e’en though the fact that this programmer apparently spent most o’ his time with remote servers ’stead o’, say, programming for NASA shows that there are clearly programmers superior than he is.

This doesn’t fit utility, as the demand for programmers is still quite high, & mostly for endeavors that don’t need the best programmers — which is, ’course, why so many people are jumping on the bandwagon, & why so many publishers are pumping out books to feed that demand. Businesses pay mo’ for programmers ’cause they can’t get ’nough for their needs. People realize that & aim for that career path so that they can make mo’ money. Thus, mo’ people want works or services that help them accomplish that goal. It’s possible this may change in the future; but it doesn’t seem like computers o’ anything is just a temporary fad. People who see that computer skills will be mo’ useful to society in the future, & thus the sentiment that mo’ people should aim for getting those skills is just being rational & useful for society. Just throwing caution to the wind & hoping someone will pay you simply for having curiosity is utterly irrational & irresponsible, & only works if you’re privileged ’nough to have people they can sponge off or scam.

Notably, the only biographies I’ve read where someone succeeded without working hard to learn tedious fundamentals when young were people who were essentially con men, like Steve Jobs1. Those are usually the people who like the spin the bullshit that these small whimsical stories are what got them successful ’cause they can’t talk ’bout what truly made them successful, since it would out them as a con man, & can’t use examples o’ actual technical knowledge, since it’s too easy to prove that these people don’t have technical skills. Thus someone like Steve Jobs would try to tell you that knowing some arcane, pseudoscientific inner knowledge is mo’ useful for something like programming ( which, Jobs, who forgot multiple times that computers need fans to keep them from o’erheating & dying, obviously couldn’t do ).

Interestingly, 1 o’ the aspects o’ being literate that schools teach you is what they call “critical reading comprehension” so you can read works & analyze what they call “authorial intent” & underlying meaning. Part o’ that includes, what they don’t call, seeing the bullshit ’hind writing. The fairy tale o’ the person who became a brilliant creator by learning not to put the cookie cutter in the middle o’ the dough is 1 o’ those. The fact that it isn’t based on any proof @ all, but just the author asserting that it is so based on logical fallacies so obvious e’en a dimwitted blogger could point them out is solved thanks to Americans’ habit o’ slobbering subservience to privileged figures, whether it’s some Silicon Valley mogul or some famous online newspaper like Slate.

Thus, why Mozilla, an organization s’posedly dedicated ’nough to fighting fake news that they show pop ups ’bout it whenever I open Firefox, decided to throw in my face an article without any science or evidence @ all, but not, say, the many scientific studies that exist. Maybe that’s good: maybe science should only be kept for the professional scientists & we plebs should just get by with quirky stories o’ being curious ’bout wobbly chairs.

But Mozilla will get their effigy in my next editorial…

Posted in Programming, Yuppy Tripe

Boskeopolis Land: Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part XXXXIII: Catahoneycombs

I delayed this video ’cause I felt this level may have too much content — &, in particular, too many gimmicks — for just 1 level & considered splitting it into 2 levels, which would conflict with my theme system, since I already had 3 mine levels & no other theme where this level would fit, e’en in a game that already stretched level themes beyond their logical boundaries ( quite a hefty problem for a game revolving round revolving level themes, which needs meaningful level themes for the cycling o’ said level themes to have meaning ).

I mentioned in an earlier post that I prefer to have multiple li’l gimmicks in a level than 1 all-encompassing level gimmick so that the level doesn’t feel too 1-dimensional; however, too many gimmicks either bloat the level too long ( & I feel most games have levels that are too long ) or leave some gimmicks underused, which I fear may happen here, particularly with the sticky floor gimmick. Other than a few places near the beginning that simply show without telling how sticky floors work without risk, the sticky ground is only used in 1 small section in the middle o’ the level challenging you to dodge Pufferbees while traversing sticky floor. This can be ’splained by the fact that I didn’t consider adding this gimmick till late in this level’s development: originally, this level went straight from that 1st platform with a white ant on it to the next.

’Twas mainly this gimmick I planned on cutting out into its own level, while leaving this level as ’twas originally. But in addition to not having ’nother level slot for ’nother beehive level, I came to the conclusion that there probably wasn’t much else to do with the sticky floor gimmick. Plus, I don’t think ’twas a particularly enjoyable gimmick to stretch much longer, either.

’Sides, the other gimmicks in this level aren’t strong ’nough to hold a whole level. The honey bubbles that form this level’s predominant gimmick1 are just floating water, & the honey falls are just vertical lines o’ water with greater downward force. I didn’t e’en bother to eliminate the oxygen mechanic o’ these water blocks, which I considered, but then declined, since I didn’t feel it worth the effort & felt the oxygen element added an extra complexity to these simple gimmicks, ’specially to the honey falls, adding a bit o’ extra challenge to getting all those gems down there. Meanwhile, the white ants are just a new enemy type that could hardly be called a “gimmick”. Also, I considered taking them out, since, as the video was nice ’nough to show, they glitch out sometimes for reasons I still haven’t figured out. It can’t be due to some blocks not spawning messing up their block detection, as the “blocks_work_offscreen” flag is turned on so that the square-formation bees near the beginning are already moving when you get there ( a necessity if you don’t want the 1st jump to be free & you want to ensure the bees are always in sync with each other ).

Recording this level’s video went surprisingly great: I was able to get it all in 1 take. That’s rare & surprising for a level so tricky — with so many tight jumps where it’s easy to just nick a bee or spike — that I’m considering moving this up from the 2nd cycle to the 3rd & putting “Curse o’ th’Ladder-Splayed Caves” in the 2nd cycle ’stead. The only true hitch was the obligatory level error remaining during recording: the white ant that spins off its platform into space.

I was ’specially surprised I got the time score 1st try, since I flubbed up so much, including the part where I miss the initial bee space due to brain flatulence & waited there a whole second like a buffoon. A’least I was able to show that with quick but tiny jumps you can go through the middle section with honey floor & bees without pausing, as I detest when game’s make you stop. Also, I think I miscalculated the gem score: as the video shows, e’en if you don’t collect every gem, it’s still easy to get mo’ than 10,000₧, while the score requirement is only 9,000. I should bump it up to 10,000.

This level’s music, by the way, is not by the elusive public domain composer Kevin MacLeod, who made most o’ these songs I used, but by Lobo Loco & came from my other main repository for free music ( well, Creative Commons, which works fine for me, since my game is on Creative Commons, too ), freemusicarchive.org. None o’ MacLeod’s songs fit a beehive theme particularly well — which you can’t blame him for, since it’s a rare level theme. I thought searching “bees” in Free Music Archive would be a far fetch, ’specially since, unlike MacLeod, that website doesn’t focus on video game themes. So you can imagine my surprise when I heard Lobo Loco’s “Save the Bees” & heard exactly what I wanted. It reminds me a lot o’ the “Flight of the Zinger” song from Diddy’s Kong Quest, used in that game’s beehive levels, which is exactly what I was thinking o’ when imagining what I wanted this level’s song to sound like.

This source code is so bad it gives me hives

Posted in Boskeopolis Land, Programming

Boskeopolis Land: Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part XXXXII: Good Ship Lifestyle

For once the layout & programming took mo’ time than the graphics — probably ’cause much o’ the graphics are reused from other “pirate” themed level. & for once this is actually pirate themed & not a beach or bathtub.

It’s hard for me to get difficulty right ( or I fail to get it right ), since I’m bad @ games, so I can’t tell if I made a level too ridiculous or if I just suck. ¿Does dodging some o’ these anchor bullets require luck or just sharp eyes & reflexes? I considered lengthening the minimum shoot delay, since it seems like the most seemingly unfair hits were when it shot just after shooting, but decided not to, since I figured I was just reacting too slowly.

Anyway, the gem & time scores are lenient & I’m quite sure all o’ the trouble I had gathering the footage for this day’s video was due to sloppy playing. The time video here particularly shows that off, as after near flawless playing through the 1st half I flop round as if my fingers were covered in butter & hesitate as if I developed Alzheimer’s & still make the time score — though right on the last second.

The ladder shafts & the final stair climb are so saturated with anchor bullet sprites that it caused slowdown, so I had to fiddle together some optimization tricks. The 1st 1 I did had nothing to do with sprites, but eased the level’s run load so much that it made up for it: many o’ the tiles are background tiles, & I noticed that none o’ those tiles animated or changed. I’ve realized for a while that drawing all these li’l blocks is probably 1 o’ the most inefficient things this game does, since it calls the SDL_RenderCopyEx function for each block, which valgrind has consistently told me is slow. ( This is what led me to realize many updates ago that loading a small image & tiling it for a background is slower than manually tiling it into a large image & just loading & drawing that large image once per frame ). So I created a branch o’ the background tile code & created ’nother version that @ the beginning creates a texture o’ all the level’s background tiles & just draws the portion o’ that that’s on the screen every frame, turning what could be o’er 200 SDL_RenderCopyEx calls per frame into just 1 per frame.

That seemed to get rid o’ the slowdown. But I still wasn’t sure or satisfied, so I made 1 other quick & easy optimization that was actually relevant to sprites & I should’ve fixed a while ago. When a sprite is killed off, it’s simply erased from the vector o’ sprites. I’ve read on the internet that vector’s erase method shifts all entries after the deleted entry backward to fill the space & still maintain the order o’ entries. Unfortunately, I don’t care ’bout sprite order — it’s arbitrary, anyway, based on whatever order the map reader finds them, which isn’t tied to the order the player is likely to find them. Moreo’er, this is slow — I believe worst-case O(n). So I changed it so that it now just replaces the data o’ the sprite to be deleted with the final sprite’s data & then just pop off the final sprite.

I must confess I didn’t come up with this idea myself, but learned it from this chapter on “Object Pools” o’ the book Game Programming Patterns. In fact, I’ve known ’bout it for years & used it in earlier programs I’ve made, which is why I said I should’ve used it earlier.

As an extra maybe-optimization that didn’t hurt is I set the sprites vector to reserve 50 spots @ the beginning to hopefully avoid going past the size o’ the vector & having to slowly reallocate memory, move the data, & delete the ol’ data. When considering this optimization, I considered changing the vector to a classic C array, since I wasn’t sure if vector e’en allowed you to delete any entry without automatically shifting other entries; but realized it didn’t matter, since the sprites are held as unique pointers, so I could just release the last entry’s data & reset the unique pointer o’ the sprite to be deleted to that data. I decided to stay with vector for the greater size flexibility it gives. I prefer the balance o’ safety & speed I can get by having a vector with a moderate # o’ space reserved so that having to enlarge the vector is unlikely, but still gives me the chance to enlarge the vector if absolutely needed, for some rare outcome that I can’t predict.

’Course, the fact that sprites are held as pointers & not data itself means that this vector can’t take advantage o’ data locality, — which I also, coincidentally, 1st learned ’bout from a chapter o’ Game Programming Patterns — which is also a rather big inefficiency. However, fixing that would take a lot mo’ work — I would basically have to refactor all sprite code so that it uses discriminating unions — which are both racist & socialist, so neither side o’ the political spectrum likes them — ’stead o’ polymorphic sprites. In hindsight, I would’ve preferred using discriminating unions for this & a few other reasons, but it’s too late; so we’re stuck with slow & stupid polymorphic classes. I could think o’ many other optimizations I could make, some big & some so small it’d be a waste o’ time — & some big, but would require me to reprogram large parts o’ the game’s integral code. This isn’t so much “fix all inefficiencies I can think o’”, which would make this project take decades to finish, but “fix inefficiencies that are obvious & ridiculously easy to do”. I’ll save these bigger ideas for the sequel, where I can start from scratch. Now I want to just get this sloppy mess finished & out o’ my sight.

Anyway, these optimizations not only seemed to clear all slowdown in “Good Ship Lifestyle”, they also seemed to fix the slowdown that has been in “Value Valhalla” for probably o’er a year. ( Didn’t fix most o’ the sprites disappearing after a loop, though ). Why this happens, I can’t understand, since this level has neither any background tile layers nor sprites that are deleted.

& I must say, this level’s music is a true banger. This time it isn’t by Kevin McLeod, but by a band called Blue Wave Theory, found on Free Music Archive, released under Creative Commons ( & thus OK for me to use ). It’s surprising how much high quality music you can find for free — which is great for people like me with absolutely no musical talent.

Final Fun Game: Try & find the minor graphical ( technically, level-design ) flaw I made & didn’t notice till after I already recorded the video this time.

Here Is Where the Bad Polymorphic Classes Can Be Found

Posted in Boskeopolis Land, Programming

Boskeopolis Land: Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part XXXXI: Dark Sahara

I finished this level a while ago — I just forgot to do a video on it till now. I think I was planning to do a bit mo’ graphical polishing. The volcano enemies still don’t look so good, & I just noticed while looking o’er the video that its fireballs sometimes go ’hind the cliffs due to some graphical shenanigans o’ how those cliffs work. Also, I waffled o’er what color I wanted this level to be. @ 1st it was bright yellow; but then I realized a desert being bright yellow @ night didn’t make sense & that I already have plenty o’ yellow in this game.

I’m not so hot on this level. It’s probably way too derivative o’ Doki Doki Panic / US Super Mario Bros. 2. Furthermo’, the bird-riding makes most o’ the level basically an autoscroller & the fireballs the volcano enemies spit out are random. Ironically, it’s ’cause Super Mario Bros. 2’s Pansers, whom this volcano enemy is obviously ripped-off o’, works the same way that I argued that ’twas all right. But I’m still not sure if I just have slow reflexes or if this is just unfair. I actually hope for the former, since I’d rather be bad @ playing video games than designing them.

I also got to steal from myself by taking that bird enemy’s graphics from 1 o’ the sprite comic episodes o’ Boskeopolis Stories. That makes this enemy & their mechanic technically inspired by a comic inspired by a video game. So Boskeopolis Land is the equivalent o’ Street Fighter: The Movie: The Game, or whatever it’s called.

The gem score, like many o’ the recent levels I’ve made, allows a few gems leeway, since getting all the gems is pain ’nough as it is. The time score isn’t much, either, since much o’ this level is autoscroll & gives you li’l control o’er how fast this level goes.

Man, this level sucks. I should’ve stuck with the idea o’ ripping off the bull level from the Rabbit Rampage game, ’stead. A’least nobody cares ’bout that game, so nobody would notice my plagiarism. Hell, e’en the name sucks: I don’t e’en think this level’s environment is saharan.

Downloading this code will infest your computer with malware till you get 999,999,999 points in this game.

Posted in Boskeopolis Land, Programming

Boskeopolis Land: Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part XXXX

It’s been long since last update, but that was ’cause I for no known reason waited till I got these 4 levels sorted through. Thus this update took long ’cause it’s 4 updates in 1.

Foul Fowl Farm

The 1st mountain level, as the music & background hint. I originally planned to have it be the 2nd mountain level, with “Milky Mountains” as the 1st, but I’ve found this level to be much easier than that level, & it fits better, difficulty-wise, like that. It doesn’t fit as well theme-wise, since it’s strange that a straightforward mountain level would be 2nd & the level that twists the theme a bit comes 1st, but that’s not as important. Plus it’s a bonus to start strange, so the audience doesn’t get bored before the good stuff comes. Always put the best 1st & last & the weakest in the middle; & though I don’t consider “Milky Mountains” to be bad, I consider it on the lower end, & worse than “Foul Fowl Farm”.

This was, indeed, a level that took much mo’ time drawing the graphics than coding it, since the goal gimmick was already mostly coded for “Playing Railroad”. I e’en had to make a program to generate the tiles for the barn roofs, since they comprise to many blocks for me to have the patience to do that manually.

However, it did take mo’ recoding than it appears. 1 lame thing I had to do was make copies o’ all the Pollo no Noko enemies, since the originals respawn after they die — & need to stay that way for “Milky Mountains” to still work right. In this level, that clearly can’t fly, since you could just respawn & killing the same chicken. E’en if my counter was smart ’nough to account for that, which would be mo’ effort than just copying & pasting, it would be annoying for the player to have to remember which chickens they’ve already bopped. Much simpler to just keep bopped chickens bopped.

I also had to create a new slope template, since the 1 I I’d just made for “Stormy Skyscrapers” only accounted for different slope widths, while the barn roof needed a super steep slope 2 blocks high. Since ’twas so different, trying to wrangle the already-existing slope template wouldn’t have been worth it, so I just created a new template.

It seems I was mo’ lenient with the time scores with these levels, since the video o’ my winning attempt to get the time score is full o’ weird flubs. The gem score, however, requires you to get all o’ them, which is fair, since this is a short & easy level.

Frostbite Mines

I was mixed on this. For a while I wanted to make a spiral-shaped level as part o’ my strategy o’ basing level maps ( more o’ less ) on simple shapes; & as simple as this level is, I like how it works. You may notice that a common strategy I play is to sometimes give levels 2 gimmicks when 1’s too modest1, so the level isn’t too pedestrian. In this case, just sliding under spikes & dodging falling snowballs by themselves aren’t compelling ’nough for their own levels; but mixed into 1 level gives the level mo’ depth. It feels mo’ like Donkey Kong Country 2 & less like Donkey Kong Country 3.

However, this & the next ice level I’ll write ’bout uses up all the ice level ideas; & I still wanted to have a snowy mountain level. That’s why I waited till I finished the other ice level to confirm whether I wanted these both. ’Twas during this time that I came to my solution: just move the ice mountain level to the mountain theme. However, this pushes me into deciding ’tween mo’ levels: the ice mountain vs. that dumb level where you just don’t press anything for 30 seconds vs. the volcano level idea vs. ’nother desert level I’m working on ( since all o’ these ’cept the ice mountain could potentially be desert levels ). But that choice is easier.

Technically, I finished this level’s graphics last, since I decided to use the ice-mine blocks I made for “Chillblain Lake” ’stead o’ the regular mine blocks. But the main design was made 2nd. Besides, as I’ll rant ’bout, I neglected to finish the graphics o’ the next 2 levels.

’Cause this is a rather difficult level for this game, this is a 4th-cycle level. It’s easy to be a li’l off on your budging when near spikes or next to the falling snowball to get a li’l too close & taking a hit, & there are no hearts. That said, this is 1 o’ the few short 4th-cycle levels.

I think I intentionally made the time score for this level somewhat lenient, since it’s a rather difficult level, as I usually do. I think the gem score lets you miss ’bout 1 gem ( which, sadly, doesn’t include the 250 bright gem @ the bottom o’ the slope o’er spikes ).

The Amazon Jungle

This is not a jungle level, but what is planned to be the 2nd factory level. The name is based on a 2-part pun based on the warehouse company Amazon that the city near to me, Seattle, has a love-hate relationship with for being a great job-creator for jobs that are miserable to work & a classic novel, The Jungle, known for its gruesome depiction o’ factories, which inspired regulatory acts by the Theodore Roosevelt administration in the US. I fiddled with names that involved the word “warehouse”, including the truly dreadful “Warehouse o’ London”, which makes no sense, since this game obviously takes place in the fictional city o’ Boskeopolis, not a real British city. I finally decided that the current name is mo’ clever than any hokey Rareware alliteration on “Warehouse”.

The level is mainly based round moving trucks carrying what I s’pose are packages. I actually made these sprites a while ago for a city level I rejected; but ’stead o’ having packages on their backs, they had… whatever the backs o’ big trucks are called. I think they were called “Anguri Trucks”, based on the Japanese way o’ saying “angry”, for some reason. They’re basically just Mega Moles from Super Mario World that are a danger if they run into you, but can help you by giving you a moving platform o’er spikes. Not only is it a ripoff o’ that, but making them trucks is clearly inspired by the VIP rom-hack series, which changed the Mega Mole graphics into some obscure truck meme.

I find this level questionable, mainly due to all the parts that slow you down, such as the part where you have to ride the truck & the part where you have to stay ’tween 2 trucks in a long line o’ trucks to slowly make your way to the end. I don’t like autoscrollers, as they make you wait, & waiting is boring. I guess these aren’t too bad, since you don’t have to wait too long ’tween actions for the riding section, & it’s not long, & you have to constantly time your budges forward to keep yourself from falling too far back & hitting the truck ’hind you or going too far forward to hit the truck ’head o’ you, so you’re not just waiting. Plus, one could take the long line section as a satire on traffic jams — an idea I’ll admit I just came up with now. A’least they’re broken off with free platforming sections.

I’m also not sure how to feel ’bout that section that kills you if you stay on the truck as it lets it rise up. I tried to indicate that it’s death by putting a skull in the background there; but that just makes one wonder why it’s e’en there. The obvious answer is as a joke — but it’s still weird. O well: better games got ’way with worse bullshit.

Since this level constrains your movement so much, I know I intentionally made the time score lenient, as seen by my still-winning flubbed-up video. Like “Frostbite Mines”, the gem score lets you miss a few gems, but not many.

I always hate it when I spend so much time trying to make sure the presentation o’ a level is as polished as I can make it before making these presentations & being able to move on, only to realize after already making the video that I didn’t finish everything. ¿How could I forget to put a string on that package that raises you to the top? Actually, I didn’t e’en notice that till I noticed that the package lacked any kind o’ shading & realized that I ne’er got to polishing that sprite @ all: I just drew the simplest design that looked like a package I could & commensed with making it work how I wanted ( as is wise to do: e’en worse is wasting time polishing design for something you later realize doesn’t work & must be tossed aside ), only to forget to do the polishing part.

Chillblain Lake

Though I originally planned to make this a 3rd-cycle ice level, I may make this a 2nd-cycle — or e’en 1st-cycle — level & move “Frigid Frigates” to the 3rd cycle, since I feel like it’s harder than this level. E’en “Ice Box Rock”, which is in the 1st cycle, might be harder than this level.

This level is heavily inspired by Wario Land 3’s “E2 The Frigid Sea” green treasure, wherein you start out with water, giving you access to the chest, but not the key, so you have to go hit a switch to turn the water into solid ice, giving you access to the key, but not the chest, which means you have to go back & hit the switch 1 mo’ time. As arrogant as it feels to say, I feel my design is better than Wario Land 3’s, since there’s less backtracking: in Wario Land 3, you go through the same path twice to the switch, while this level makes you go in a figure 8, with the 1st path to the switch in the water that leads to the chest, & thus blocked off after turning the water to ice, & the path to the key going onward to the switch in ’nother way.

I particularly like the way the 2nd path leads to a cliff o’er the switch. When you 1st reach the switch, you’ll likely see it, ’specially if you grab the tantalizing gems ’bove the switch. But you can’t reach up there ( nor can you reach the very topmost tantalizing gem ). It’s only on the way back to the switch through the other way that the player learns the mystery o’ the cliff too high to reach & can finally nab that too-high gem.

The diamond was originally just in an alcove on the key side o’ the water, sort o’ parallel to the main path in the chest side o’ the water. However, I felt that was still too easy to find. I wanted to involve the water-ice gimmick in some way, so I made it so that you couldn’t quite reach the diamond ’bove the water, but could with the ice. But then I remembered that ice is solid, so you can’t go through it to reach the diamond. So I made a somewhat secret passage ’bove the spikes @ the end o’ the curve upward & made a ladder passage ( which, unlike “Stormy Skyscrapers” & “Foul Fowl Farm”, has a top that you can climb up to, but can’t climb down, making it 1-way ) back up to the curve, since the ice path is still blocked off. My only problem with this is I don’t think this passage is secret ’nough. I pushed it back ’nough so that you couldn’t see the other side o’ the wall with the kind o’ natural camera you’d have when you reach the spikes; but as you jump up the curve on the normal path to the switch, you’re guranteed to see the secret passage opening.

You may notice the sliding under spikes gimmick from “Frostbite Mines” used here, but in a much easier, shorter way. That is ’nother technique I use sometimes: gimmicks reused in later levels in much less prominent ways as either a short tutorial for the real threat, as used here, or mixed with ’nother gimmick as a mo’-challenging twist on the gimmick, as seen in “Crying Lightning” with the fading-in & fading-out cloud platforms from “Cotton Candy Clouds” ( a gimmick that was also taken from Wario Land 3 ) mixed with the chasing lightning cloud enemy for a short bit, challenging the player to time jumps gainst the 2 gimmicks simultaneously ’stead o’ just 1.

Sick o’ the mine blocks used in so many levels already, I made an icy version, mixing the ice tops o’ the ground blocks from “Frigid Frigates” with the mine blocks, which I then decided to add to “Frostbite Mines”. I also changed the also-o’erused rocky mine background ( I’m still not sure if I’ve finished that background or if I’m going to ’ventually try adding wooden frames to it ) to a background totally not heavily based on a Wario Land 3 background from the same level this gimmick was taken from, but I didn’t use that background in “Frostbite Mines”, ’cause I found ’twas too hard to see with that level’s much brighter palette, made brighter by the white fog. I also opened the roof & added sunlight streaming in from the top. I e’en made this level’s name “Chillblain Lake”, ’stead o’ its original name, “Chillblain Caves”, which is mo’ fitting, since this level’s main focus is the lake shifting back & forth from being liquid or solid. All this is a way to try minimizing the mines aspect o’ this level, since it feels weird having half the ice levels be mine levels, too, when we already have 3 mine levels.

Despite all this polish, I realized too late that I ne’er bothered to make the fish enemies have mo’ than 1 animation frame or not look like something I sloppily drew out in a couple seconds, which is what I definitely did. Worse: this isn’t e’en a new enemy, but 1 I made way back for “Soupy Sewers”. Why I still haven’t given that enemy worthwhile graphics is beyond understanding.

However, I did think to make these fish boppable underwater, as the video shows, proving that I took my critique ’bout not being able to hit enemies in water levels being a contributing factor to those levels’ popular hatred in my article ’bout Super Mario Bros. Deluxe to heart for my own game.

I just realized I’ve been forgetting to update the readme, so this readme was publicly revealing planned bugfixes I’d already solved for months.

Posted in Boskeopolis Land, Programming

Boskeopolis Land: Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part XXXIX ( Stormy Skyscrapers )

Stormy Skyscrapers

It’s a good thing I didn’t promise anything specific, ’cause I ended up completing a completely unmentioned level. ’Cept, if you paid attention, you might have seen clues o’ the idea ’hind this level lurking in the background since my 5th post. I’m surprised I hadn’t shown off mo’: for the longest time I’ve had an unfinished city map with a grayscale palette, a few Hydrant enemies, & a long spike pit with horizontal & vertical moving platforms, with the plan o’ the level being mainly vertical.

None o’ that map made it into the current 1, which I started working on sometime last month, inspired by my playing Super Mario Bros. Deluxe, as I oft do during September, for some reason, & finding ’nother gimmick to steal. In this case, I basically completely ripped off the… ¿teeter-totter platforms? I don’t know what they’re s’posed to be called, but they’re called “weight platforms” in the game’s code. The 1 notable difference is the improved rope graphics, that was a pain to get to work right.

This level is heavily inspired by World 4-3 in Super Mario Bros., which I think is my favorite level in that game. However, the thin mushroom platforms are replaced by skyscrapers. I wanted this level to have a retro platformer feel, which is why it has a grayscale palette: much as mushrooms are sort o’ the natural, normal setting for Mario, urban landscapes are the natural, normal environment for Boskeopolis, — which is a city, after all — which is why it’s the 1st setting o’ each cycle.

The paper plane enemies, which grab you & drag you back to the start if you don’t struggle out o’ them quickly ’nough, are a riff on the randomly generated Bullet Bills. I thought making them drag you backward a bit was a nice way to balance having an extra projectile to dodge while not making it too hard to avoid being killed — while also rewarding you for being a fast button masher for struggling out o’ their grip. Then ’gain, some might find this mo’ annoying, ’specially when there’s an infinite healing heart block in the middle o’ the level. This is s’posed to be a 2nd-cycle level, so it shouldn’t be too difficult. It should be just a notch ’bove the 1st level.

I can’t remember exactly, but programming in the weight platforms probably took the most time out o’ everything, & became a barrier when I stumbled ’pon a bewildering glitch that caused 1 o’ the platforms to not budge, no matter how much I stepped on it ( but did work for the other 1 ), no matter how much I rolled back my code or recompiled it. Finally, I narrowed down the culprit in the silliest way: technically, ’twas caused by changing the map, which was why no amount o’ rolling back code fixed this bug — ’twas a bug that had been round since the start, but hidden till I added a block right ’tween the platforms. To make the platforms work, e’en when 1 is off-screen, I made the actual sprite go all round the limits o’ where the platforms can go till they fall. Thus, the block ’tween them was interacting with them & trying to block them from going downward. The fix was to simply turn off block interaction for that sprite, since they clearly didn’t need it.

I was updating this sprite up to near the end o’ developing this level. As I was demoing collecting gems in the level, trying to determine what I should set the gem score to be, I realized I’d ne’er implemented gaining points when breaking the platforms.

A’least the weight platforms sprite doesn’t seem to have much ugly kludge code, & I actually bothered to comment it properly.

The next boundary I ran into was, surprisingly, the gorilla sprites spawned by the big barrel sprite, an obvious reverse paean to Donkey Kong — the same problem I ran into on for “Ice Box Rock”, but far trickier to fix, since the platforms they walked o’er were sloped. @ 1st I just kept the level with the blocks_work_offscreen flag checked in the hopes that it wouldn’t be too slow, like “Rooftop Rumble”, which also has the option. I e’en tried optimizing the map by making all o’ the building blocks that weren’t the roofs background tiles, since you can’t interact with them, anyway. But, predictably for a much bigger level, there was noticeable slowdown. For, not only did this level have mo’ blocks than “Rooftop Rumble”, it had far mo’ sprites — sprites that all needed to interact with blocks, which was the point o’ making the blocks work offscreen in the 1st place. We’re talking ’bout up to 20 sprites, as opposed to “Rooftop Rumble”, which only has 2 sprites.

Surprisingly, I was able to optimize the handling o’ blocks when offscreen, so that the level seems to work in perfect speed now. ’Twas clear to me that the main problem was that every sprite was testing interaction with every block — 20 sprites times hundreds o’ blocks. The trick was to limit the blocks checked per sprite to only blocks near ’nough to actually be probably candidates. @ 1st I sat round thinking o’ complex patterns o’ dividing maps into screens, only to realize that that wouldn’t help when sprites enter the dividing line ’tween screens, till I tried a much simpler solution.

The way the block list works normally is that non-null blocks are added to the end o’ the list as they’re sequentially scanned from the map array, from top to bottom, left to right. Since empty tiles ( 0 in map data ) are ignored to save memory, & since no maps don’t have large gaps o’ empty tiles, the sequence o’ blocks in the block list have no relevance to their position, as shown below:

The position for each block is held in each block, & thus each sprite needs to test each block to see if they’re colliding.

Visual comparison o’ block data rendered based on position & data as its held in array:

The solution was to change it so that all tiles, including empty tiles, are added to the block list. This creates a consistent pattern ’tween the map & block list, like so:

Doing this, we can calculate where in the map a block will be by its location. We can be sure, for instance, that a block whose index into the block list has a remainder gainst the map width o’ 0 will have 0 as its x position value. Indeed, this is obvious when we remember that the blocks get their position in the 1st place from their position within the map’s block list.

Thus, rather than testing every block for each sprite, we only need to test blocks within a range o’ a block or so ( I picked 3 blocks @ a whim ) ’bove to below & left to right. Thus, the loop changes from

for ( Block& block : blocks )
{
    block.interact( sprite, ... );
}

to

const int first_x = floor( sprite.xPixels() / PIXELS_PER_BLOCK ) - 3;
const int first_y = floor( sprite.yPixels() / PIXELS_PER_BLOCK ) - 3;
const int last_x = ceil ( sprite.rightPixels() / PIXELS_PER_BLOCK ) + 3;
const int last_y = ceil ( sprite.bottomPixels() / PIXELS_PER_BLOCK ) + 3;

for ( int y = first_y; y < last_y; ++y )
{
    for ( int x = first_x; x < last_x; ++x )
    {
        const int n = y * map.widthPixels() + x;
        Block& block = blocks_[ n ];
        block.interact( sprite, ... );
    }
}

When I was 1st testing this out, I actually started by changing the rendering code to this, based on the hero’s position, which, when I figured it out, gave this cool effect where only the blocks right round the hero sprite appeared.

In hindsight, this is an obvious optimization: trading space for time, which is usually beneficial on modern computers with mo’ memory than it has processing power to use optimally. I think I thought adding mo’ blocks to memory was slower ’cause levels with the blocks_work_offscreen flag checked on were slower. But that was ’cause it had to process mo’ blocks, not just ’cause it had to keep them in memory.

This makes me think it might be mo’ efficient to use this kind o’ code with regular levels where only the blocks on screen & just round are live, ’specially since it would be less o’ a memory burden, being a few extra blocks ( probably barely mo’ than a kilobyte o’ extra memory ).

After that, the only snag was a slight bug with that paper airplane sprite: I thought it’d be cheap if you could get hurt by enemies if the paper airplane happened to move you through them, so I made the paper airplane sprite turn off the hero sprite’s ability to interact with sprites while in its grasp. The problem is, that meant the paper airplane sprite itself couldn’t interact with the hero sprite. The solution rather janky, but works: give the paper airplane sprite a pointer to the hero sprite it can keep @ all times &, when it sets the hero sprite to be grabbed, use the hero sprite’s pointer while updating to handle moving the hero & letting go.

In making the girder blocks, I did have to make a flatter slope than I had before. This gave me the ’scuse to finally stop screwing round & clean up the slope blocks, which I’ve mentioned before, were hackily copied & pasted from class to class. So these classes wouldn’t have to waste, like, a couple whole precious bytes out o’ the billions available, I made a single templated class with direction, steepness, & position within its slope ( since flatter slopes require mo’ blocks to form a complete slope ) as template arguments. The great thing ’bout this was that it not only cleaned the code, it made making the new flatter slope blocks ridiculously easy: I just had to quickly calculate some new #s to push into the template, & then it just worked perfectly. Turns out programming’s easier when you don’t do a hacky job o’ it.

Since the graphics are mostly reused, there wasn’t much to do there, & the girder & platform blocks were so simple, they took hardly any time to draw. In fact, I actually drew some fancy bridge blocks that I decided not to use till the very end o’ the level, preferring the plain building graphics ’stead. Using these familiar city graphics to replace the mushroom towers felt like a better parody than using some unfamiliar graphics. Plus, it allowed for layering towers o’er each other, like after the 1st pair o’ weight platforms.

Something I tried to emulate from the original Super Mario Bros. was making it so that while the weight platforms could help in certain ways, including getting gems & the hidden diamond, you wouldn’t have to wait for them to slowly move in order to just beat the level: if you play it right, you can hop straight from platform to platform in this level ( & in World 4-3 o’ Super Mario Bros. ) with minimal delay. Actually, I don’t know what happened, but somehow this level became easier to do quickly, as I easily got 18 seconds on my 1st try in this video, which took many tries before, which was why I set the time limit to 20 seconds. I should maybe change it to 18. However, I want some leeway, as this level can be kind o’ cheap with those randomly generated paper plane enemies.

In the process o’ making some o’ these code changes, I also made some other simple code refactoring. For instance, the same insight that led to turning the slope blocks into a templated class, probably from some C++ books I was reading, led me to realize that the Counter class, used in many places, could be a template.

I also finally got round to adding an autoformatter for text, such as the text that appears in message blocks. Before, to keep them formatted, I had to manually calculate where to put line breaks, as it would naturally just go to the next line when it ran to the end, e’en if ’twas in the middle o’ a word. Now, it runs the text through a function that checks if the letter @ the start o’ each line after the 1st is a space or line break, & if so, it eliminates it, if it’s a different character ( which means it’s a word that spans ’tween lines ), it goes backward till it finds a space & replaces that space with a line break so that the word spanning 2 lines starts @ the next line.

Here is a before & after shot that demonstrates this:

So for this message, the algorithm stops on the 1st letter o’ the 2nd line, sees it’s not a space or newline & goes backward till it reaches the next space, right before the “W” in “will”. It then replaces that space with a newline, causing the next letters, “will” to be printed on the 2nd line, as shown.

It’s probably not the most efficient algorithm, but that’s fine, since it only runs once @ the beginning o’ a level.

I hope to finally get round to other code refactorings, but I have to be conscious o’ my time, ’specially as I grow older & become e’er mo’ senile.

¿& who knows what the future holds?

This code is still sloppy as a hippo & probably won’t compile on your computer.

Posted in Boskeopolis Land, Programming