amiga-news DEUTSCHE VERSION
.
Links| Forums| Comments| Report news
.
Chat| Polls| Newsticker| Archive
.

[Login] [Register] [Forgot your password?]

< Next messagePrior message >
08.Dec.2022



Advent Calendar: Door 8 - Daniel Müßener
For the 8th door of our Advent calendar, we were able to win Daniel 'Daytona675x' Müßener.

Who would like to play "Battle Squadron" again? :) Originally developed by Cope-com in 1989, the game was re-released for AmigaOS 4 (and iOS, Android, Windows, OS X) by the makers together with Daniel at the end of 2013.
At the end of 2015, a port of the game "Wings! Remastered Edition" for AmigaOS 4, AROS and MorphOS was announced and a first preview was published. A new demo version was then available at the beginning of 2020.

In addition, Daniel released the AmigaOS 4 version of the arcade shooter Tower 57, which was crowdfunded in the summer of 2015, in early 2018. Likewise for AmigaOS 4 on behalf of A-EON, he is developing the OpenGL ES 2 wrapper, first announced in 2016, which is part of the Enhancer software.

The developer is currently working on two projects: Atomic Bomberman Fan Rewrite is a revision of the eponymous Bomberman variant for Windows from 1997. The improvements include that it runs again on current Windows versions in addition to Amiga systems, USB input devices can be used, up to ten players can be active on one device and the game modes have been revised. There is also network support for online competitions. Version 2.15 is currently available on his website.

Finally, Daniel regularly informs about the development status of his football game in 3D optics, "Souverän Soccer", whose target platform is an Amiga 1200 in delivery condition, by means of preview videos. And quite "incidentally", his CV also includes the Amiga Future honorary offices of "translator" and "Gamescom man for everything"!

Thank you, Daniel, for your commitment to the Amiga and of course for your Advent story which now follows:

"It was neither during the contemplative Christmas season nor Easter, New Year's Eve or Carnival, although a corresponding overkill of red wine, eggnog or Kölsch would have been an explanation for my mental derangement, which I would like to tell you about now, my dear children.

Not so long ago it happened that I was desperately tinkering with the serial-link feature of my Amiga soccer game. It was already late at night and the rain was pattering on the office window, the sound of which could hardly be distinguished from the clicks of the maltreated keyboard.

Unfortunately, our Amiga's serial isn't something she can brag about. But if you stuff her slowly so that she can look at each bit three times and from all sides, then she can swallow'em just fine. The protocol for the game is very compact so as not to overwhelm the ladies. If initialized with the same random seed then the game is fully deterministic, the outcome only depends on the player-input sequence being applied over time. Therefore, it turns out that fortunately a meager 2 bytes per machine must be transmitted per frame. That's a good thing because there's not enough performance remaining for more, at least on a naked A1200 running "Souverän Soccer", where you're already at the extreme limit and absolutely must keep 50 fps with minimal latency.

Anyway, all joystick and key commands, implicit synchronization and error correction information are contained in these 2x2 bytes. But it was a rocky road until I got there, and the protocol's evolution consisted out of many repeating circles of trying out, crying and throwing away again. And of course, at the beginning there was a much simpler protocol.

First it was merely a proof-of-concept. For that Amiga #1 (let's call her "Santa") simply sent 1 byte with its current joystick bits to Amiga #2 ("Rudolph"). Rudolph, on the other hand, sent 2 bytes, namely his own joystick data and the last one received from Santa. Exactly this input pair was then used by both for the calculation of the next simulation step.

And here we are, back in that night outlined above. Team "Santa" and team "Rudolph" were finally about to show on the pitch what they had rehearsed in theory. But apparently our two minions were conspiring against me or some Poltergeist in the machine was involved:

If you moved Santa's active player, then Rudolph's focused player would also run in the same direction - and as if that wasn't wrong enough, they only did that on Rudolph's screen, on Santa's both player objects didn't move at all! And when you used the joystick attached to Rudolph, the same thing happened, only from his mirrored perspective!

That cannot happen! Every programmer knows this sentence well enough, but it has rarely been more appropriate than in this case. This behavior simply could not and should not occur, completely impossible! Nevertheless, it happened. But even after two more terribly long hours, all I managed to do was to make things even worse.

