My coding project, part III

Wherever my nose points at

Now that I had finally fixed the rotation and found out where the hell it's pointing at, the last of the unimplemented basic functions was the movement. My first attempt was, especially in hindsight, ridiculous: if the angle was pointing to one of the cardinal directions, the full acceleration was applied on one axis - if somewhere in between, the acceleration was applied to the two closest ones. While testing it first looked nice, but in a while I noticed that "Heeeeyyy.. this thing jerks around when it's turning and accelerating. It looks pretty odd now". Even the slightest difference from a 3π/2 angle made the polygon accelerate at full speed towards the closest intermediate direction. Whoops.

A bit more realistic change of speed

After a very short but intense moment of screen-staring a lamp went off in my head: if I went and used the same damn trigonometrical functions that told me where thing was facing but using the known speed and angle to get the Δx and Δy values, I'd be done! So, the same trick but opposite direction. Luckily it didn't take me more than a couple of minutes to come up with this.

tempspeed = Vector(self.speed.x, self.speed.y)
dy = math.fabs((math.sin(self._angle))*self._acceleration)
dx = math.fabs((math.cos(self._angle))*self._acceleration)

# ...

Of course this isn't all, the method still needs to check the heading and decide if the Δx and Δy are positive or negative. With that piece of information the acceleration can be applied properly and to the right direction. The main thing is that it looks good to me right now.

Particle effects!

It gets pretty old pretty soon, moving a simple Shape. So I worked on a Star Control (or Auts or V-Wing or Wings) style acceleration effect. Without spending more than a few seconds on thinking where the engines would be located, I just marked* the bottom edges of the triangle shape as the engine points. Now whenever the acceleration is triggered, a set of tiny box Shapes are dropped at the current coordinates. These Shapes fade away slowly and die away after a few cycles. While I was playing with that I made a silly warping method, where the polygon is relocated in the middle of the game area. At the previous coordinates a set of eight particles are created with speeds set so that it looks like an explosion. It's a funny effect even if I say so myself. That was going to be used to do explosions in the game for real, not teleporting 8)

*) I was farsighted this time. The initial version just takes a set of coordinates for the engine exhaust points, as many as I want, so I can do however I want later. More or less. Perhaps this helps me avoid a couple of rounds of "refactoring because stupid".

Adding some friends on the screen

All in all, what do you do with an almost triangle shaped thingamagick on a 2d space if it's there alone? You'd get bored out of your skull pretty quickly, I tell you. So my possibly retarded idea should be clear to everyone: I'm going to dump in some asteroids! 

I was pretty excited when I got my eight-pointed semirandom shapes on the screen in four different sizes, spinning slowly around either clock- or counterclockwise and after a couple of iterations they even flew through the screen on their merry ways. That was an awesome moment.

At least I was damn proud of that.


My coding project, part II

I think I said the last time that I've never tried to do anything graphic for real, unless you count those TurboC++ tests that just vomit squares and circles on the screen (no, they do not count). So my first problem  jumped out already. It was simple to get my four-pointed polygon in the middle of my surface, but moving it...

I'm going to mumble about my "aha!" moments and ponderings as I remember them and when they have some kind of point to them. I don't guarantee a good quality, just like I never do ;)

Position, rotate, relocate, draw

So my first version used a set of hardcoded coordinates, yay! I thought that it's a good starting point, but oh, how wrong I was. Maybe the issue was within my own rotation methods and it'd all been awesome if my methods had been fine, but maybe it would've sucked anyway. The initial situation was rendered prettily but a single rotation distorted the form beyond recognition.

Via the zero point

From somewhere I came up with an idea (and after talking to a yet another coworker of mine my guess was proven correct) where all the shapes should always be initialized around the (0,0) point. This way the rotation of any polygon would work the same no matter where on the 2d space they are.
So first you always set up the vertices in the same places, then shift the coordinate points to the actual positions where they'll be rendered on the screen. A really simple and I guess it's a childishly basic thing, but who would've told me?

Rotating the 2d coordinates

My mathematical studies are years old at best and I have to admit that in elementary school (even longer ago) I was one of those fucking annoying brats who declared that I would never need maths or trigonometry after the 9th grade. Oh yeah, once again we see that reality doesn't always agree :)
After a couple of weird and stupid "I'll do this myself"-kind of attempt I encountered something called affine transformation. That was a nice, handy thing and the implementation was just about 1:1 with what my dear friend Wikipedia told me. You just drop it each vertex of the polygon at a time and the desired rotation angle (obviously this is always the same for a single shape), this beast simply returns the new coordinates for the given vertex.

def rotate(self, angle):
        rotated_points = []
        for point in self._points:
            new_point = self.affine_transform(Vector(point.x, point.y), angle)
        return rotated_points

def affine_transform(self, point, angle):
        temp_x = ((point.x * math.cos(angle)) + (point.y * math.sin(angle)))
        temp_y = ((-point.x * math.sin(angle)) + (point.y * math.cos(angle)))
        return Vector(temp_x, temp_y )

Hah! The next issues I encountered were the angle (I was, again, making a mess with degrees and radians, but that was because of my infinite stupidity) and the movement. The movement was a bigger issue and took quite a bit longer to fix. Pretty soon I was able to rotate my more-or-less-triangular shape around it's own z-axis but if I tried to accelerate, it started flying towards the top-right corner and beyond. If I tried to rotate and accelerate, it did the same but while corkscrewing carelessly. I was baffled.

How do I calculate where my polygon is facing? 