At one point I felt like Tom shredding up Jerry's diary. But before the poor Amigas or Competitions had to die an undeserved death, I preferred to pull the plug and leave my workbench with a shuffling gait and sagging shoulders towards bed.

But even there I was not allowed to rest: in my dreams I found myself in the middle of a storm on a greasy, sodden soccer field. With each flash of lightning, the outlines of spaghetti-code-text-fragments shimmered through the clouds, forming ludicrous sigils. Tens of thousands of morbidly bloated zeros and worm-like squirming ones cavorted in the grandstand. My ears were ringing not so much from the cracking thunder as from the deafening fan chants, which most closely resembled a C64 tape played on the stereo. After a moment of dizziness and disorientation, I realized I was standing in one of the two goals. Then a very sharply shot apple hit me at the skull! The shooter used my near knockout, followed up and converted the rebound all too confidently. The fact that all players were two-dimensional pixel men was not particularly remarkable. But what caught my eye were the team shirts: while my team's jersey featured a & ampersand, the opposing team showed a simple vertical line, much like a pipe symbol. But before I could wonder any further, I got a ball in the stomach - and another - and another. When I got my hands on the last one, I saw that it wasn't a classic football, but a green, round, shriveled something, which stared at me with two teary eyes and said with a grin: "Get up, stupid dad!".

After waking up in a sweat and stopping my daughter from continuing to bounce on my stomach, three things revealed themselves to me with absolute clarity:
Firstly, years of C64 and Amiga gaming definitely left some marks, secondly, children give you so much in return, and thirdly, there was something about those nasty pipe strokes and the ampersands, my subconscious had noticed something that had escaped the higher-level part.

All right, cat bath, coffee, morning stool, freshly back to work! And lo and behold, it took less than a minute to discover and correct the cause of the problem. So, what had happened?

Within the whole game logic there is a variable that stores various on/off states as bits. Among many other things, there's one bit indicating whether a serial link match is currently running and another one which determines if the respective Amiga acts as Santa in that case. Accordingly, there are locations where these bits are tested to decide which code path to take. In C this looks like this, where gf_Santa simply represents this specific bit:

if(gameplay_flags & gf_Santa) {
// Santa-stuff comes here
} else {
// Rudolph-stuff comes here
}

And right here a tiny but mean typo had crept in. Instead of this & (binary AND) there was a | (binary OR):

if(gameplay_flags | gf_Santa)

In contrast to the desired bit test, this is just crap, unfortunately syntactically completely legal crap which doesn't even trigger a compiler warning here. I could also have written if(true) here, the effect would have been the same, namely that only the Santa code was ever executed - even if running on a Rudolph :P This typo can only be explained with temporary mental derangement. To crown it all, as a programmer you are lazy by nature. Which is why this error had doubled because I had copied the wrong line to another place, so this quirk was in both the receive and the send logic.

Ultimately, this is what happened if you pushed Santa's joystick to the left:
  • Santa sends his joystick data, "to the left"
  • Rudolph sends his joystick data, "idle"
  • Santa wants to receive 2 bytes, but so far there is only 1, so nothing to do
  • Rudolph wants to receive 2 bytes, but so far there is only 1, so nothing to do
  • Santa sends his joystick data, "still to the left"
  • Rudolph sends his joystick data, "still idle"
  • Santa has now received 2 bytes and interprets them as "Player1: nothing, player2: nothing"
  • Rudolph now has 2 bytes and interprets them as "player1: to the left, player2: to the left"
Argh! Of course the whole serial-link construct didn't really work properly after the & correction, but the penny had dropped and a first test match was successfully held on the same day.

And the story's moral? Never underestimate your own routine-blindness and goofiness, stupid dad! Well then, good night, dear little children!" (dr)

[News message: 08. Dec. 2022, 04:15] [Comments: 1 - 08. Dec. 2022, 09:32]
[Send via e-mail]  [Print version]  [ASCII version]
< Next messagePrior message >

.
Masthead | Privacy policy | Netiquette | Advertising | Contact
Copyright © 1998-2024 by amiga-news.de - all rights reserved.
.