As my stupid mistake number 74 I forgot my hardcoded "draw this thing in the middle of the surface" -values and another mistake was that the calculate_angle always returned the exact same value for my Object. Somehow I had ended up trying to calculate the facing of my polygon by its sides (because it's basically a triangle). I guess it was otherwise a good idea but it just didn't work here at all.

After a bit of googling and more light headscratching the solution was much more simple than I had thought. Or at least it felt like it for someone as stupid as I am. Because the center point's coordinates are known, as well as the tip's coordinates, you can just take the distance between the coordinate points on  x and y axises (Δx and Δy) and feed that to arctan to get the angle in radians.

I guess that clarifies a bit... or not :p

def calculate_angle(self, center, nose):
        dx = center.x - nose.x
        dy = center.y - nose.y       
        radian_angle = math.atan2(dy, dx)
        return radian_angle

Geniously simple, I say. At this point it looks like that no one can read one word more of this crap on one go. Therefore I'll continue this topic on the next iteration of the Project Mumblings.


Some background for my coding project


I guess "everyone" who has ever programmed anything at all has entertained the idea of making their own game. A couple of decades ago I fooled around with QuickBasic that came with the 486 machine, but nothing spectacular happened. The biggest problem I encountered was that I didn't know anything and all I had was the (somewhat awful) manual and I didn't know where to look for more information.
For some odd reason, most likely my laziness,  I never started poking at game making even when I was actually studying programming and even learned something. From time to time the thought came to me. Just for the fun of it, if nothing else.

Python - Pygame

Some years ago a coworker of mine hinted of this Ruby-based Shoooes thing that I actually wanted to try out but as usual, I didn't get anything mentionable done. That attempt, like so many others that started with the usual "Hey, let's try this thing!"-enthusiasm, died  away. Maybe a year, one and a half ago I encountered Pygame in my rss feeds, a game developing library for Python. To honor the traditions I did give it a try but just left it. I blame it on the lack of good (= implementable) ideas. Drawing circles and squares doesn't entertain for a horribly long time :p

for idea in ideas:

Because coming up with 100% original ideas isn't that simple, what then? Copy others or climb on the shoulders of those giants and wave your arms.
Another of my coworkers had started working on his Roguelike, so so much for that one, even though I wasn't going to do anything under the usual fantasy theme unlike him. In my childhood I spent countless hours on desperately difficult Xenon 2 and years later I got hooked on awesome Tyrian.

Xenon II: Megablast

In that sense I was pretty interested in working on a classic horizontal/vertical scroller shoot'em up. With these my huge issue (before I even started checking anything or wrote even a single line of code) was the levels and all that, so I left those ideas in my ideas box, with the rest of the filth I've conjured up during my years.

Sandboxes, openness, freedom of choice and general randomness (= everything doesn't always go exactly the same way and in the same order) have been things I've liked in games. A total lack of options and especially (tight) time limits are something that make me furious. With this kind of a mindset I was going to have some problems, but you have to start somewhere, no?


After all this I approached the whole issue from the opposite end. From my previous top-down to bottom-up -like approach. Not really conciously but half by accident. I was just happily poking around, doing this, seeing what kind of things I could actually do with Pygame and how to do those things.
With a couple of silly coordinate points and a bit of headscratching the pygame.draw.Polygon(...) brought some fascinating things on my drawing surface. "Hey, I could actually go and move that piece based on the keyboard events! How did that work...."

What weirdness am I working on? I'll tell you more next week.
I know I'm an evil teaser and I enjoy it. Muahahhahahaa!


Damage case

A stupid head makes the whole body ache. Or something like that.

What does one do with finger joints anyway?

The story in its shortest form: I broke a plate in my hands and ended up getting stitched. Of course the worst damages I took to my right thumb, so the building project is on a dry dock for a short while at least. Why so? Because after the stitches can be removed it's just about the time for my winter vacation and all the hectic busyness it brings so my modeling time runs low in general. We'll see how it all goes.


Inside job

The basics

Unsurprisingly I've kept on building where I left the last time. That translates to the workstations of the driver and the radio operator (or that's what I assume it is), as far as I dared at this point. Both chairs I left off so I'd have the space to airbrush a new layer of primer and then a white-ish indoor paint. At this point I can still poke around painting details (such as the radio, dials, handles and some random wear and tear), then I'll glue the seats on and the next noticeable parts. When I'm done with that I'll get to jam the next main part in and keep on adding the smaller details. Shouldn't take long before the insides are as complete as they're going to be.

This'll be cramped

Fill the whole damn hulk with explosive items!


Interior decorating

Starting with the furniture

This time I decided that I'll assemble most of the passenger compartment before applying the white paintjob on the insides and the contents. After that I'll add the rest, such as the ammo racks + shells and other essentials. So once again we get to wait in suspense: did I come up with a good plan for assembly-painting  of this model or is this going to suck like a swampful of quicksand. Mostly the problems with paintjobs are my own and no one else pays any attention to them, but if I know that something's wrong... it bugs me quite a bit.

Wheels and friends

Somehow I didn't feel like working at all with the drive sprockets, idlers and road wheels, I happily decided to postpone that part of the project for another month or year, even. This tank will be painted from its core outwards and beyond. Not that the hull's going to be complicated or anything: it's going to be dark green, independent of who reigns over the passengers.


Primed and so not ready

Grabbing myself from ne neck like the infamous baron von Münchhausen I dug out my painting tools yesterday. The compressor, the airbrush and my grey primer (Vallejo 73.601). After two rounds and about 24h of drying time the situation is: the pieces are just about primed. Maybe my inspiration and "yeah, let's get this thing done!" feeling strikes soon. I've just got so many things going on at the same time, it felt a bit difficult to begin another one.


I think I've made some mistakes with my primer, either I've thinned it down too little or something's dried a bit in the container. The problem presents itself by clogging up the airbrush (or it just spits annoyingly). Perhaps I should've followed the trick with pantyhose: use a piece to filter the paint while adding it to the container of the airbrush. As if I remembered that and bought a pair of those for future use... I'm not going to run anywhere to buy a set of ultracheap pantyhose at nine in the evening...

Hull and stuff

Random sprues, part n

Of course the darkest option is the classic and maybe even the likely one. I just don't know how to do this stuff. But it doesn't matter, I wouldn't be the only one;)


Project III/12 - M-10 Achilles

New tracks to be explored

I'm known to be a huge fan of German war machines. This is a fact that anyone can verify by checking the post history, for example. If I stop to ponder for a moment, in the early days of my modeling days I did build a Soviet Polikarpov plane and a bunch of years ago a T-34/85 tank. Other than those I can't at least remember stepping away from the paths of Wehrmacht, as long as we're talking about models based on the real world.

To be more exact I think this is the first time I jump to the western Allies. Oh, the weird things I end up doing. The packet offers two options: the British empire or the Polish people. Right now I feel like playing with the islanders but I've got the time to change my mind a few times about that. Not that it matters horribly much: both the patterns the schematics suggest are dark green.

How boring.

Getting my hands dirty

So let's open the box and observe the wondrous contents! Of course everything was packed in plastic bags so before anything else I made a ton of garbage.

The box and a pretty reflection

The instructions and some bagged goods
Achilles' box contained almost a dozen sprues, two hull pieces, a silly piece of string and astonishingly narrow rubber band tracks. I don't have any doubts of this: I'll get a good amount of time wasted on this, especially as the interor seems to be nicely detailed. Perhaps I'll come up with a decent and sensemaking order of assembling and painting all this.

Somehow I dare to doubt it, anyway ;)

Parts in open air


Project II/12

I admit openly, that this year's projecting under the labels of painting and building has been pretty slow. Despite that my second german cat is done! Awesome, wonderful and exciting!

The final stretch

Those track links I advertised the last time found themselves painted, messified and cleaned up before I threw them to the rear sides of the tank. There were six slots for these and I had four sets of track pieces to divide however I pleased. For a change I went asymmetrically and gave the left side three pieces and a single one on the right side.All the empty slots got those L-shaped pieces to show that there could be something. The remaining eight L-pieces I cut short and glued them on the top of their places. Should someone take a look at my model from below, that one'd notice that the bottom parts have gone missing.

A mess

To make my model pretty I made it dirty. A muddy tank was my goal, so the tracks, the rear deck and the top of the copmartment got some Tamiya weathering master set's "mud" pigment. I guess it looks like some people have been roaming on top of my tank with poopy boots. At least I hope that's the impression any observers get. The muzzle brake of the 88PaK43 was dirtified with Vallejo's 73116 "Carbon Black". I really have to learn how to use that stuff, it feels so weird compared to the Tamiya's makeup.
Lastly I poked the tracks and the lower hull with my Tamiya weathering stick ("Mud"). Maybe this time I didn't get overexcited with it?


SdKfz 173 Ausf. G1 Early Production

Pictures, as usual, tell more than a thousand words:

The infamous muzzle brake

Of course I could've changed another lens to the camera, but I wanted to see what kind of photos I get with this one, in the dark of the evening and under electric lights. Now I've tried it out.
Should anyone know what I used as the background, they'll get a point.

Coming up

Next I'll take up the brits or polish army but I shall still remain rolling in mud and who knows what. Maybe even next week my "almost FiFo" work queue pops out my gift kit: Italeri's M-10 Achilles.


Rustification preparation

Lasse's earlier comments in my silly blog's finnish version stuck to my head and I decided to try his method. More or less, because I don't have the exact colours he mentioned but that's never a real issue anyway. The idea is what it is and I'll do what I get to do.

This is going to be ugly

My target is the set of track links on the rear sides of the tank, they aren't muddy and lumpy but pieces that have been hanging there for a good while. So the base is going to be Flat Alu, dirtified by a very diluted mix of Flat Brown and my own custom orange made of Vallejo's Game Colors (Bloody Red + Bald Moon Yellow). I think it sounds like a good, useful idea but you can disagree all you want ;)


Carrying more crap

This time I added some of the missing knickknack to the sides and winterized them, too. Not much is left anymore, the tow cables (should they survive) and the fixing of the tracks. Right now I just couldn't find the motivation to fight with them so I did something else, while I still could :)

Even the tow cable is there!


Dirty tracks

I got something done again, track-painting to be more exact. You'll see it in the pics that my badly set lights (I rushed to paint on the expense of proper preparation) ended up causing some "bald patches" that I need to fix later. Yeah, it's my own fault.

In any case, the process was pretty straightforward. The base layer was done with Tamiya's XF-10 (Flat Brown) and later on top of that I liberally drybrushed some Tamiya's XF-16 (Flat Aluminium). Because that Al layer didn't look good enough I applied a Citadel's devlan mud wash. The result ended up pretty decent in my opinion, it's just a shame that I have to fix a couple of places afterwards.


Now the big cat can hunt!


I admit that I hadn't figured out all the coolness in these Magic Trax when I started. Those are tons better than what I used to work with, if I use them properly. The victory is reached via pain and suffering, so maybe  at some point a tank model of mine looks like I've envisioned it in my sick mind.

Or maybe not, but being "close enough" would also work. So that I wouldn't need to be too embarrassed. I'd like that.

Tracks are done, the kitty is on the prowl

A piece is off, I've got to fix it!

Now that the tracks are just about done, after one last fix, I'll start looking towards my paint pots again. I know that it'd been tons easier before gluing the tracks on the tank, but this is how it goes after I started changing my mind in the middle of the build.

Oh, and the finishing touches and last pieces are still missing. That shouldn't take long. And yes, I know, you've heard that one before ;)


Lazy linkage

Somehow building the tracks has been very, very slow. I even changed my mind about the assembling/painting order because my original idea just didn't feel that nice. About half of the pieces are done, the rest, meaning the shorter curves I think I'll do in one sitting, whenever I get to :)

The painting of the tracks will be its own project, we'll see later how it turns out. Just don't bother holding your breath while waiting, even if you were the legendary Guybrush Threepwood himself...



A couple of years ago I got a copy of Borderlands as a gift. The makers called it a Role Playing Shooter and just about everyone else dubbed it "Diablo with guns". Oh well, I once tried the first Diablo for almost fifteen minutes and didn't like it, so that description didn't really help me understand what was going on. But when the teaser had a huge guy punching a leg off a midget, I was getting quite interested in the game already. I know I'm sick, so what? :)

"Strip the flesh, salt the wound!"

Pandora's landscapes are neat, immense and the machinery is insane - just like everyone on the planet with the ex corporate employees, indigenous life forms and what have you. Not that there was a lot of time to observe the sceneries, but a bit anyway. Of course there was even less time to take screenshots and I only started doing that in the last places, but that's how it goes sometimes.

"I'm gonna rip your arm off and beat your baby with it!"

I'm not going to try to write a deep or specific story about the game this long after I finished the game for the first time, but I'll mention that the first playthrough of the base game took a bit over one hundred joyous hours. So what next, as I didn't feel like starting the second playthrough straight away? To the wonderful world of ripoffs, someone would say - but not me!


Of course I did some research about the three DLC packs that were available at that point. I don't have the habit of blindly throwing my hard-earned monies away. Usually.
The first one, a zombie island thingie, promised more shooting in the spirit of B-class zombie movies. Moxxi's riot offered multiplayer-friendly arena fighting (I wasn't interested in the least) and General Knoxx's set was described as a long new story with more vehicles and a higher level cap, to begin with. Not that the LC was important to me, my character wasn't even at 40 at that point if my memory serves. So I chose the zombies, even if no one guaranteed chainsaws or flamethrowers.

Dr Ned's type B Zombie Island

Zombies. An insane amount of zombies and werethings and other thematically appropriate enemies attacked like a tidal wave of evil. Limbs flew around, brains fell on the ground by the dozens and they still kept coming. Every once in a while the going just got hysterical and damn difficult when there were just way too many zombies. Just like in the greatest classics of the genre, those buggers just aren't even the classic slow zombies... Lucky me had an awesome machine gun with explosive x4 bullets, bwahahahhahaa!

On the story side dr Ned has been working on a cure to the undead problem, but so far all he's achieved is a couple of more or less voluntary test subjects turned into wereskags and other abominations. Of course I had to help my fellow man with his problems but maybe not that surprisingly I had to mow him down a few times, too, in the end. Oh my, I'd never guessed! But that's how it has to go in these stories 8)

Jalat jäivät matkalle mutta silti se vaan jatkaa... sitkeä perkele!

Knoxx's gun locker

The Secret Armory promised more of the story (hohoo!), more vehicles (at last!), rarer and better guns (wohoo!), more loot (yay!) and eviler enemies (errr...). General Knoxx of the Atlas Corporation's Crimson Lance arrived to Pandora on an unclear mission after the Vault was opened and the guy called every once in a while to chat a bit. He was a jolly chap, until he had to start working himself.
To get to the gun storage I had to solve a good bunch of quests, running errands following the greatest traditions of RPGs and drive around narrow roads. All this while being hunted by a team of assassins who struck either out of the blue or obviously - depending on how busy I happened to be at the moment... No matter what, it was always when I maybe didn't quite need that sort of extra entertainment.
"Oh, hey, I sent Gamma team over to kill you. No hard feelings. Love!"
The foulest enemy in the whole game, Crawmerax the Invincible, was found in the end of this pack. I've heard that this megaworm could be slayed even by a single player Mordecai, as long as you're on level 69 and the maggot is 72, but but but... I'll squash it one day. Of course I could give in and go for a multiplayer session against Crawmerax, but those few I know to play Borderlands haven't been of company in those ultrarare moments when I could've spent the time.

But wait, that's not all!

At some point Gearbox declared a fourth DLC pack: Claptrap's Robot Revolution, obviously with extra goodies and who knows what. Of course I got it, too. If the story was taken to the mad path in Knoxx, CRR kept on it and went further. INAC and its minions / victims have installed modchips into the heads of just about everyone dead or alive on Pandora, so I had a sea of weirdoes from Skagtraps and Psychotraps to the trap-versions of previous bosses - some of them repeatedly. Oh, and waves after waves of different sorts  of Claptraps. I really enjoyed destroying those at last. The story? "Wade through blood, oil and bodyparts, find INAC and end the revolution quickly and preferably violently". That is exactly what I did, oh yes.

This looks sane

"I heard that your entire life flashes in front of your eyes the second before you die... that’s a load of crap…no wait…okay, there it goes."

If there's something I'd complain about the DLC sets, it's the lack of FTN nodes. You get to the startpoint of the hub via the Fast Travel Network but from that on you need to walk, run or drive to wherever you are going. At least in tSAoGK it gets a bit old sometimes, because the map is so large. A simple jump point in the opposing edges of the map would've been awesome, especially after all the roads are opened and there's no story-based reason to make you drive from one extreme end to another - repeatedly.

Why am I mumbling about this game now?

Yes, indeed. I pre-ordered that over eagerly in last month when my internal calendar was a bit off. At least I won't forget it!
Because of this I took it as my business to get my Mordecai to the level cap before my vacation and to roam around just for the fun of it before succumbing to the sequel. I had finished the main game's second playthrough (there's no way around it: the Destroyer is an anticlimax if there ever was one) a couple of months ago, so I suddendly noticed that I'm playing the playthrough 2.5 (being rewarded with tougher monsters, mostly at my level +2), so after running up and down the Eridian Promontory a few times I was done.
Why on earth did I keep playing that same level a handful times instead of advancing to the DLC maps for more variety?  Those buggers got too difficult and especially too slow compared to the amount of XP and entertainment they provided :p Sorry, I'm lazy and comfy sometimes :)

That's it, what next?


Kuat Systems Engineering Firespray-31

Years ago I took it as my business to build and paint Boba Fett's neat ship. This modified patrol and attack craft wasn't easy to paint like its real life counterpart, as you can clearly see from the photos. In hindsight I could say that I started my weathering nicely, in my own opinion at least, but today I'd do a lot more and stronger. Back in the day I was happy with the model and it looked good to me. I guess I was just a bit cautious and didn't want to ruin what I had already achieved.

Slave I

Captain Solo