Zenithia2023-06-04T11:49:55+00:00https://zenithsal.comZenithSalUpdates on native mode GL on Raspberry Pi Zero2023-03-15T00:00:00+00:00https://zenithsal.com/raspberrypi/2023/03/15/updates-on-native-mode-gl-on-raspberry-pi-zero
<p>After <a href="https://zenithsal.com/raspberrypi/2023/03/10/running-native-mode-gl-on-raspberry-pi-zero">last post</a> I had a few realizations when I compiled raylib and tested the same examples on my aging Macbook Pro that I’ve revived. The module music example crashes the same way! so the RPiZ/3 were innocent. And the colored cubes example is very expensive to run on the Intel Iris 5100 too which is not a slouch. So I had to redo these two tests to make sure I made a correct evaluation.</p>
<p>First, running a different cubes drawing demo on RPiZ resulted in a solid 60 fps:</p>
<video width="720" height="405" controls="">
<source src="https://zenithsal.com/assets/videos/rpiz_native/vid_cubes2.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
<p>Also I realized the reason why the textures_bunnymark demo didn’t show any bunnies on the Raspberries is that I had to modify it to emit bunnies with keyboard input since there is no mouse cursor when running native GL like that, but all the bunnies were being spawned at <code class="language-plaintext highlighter-rouge">GetMousePosition()</code> which always returns origin of screen in this case and the bunnies stay under the top rectangle!</p>
<p>So now the bunnies are spawned in the center and it works perfectly:</p>
<video width="720" height="405" controls="">
<source src="https://zenithsal.com/assets/videos/rpiz_native/vid_bunnies.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
<p>Can render up to 2000 alpha-blended bunnies to the framebuffer while maintaining a solid 60 fps! that’s not bad at all for 2D games. Once we get to 2100 bunnies the performance drops drastically from 60 to around 52 fps. This kind of predictable performance is only possible in native mode, so I consider this experiment a success. 🙌</p>
Running native mode GL on Raspberry Pi Zero2023-03-10T00:00:00+00:00https://zenithsal.com/raspberrypi/2023/03/10/running-native-mode-gl-on-raspberry-pi-zero
<p>I’ve always found the RPiZ interesting due to it being so limited and slow (lol) kind of why I like Amiga A500 or Atari ST.</p>
<p>My vision for the RPiZ was to use it like it’s a low level development gaming platform with a respectable GPU compared to older GPUs before DirectX9. The problem is that modern day linux (Raspbian included) is way too much for this little chip that it makes it almost impossible to use for GUI-based development and the super-outdated and bloated X11 tasks the hardware too much that any OpenGL performance is completely unpredictable and choppy.</p>
<p>The RPiZ comes with an ARM11 processor that uses the arm6vl architecture. It has a floating point co-processor (called vfp) and some not-so-useful extensions like running Java byte code in hardware. The RPiZ runs the processor at 1000MHz which sounds like a lot.. but it pales compared to a Pentium III 600MHz for example. I heard it compared to a Pentium II 300MHz with a small cache and a terribly limiting IO bandwidth.</p>
<p>Its GPU is the Video Core IV which on paper supports OpenGL ES 2.0 and uses a tiled-renderer. It’s quite cool that this GPU is entirely detailed in <a href="https://docs.broadcom.com/doc/12358545">this freely available document</a>. On paper it has a compute capacity of around 24 GFLOPs. The GameCube is said to have 9.4 GFLOPs in comparison. There is no way the VC4 can produce the same rendering level as the GameCube as it doesn’t have dedicated memory or enough bandwidth to do anything like that.</p>
<p>How can we get the true GPU performance with minimal intrusion from the operating system?</p>
<ol>
<li>we could boot from baremetal and use <a href="https://github.com/rsta2/circle">the Circle library</a> to access the hardware including the vc4 GPU with OpenGL</li>
<li>we could run natively from command-line by starting our own framebuffer and using that</li>
</ol>
<p>I like the first solution as it sounds like a lot of fun and is the fastest, but it has an expensive overhead and iteration during development is going to be a challenge.</p>
<p>I opted to do the second solution as it appeared to be the easiest. I know that SDL can do native build with graphics support but I was able to find a great library similar to one I was developing 2 years ago except it’s actually finished lol and it’s <a href="https://www.raylib.com/index.html">raylib</a>.</p>
<h3 id="build-raylib-with-native">Build Raylib with native</h3>
<p>I used a fresh DietPi image on RPiZ, to build raylib with native graphics I did:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mkdir build && cd build
cmake .. -DPLATFORM="Raspberry Pi" -DBUILD_EXAMPLES=OFF
make PLATFORM=PLATFORM_RPI
sudo make install
</code></pre></div></div>
<p>To build the examples there are a few things that need to be done:</p>
<ul>
<li>add <code class="language-plaintext highlighter-rouge">atomic</code> library to examples/CMakeLists.txt in the build loop at the end of <code class="language-plaintext highlighter-rouge">target_link_libraries</code> so it should look like this: <code class="language-plaintext highlighter-rouge">target_link_libraries(${example_name} raylib atomic)</code></li>
<li>exclude two examples from building due to a conflict in GL, add these before <code class="language-plaintext highlighter-rouge">if (${PLATFORM} MATCHES "Android")</code>
<ul>
<li><code class="language-plaintext highlighter-rouge">list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)</code></li>
<li><code class="language-plaintext highlighter-rouge">list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)</code></li>
</ul>
</li>
</ul>
<p>Then rebuild raylib with examples: <code class="language-plaintext highlighter-rouge">-DBUILD_EXAMPLES=ON</code></p>
<p>Keep in mind if you’re doing this on Raspberry Pi 3, you don’t need any of the changes to build it correctly and you should also build the “DRM” mode rather than “Raspberry Pi” mode which is legacy.</p>
<p>So on RPi3 this is how to build:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cmake .. -DPLATFORM=DRM
make PLATFORM=PLATFORM_DRM
</code></pre></div></div>
<p>you’ll need a few extra dev libraries to build correctly: libgbm-dev and libdrm-dev</p>
<h3 id="results">Results</h3>
<p>Not great. Mostly due to the driver not being great. OpenGL seems to be missing VAO support and blending is a bit glitchy (running textures_bunnymark shows no bunnies!), also R32G32B32 texture format is not supported which is needed for the skybox example. Also the PiZ hard freezes at random after a while, but this could be my RPiZ only as I always had this issue.</p>
<p>Another odd issue is that running audio_module_playing segfaults.</p>
<p>Other than that, when it works it feels great! instant startup and smooth.</p>
<p>Here’s the spotlight example showing how expensive this is on the GPU even if it was running at 800x450 only:</p>
<video width="720" height="480" controls="">
<source src="https://zenithsal.com/assets/videos/rpiz_native/VID_20230310_104833.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
<p>Here’s the maze example working correctly:</p>
<video width="720" height="480" controls="">
<source src="https://zenithsal.com/assets/videos/rpiz_native/VID_20230310_105124.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
<p>And here’s the cubes example to show how terrible the performance could get, however this demo in particular could be running into a feature reported by the driver to be available but it’s actually running in software but I don’t know that for certain:</p>
<video width="720" height="480" controls="">
<source src="https://zenithsal.com/assets/videos/rpiz_native/VID_20230310_104942.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
<p>Yeah, you could probably make simple graphical demos but this is not what I’d expect from a 24GFLOPs GPU and I blame the vc4 driver.</p>
<p>I tried this same thing on RPi3, compilation runs much faster naturally but the issues graphical and beyond are all there too as it uses the same vc4 driver including the missing bunnies in textures_bunnymark :(</p>
<p>RPi4 might be the one? haven’t tried it yet.</p>
Immutable Operating Systems2022-09-19T23:59:00+00:00https://zenithsal.com/linux/2022/09/19/immutable-operating-systems
<p>I’ve been using <a href="https://kinoite.fedoraproject.org">Fedora Kinoite</a> on my main laptop for about a year now. Kinoite is a spin of <a href="https://silverblue.fedoraproject.org">Fedora Silverblue</a>. This is the first and only immutable operating system I’ve used to date.</p>
<p>To explain why immutability is so important in my view, let’s take a look at some examples from other systems.</p>
<h4 id="mutability-by-bad-decisions">Mutability by bad decisions</h4>
<p>Let’s start with Windows. In my opinion the worst wide-spread operating system of them all. It’s basically a collection of bad decisions upon bad decisions dating back to the 90s dictated by the requirements of back-compatibility on legacy features that enterprises wish to drag along with them forever.</p>
<p>An example of one of those outdated decisions is that Windows was always designed to be a mutable OS.</p>
<p>What does that mean? you can go into your Windows system folder and delete anything you want. Windows may not stop you. In fact you need to do this every now and then to clean your system folder from 10s of GBs of Windows logs and/or temporary install files that their updater (another broken legacy system) just ignores.</p>
<p>Another example of one of those bad decisions is the registry. You can just mess with it to your hearts content, delete whatever you want, and it’ll mess up the whole system!</p>
<h3 id="mutability-by-design">Mutability by Design</h3>
<p>Linux as an operating system was designed from the ground up to be mutable but it’s done right in my opinion. The user has full complete freedom to do anything they want in the system allowing advanced users to do whatever they can think of.</p>
<p>You want to experiment on a different OS scheduler? a different way to install device drivers? have at it at your own peril.</p>
<p>The drawback of course is that this absolute mutability is hostile to its users. I can’t count how many times I killed my installed distro by attempting to update an NVIDIA display driver.</p>
<p>BSD is an interesting variation on the mutability by design philosophy. It actually achieves better stability and is more friendly to its users simply by being a larger OS that comes with many more batteries included and a slower more sensible evolution process.</p>
<h3 id="the-walled-garden">The Walled Garden</h3>
<p>On the other extreme all modern mainstream phones are powered by immutable systems that require a jailbreak to escape from. An immutable system cannot be changed in anyway by its user, only by the system or software makers themselves issuing updates to it.</p>
<p>An operating system with a walled garden design proved to be vital for stability and long term dependable robust operation. This is part of the reason why we depend on our mobile devices so much. We know they are very unlikely to misbehave or break internally like a Windows laptop often does.</p>
<p>This is also reflected in all Apple OSX devices like Macbooks. They are super dependable and clean.</p>
<p>However these systems come with a large drawback: the user does not really control the system, and the system controls what the user can and cannot do.</p>
<h3 id="immutable-operating-systems">Immutable Operating Systems</h3>
<p>Between the fragility of mutable systems and the authoritarianism of walled gardens lies a sensible middle.</p>
<p>A system that offers the same immutability you find in OSX/iOS/Android so it’s dependable, robust, and maybe impossible to break by the end user. Yet, it maintains the ability to let the user change most things in their system if they really want to, while also providing a method to reverse these changes non-destructively!</p>
<p>So what are the elements that Fedora Silverblue provides that let’s it achieve all that?</p>
<ul>
<li>Immutable system: neither you nor any software can change any system specific files/folders directly as they are protected from writing</li>
<li>Atomic image updates: the system gets updated as an image rather than the usual package manager approach. This eliminates any issues that may rise from wrong dependencies as well as provide a straight forward way to jump back to a previous image of the system or a future one still in beta to test things out non-destructively</li>
<li>The system image operates as a version control system via <a href="https://coreos.github.io/rpm-ostree/">rpm-ostree</a> which acts as a package manager of sorts. It allows you to push changes on top of current system image, this way you can apply any system changes you need (such as install NVIDIA drivers or any tools you may need in the OS) and these changes “shadow” any existing data. At anytime you can revert or cherry-pick these changes or altogether discard all commits and restore original system image. When system image is updated, your committed changes get pushed on top of the new image.</li>
<li>You may install any software you want from <a href="https://flathub.org/home">flathub</a> (flatpak is supported by default) and you can also install snapd by committing the change on top of the system image using rpm-ostree to enable <a href="https://snapcraft.io">snapcraft</a>. And finally my favorite method: AppImage</li>
<li>For developers, one of my favorite features in Kinoite/Silverblue is <a href="https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/">toolbox</a>. You can create as many toolboxes as you want each acts as a self-contained mutable install of Fedora/Centos where you can use dnf to your hearts content and can even install and run GUI applications seemlessly like VS Code. I naturally setup a toolbox per project and can go crazy in any of these toolboxes without worrying about my actual system getting poisoned in the process</li>
</ul>
<p>In my opinion this is the perfect developer OS: as solid as OSX or iOS without sacrificing flexibility to change the system, best dev containers system I’ve used so far (much better than manually creating dev containers), and it still works perfectly for gaming by installing steam using rpm-ostree and steam runs in its own sandbox so that’s all you need.</p>
<p>However it’s anything but perfect. Here are some of the challenges I’ve run into so far:</p>
<ul>
<li>sometimes when an OS image update is available, some changes in it conflict with packages you installed using rpm-ostree and it fails to update as a result. The error and info you get are vague but the easiest way is to simply uninstall whichever packages are conflicting with the update</li>
<li>I could not for the life of me get an NVIDIA RTX GPU to work via Thunderbolt, I followed every single guide I found and eventually gave up and installed Windows on an external drive for playing newer games</li>
<li>Running GUI applications from within toolbox works, however there is a really annoying bug that occurs when you quickly move between app UI elements with the mouse, the whole system pauses for a second (mouse included) and resumes after. This seems to be much worst in electron apps <em>sigh</em></li>
<li>Updating your software works from Fedora’s software manager (Discover) but sometimes some updates just fail for no apparent reason, retrying gets those updates to succeed most of the time</li>
<li>Can’t change the wallpaper in the Login Screen as it’s in a system image path (might be a Kinoite specific issue?)</li>
<li>Installing Lutris and other game launchers (ubi, epic, etc) is problematic as wine is not part of the default system image and must be applied using rpm-ostree</li>
</ul>
<p>And that’s that! since Silverblue there has been other immutable Linux distros, <a href="https://github.com/castrojo/awesome-immutable">this awesome list keeps track of everything immutable</a>.</p>
GoVolDot postmortem2022-05-22T22:15:00+00:00https://zenithsal.com/gamedev/2022/05/22/govoldot-mini-postmortem
<p><a href="https://cloudmillgames.itch.io/govoldot">GoVolDot is out!</a> Released it a few days ago after not doing anything with it for a few weeks.</p>
<p>I have this weird release hesitation sometimes, I think I’m worried to let a project go, let it fly out of the window into the wild harsh world.</p>
<p>GoVolDot was a very interesting experience despite its apparent simplicity. The goal I had for it besides that I always wanted to remake this game and actually play it, is to run a project through an entire production cycle in preparation for bigger things in the future.</p>
<h2 id="what-went-wrong-">What Went Wrong 🤧</h2>
<h3 id="estimation-fail">Estimation Fail</h3>
<p>My estimate for this project from beginnings to release was about 2 weeks. My actual total dev time was around 4 weeks of full time work.</p>
<p>While this is accurate for gamedev (2x estimated time). It still feels a little too much for a minimalist 2D shooter!</p>
<p>Some excuses:</p>
<ul>
<li>I was honestly surprised how many enemies with unique behaviors there were, around 25 unique behavior enemies. Took me full days of work for the most complex enemies.</li>
<li>Levels had very specific sequences for the game and the boss battles and I tried to reproduce them accurately. There are a LOT of events, so it took most of a day to play that level in the original game then clone all the events into my spread-editor.</li>
<li>I was also using Godot for a full-scale game for the first time, so had a lot to learn there and attempted many different ways to do things</li>
</ul>
<h3 id="messy-assets">Messy assets</h3>
<p>The project started quite organically so I threw together a large texture in affinity designer and used their sliced exports to spit out spritesheets per-object. However as the game scaled up to include more and more stuff, that simple process turned into a bit of a time-hole and produced many small sprite files sometimes a few pixels wide. I should have developed a better pipeline for that stuff.</p>
<p><img src="https://zenithsal.com/assets/photos/govoldot/spritesheet.png" alt="govoldot_spritesheet" /></p>
<h3 id="unfruitful-pursuits">Unfruitful pursuits</h3>
<p>I spent a lot of time playing around with different ideas and directions. Attempted to re-mix Volguard’s music theme twice then gave up due to not really being any good at music lol.</p>
<p>Here I had this crazy idea to switch to 3D for intro, syncretize, and reinforcement sequences:</p>
<p><img src="https://zenithsal.com/assets/photos/govoldot/3d-attempt.png" alt="govoldot_3d" /></p>
<p>And here is a taste of that awful remix I mentioned, you’ve been warned:</p>
<audio controls="">
<source src="https://zenithsal.com/assets/audio/volguard_remix.mp3" type="audio/mpeg" />
Your browser does not support the HTML5 Audio element.
</audio>
<p><br /></p>
<h2 id="what-went-right-">What Went Right! 🕺</h2>
<h3 id="nailed-the-feels">Nailed the feels!</h3>
<p>I got the feeling just right! the game is not 100% one-to-one to the original Volguard but it’s close enough - I’d say around 75% accurate.</p>
<p>There are a few bugs here and there but nothing major I’m aware of. All in all, it’s a playable game and one that I can replay myself and still be challenged and have some fun 🙂</p>
<p>Also I really like the font:</p>
<p><img src="https://zenithsal.com/assets/photos/govoldot/govoldot_font.png" alt="govoldot_font" /></p>
<h3 id="spread-editor">Spread-editor?</h3>
<p>For GoVolDot I needed a way to describe precise sequences of events across a long timeline. I could not at the time come up with a way to build that into Godot quickly, but for whatever reason I thought a Google spreadsheet might be ideal for this and it’s immediately available!</p>
<p><img src="https://zenithsal.com/assets/photos/govoldot/spreadeditor.png" alt="spreadeditor" /></p>
<p>Horizontal-axis is time at 0.25 secs steps. Vertical represents Y coordinate to spawn the enemy.</p>
<p>I could embed metadata about each spawned enemy behavior/look in its cell using this smooth-brain format: <code class="language-plaintext highlighter-rouge">bandit:edir=-45:vel=[-80 0]</code></p>
<p>This then gets dumped into a CSV file… yes.. into a specific path.</p>
<p>Then from there a constantly-running python script watching for any mission file changes, detects the change, parses the CSV and throws it into a GDScript file.</p>
<p>Then the game parses the actual CSV data at runtime and turns them into game events.</p>
<p>As hilariously complex as this spread-editor was, it actually worked and once all the moving parts were in-place I forgot it was there. So I consider it a win 💃</p>
<h3 id="scope-discipline">Scope Discipline</h3>
<p>Did I already mention I wanted to turn parts of GoVolDot into 3D sequences? yeah, I’m glad I didn’t dive into that hole.</p>
<p>Also, multiplayer support.</p>
<h3 id="coroutines">Coroutines</h3>
<p>In GoVolDot I used coroutines for enemies behavior (<a href="http://localhost:4000/gamedev/2022/04/04/state-management-with-coroutines">written a post about that</a>), and it simplified things a lot. I re-used that approach as many times as I could! it doesn’t work with all types of behaviors though. I found that if behavior needs to change based on external events it’s better to just implement that using a traditional state machine to avoid having to pass around variables for the coroutine to check against.</p>
<h2 id="conclusion">Conclusion</h2>
<p>I am happy with what I got at the end. This project has been on my mind since the day I had a “real” computer as I used to call x86 PCs when I was 19 years old.</p>
<p>Consider this checkbox.. checked!</p>
<p>And I gotta say, I’m really impressed with the level of depth and attention to detail this old game has! it’s beyond anything else I’ve had on my PC-6001 at the time and to imagine that the original developers created this game using Z80 assembly? and somehow managed to cram all required data and all those behaviors into 64KB!</p>
Log 1 Dawn of a new age2022-04-11T01:10:00+00:00https://zenithsal.com/gamedev/2022/04/11/log-1-dawn-of-a-new-age
<p>I’ve recently decided to dedicate myself to my passion in GameDev and attempt to make it self-employed. This was approximately 3 weeks ago.</p>
<p>I will try to write weekly or bi-weekly updates logging what I’ve done so far.</p>
<h2 id="week-1-set-my-heart-a-flutter">Week 1: Set my heart a flutter</h2>
<p>I’ve been preping this for a while and one unfinished thing I had to get through is figuring out a suitable pipeline for me to develop Android apps for tooling that I want to manage my time and budget.</p>
<p>The last thing I’ve done in this domain is attempt to utilize Python for Android app making, which is possible but what I tried was horrendous in its own way. I’ve looked at both <a href="https://kivy.org/">kivy</a> and <a href="https://beeware.org">BeeWare</a> on my Fedora Silverblue laptop.</p>
<p>Immediately ran into issues with kivy that made it a pain to get things running, so I moved on to BeeWare. Now, BeeWare works but there it’s anything but focused and compact. Lots of moving parts and things to set up and when you finally get it working, there isn’t much documentation and I didn’t feel like I got it after doing the tutorials they had available which by the way are incomplete and outdated.</p>
<p>I hate to say it but for the first time, Python failed me. So I decided to move on and focus on modern programming languages that are not derivatives or layers on top of Java like Kotlin is because I dislike Java and its ecosystem. I remember hearing about Flutter somewhere so I jumped there and it’s based on this current gen language called Dart. I liked Dart immediately as it reminded me of TypeScript.</p>
<p>When I started doing the tutorials for Flutter, it just clicked and I got what the high-level design was. You define UI layouts in a similar way to writing a JSON spec. Constructors within constructors, kinda like this:</p>
<div class="language-dart highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Widget</span> <span class="nf">build</span><span class="p">(</span><span class="n">BuildContext</span> <span class="n">context</span><span class="o">)</span> <span class="o">{</span>
<span class="k">return</span> <span class="n">MaterialApp</span><span class="o">(</span>
<span class="nl">title:</span> <span class="s">'Hello World'</span><span class="o">,</span>
<span class="nl">home:</span> <span class="n">Scaffold</span><span class="o">(</span>
<span class="nl">appBar:</span> <span class="n">AppBar</span><span class="o">(</span><span class="nl">title:</span> <span class="kd">const</span> <span class="n">Text</span><span class="o">(</span><span class="s">'Hello World'</span><span class="o">),</span>
<span class="nl">body:</span> <span class="kd">const</span> <span class="n">Center</span><span class="o">(</span>
<span class="nl">child:</span> <span class="n">Text</span><span class="o">(</span><span class="s">'Hello World!'</span><span class="o">),</span>
<span class="o">..</span><span class="na">etc</span>
</code></pre></div></div>
<p>It gets a little too LISP-like with the parentheses you need to manage, but nothing a good editor can’t figure out.</p>
<p>With this I was able to put together a simple alternative time app that allows setting up timers through Android’s native timers app:</p>
<p><img src="https://zenithsal.com/assets/photos/govoldot/cmgtime_app.jpg" alt="CMG::Time" /></p>
<p>it’s pretty simple, <a href="https://github.com/cloudmillgames/cmg_time">here it is in github</a>.
But it demonstrated to me this is totally usable and has a low time cost for developing tools like that.</p>
<h2 id="week-1-unfinished-pixel-business">Week 1: Unfinished pixel business</h2>
<p>Last year during the holidays, I started remaking my childhood game as a tribute to it. It’s an old forgotten game called <code class="language-plaintext highlighter-rouge">VOLGUARD</code> that ran on my first computer, an <a href="https://www.old-computers.com/museum/computer.asp?c=39">NEC PC-6001 Mk2 SR</a> produced and localized in Iraq.</p>
<p>As a kid, that game inspired and awed me. It just seemed to be too much for my humble machine and I could never figure out how they managed to squeeze that much stuff into it.</p>
<p><img src="https://zenithsal.com/assets/photos/govoldot/volguard.png" alt="VOLGUARD" /></p>
<p>It appears to me that the VOLGUARD version on PC-6001 was the originally developed one. MSX and PC-8801 both got ports with better graphics but they are missing some vital elements like the intro music.</p>
<p>So my goal is to re-make this game maintaining its exact feel and style using Godot. This first week I picked back up what I was doing last year, I’ve had some good progress going and thought perhaps this is going to be a few days only to finish.. estimated it at 6 days of work to completion..</p>
<h2 id="week-2-90--50">Week 2: 90% == 50%</h2>
<p>There is this funny thing in gamedev, that if you’re working on a project and you believe you’re at 90% progress and only a few things left to do… you still got 90% more to go.</p>
<p>I re-learned this lesson with VOLGUARD. A game I gave 6 days but it took nearly double that to get anywhere close to completion.</p>
<p>The biggest time sink is the enemies behavior. Unlike the majority of shovelware games out there that tend to implement enemies with a single braincell that basically says: “see player? run at and attack player”. VOLGUARD has actual relatively complex behaviors. A ton of them. Out of nearly 28 variants of enemies, there are roughly 20 of them with unique behaviors!</p>
<p>I developed a good pace in implementing these behaviors and tweaking them to approximate the original game. <a href="https://zenithsal.com/gamedev/2022/04/03/state-management-with-coroutines">My last blog post</a> was actually based on that.</p>
<p>There are 5 missions. Each introduce new enemies and more variations in behaviors. This game goes to the school of Souls.. you’ll die alot but it’s because you made a mistake and you can do better. Make no mistakes and you’ll breeze right through.</p>
<p>VOLGUARD also had this unique design decision where they allowed you to play any mission out of the 5 at anytime.</p>
<p>At the end of week 2 I had mission 1 fully implemented and tested with all behaviors and enemies, and mission 2 about two-thirds in.</p>
<p>So 6 days in.. progress = 1.5/5.0, not even 50%.</p>
<h2 id="week-3-the-light-of-release">Week 3: The Light of Release</h2>
<p>Last week’s work focused on the more complex enemies. I’ve had to revise or re-implement several enemies as later on in the game I started running into variations in behaviors I didn’t account for in my initial implementation.</p>
<p>In Week 3, I finished Mission 2 and was most of the way through Mission 3. In addition to implementation of all the complex enemies. Remaining enemies are easier as they are similar to already implemented enemies with variations here and there making them cost less to implement.</p>
<p>This is when I started seeing some light, that perhaps I could get it released the following week! (this week)</p>
State Management with Coroutines2022-04-03T12:55:00+00:00https://zenithsal.com/gamedev/2022/04/03/state-management-with-coroutines
<p>Say we’re working on a GTA-style game and we want to create a behavior sequence for a mission:</p>
<ul>
<li>Car (with an AI driver) spawns at location A and waits for the player to get in.</li>
<li>Car drives to location B.</li>
<li>Player gets out.</li>
<li>Car waits for player to get back in with item within 5 minutes.</li>
<li>Mission success!</li>
</ul>
<h2 id="manual-state-management">Manual State Management</h2>
<p>The problem with straight-forward gameplay programming is it’s made of an <code class="language-plaintext highlighter-rouge">Update()</code> function that gets called ±60 times a second.</p>
<p>This means we must manage time between events manually.</p>
<p>It also means we must store necessary states and update them organically. If we have many overlapping inter-dependent states we may end up with unpredictable hard-to-debug gameplay issues.</p>
<p>Here’s some pseudo-code for the manual gameplay programming approach:</p>
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">player_first_got_in</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">player_first_got_out</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">player_second_got_in</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">at_location_b</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">wait_time</span> <span class="o">=</span> <span class="mi">5</span> <span class="o">*</span> <span class="mi">60</span>
<span class="n">waiting_for</span> <span class="o">=</span> <span class="mf">0.0</span>
<span class="k">def</span> <span class="nf">Update</span><span class="p">(</span><span class="n">delta</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">player_first_got_in</span><span class="p">:</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="n">player</span><span class="p">:</span>
<span class="n">player_first_got_in</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">elif</span> <span class="ow">not</span> <span class="n">player_second_got_in</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">at_location_b</span><span class="p">:</span>
<span class="n">distance</span> <span class="o">=</span> <span class="n">car</span><span class="p">.</span><span class="n">driver</span><span class="p">.</span><span class="n">drive_to</span><span class="p">(</span><span class="s">"location_b"</span><span class="p">))</span>
<span class="k">if</span> <span class="n">distance</span> <span class="o"><</span> <span class="mf">10.0</span> <span class="ow">and</span> <span class="n">car</span><span class="p">.</span><span class="n">driver</span><span class="p">.</span><span class="n">stopped</span><span class="p">():</span>
<span class="n">at_location_b</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">elif</span> <span class="ow">not</span> <span class="n">player_first_got_out</span><span class="p">:</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">player_first_got_out</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">elif</span> <span class="ow">not</span> <span class="n">player_second_got_in</span><span class="p">:</span>
<span class="n">waiting_for</span> <span class="o">+=</span> <span class="n">delta</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="n">player</span><span class="p">:</span>
<span class="n">player_second_got_in</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">elif</span> <span class="n">waiting_for</span> <span class="o">></span> <span class="n">wait_time</span><span class="p">:</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_failed"</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">player</span><span class="p">.</span><span class="n">has</span><span class="p">(</span><span class="s">"item"</span><span class="p">):</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_success"</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_failed"</span><span class="p">)</span>
</code></pre></div></div>
<p>This looks terrible. When the explanation of the task is 10 times easier to understand than the actual code that implements it, we are definitely not in sustainable territory.</p>
<p>And there is a bigger problem.. how do we deal with parallel gameplay complexities? say an event occurs that interrupts the supposedly straight forward mission that would interrupt our logic. Examples: the player gets out of the car BEFORE it gets to location B, the car is damaged too much and explodes, or the player destroys the package instead of picking it up.</p>
<p>There is no choice but to handle every single special scenario and to keep updating that everytime we have a new gameplay feature that could potentially complicate things.</p>
<p>Do not do this!</p>
<p>Once you catch yourself doing state management via endless if-else chains, switch it to a state machine.</p>
<h2 id="state-machines">State Machines</h2>
<p>They aren’t magic, but they provide us with much needed cleanliness and simplicity in addition to some nifty abilities like being able to go to any state at any time!</p>
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">enum</span> <span class="n">State</span> <span class="p">{</span>
<span class="n">BEGIN</span><span class="p">,</span>
<span class="n">DRIVE_TO_LOCATION_B</span><span class="p">,</span>
<span class="n">WAIT_FOR_PLAYER_ITEM</span><span class="p">,</span>
<span class="n">CONCLUDE</span>
<span class="p">}</span>
<span class="n">state</span> <span class="o">=</span> <span class="n">State</span><span class="p">.</span><span class="n">BEGIN</span>
<span class="n">at_location_b</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">wait_time</span> <span class="o">=</span> <span class="mi">5</span> <span class="o">*</span> <span class="mi">60</span>
<span class="n">waiting_for</span> <span class="o">=</span> <span class="mf">0.0</span>
<span class="k">def</span> <span class="nf">Update</span><span class="p">(</span><span class="n">delta</span><span class="p">):</span>
<span class="n">switch</span> <span class="n">state</span><span class="p">:</span>
<span class="n">case</span> <span class="n">State</span><span class="p">.</span><span class="n">BEGIN</span><span class="p">:</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="n">player</span><span class="p">:</span>
<span class="n">state</span> <span class="o">=</span> <span class="n">State</span><span class="p">.</span><span class="n">DRIVE_TO_LOCATION_B</span>
<span class="n">case</span> <span class="n">State</span><span class="p">.</span><span class="n">DRIVE_TO_LOCATION_B</span><span class="p">:</span>
<span class="n">distance</span> <span class="o">=</span> <span class="n">car</span><span class="p">.</span><span class="n">driver</span><span class="p">.</span><span class="n">drive_to</span><span class="p">(</span><span class="s">"location_b"</span><span class="p">)</span>
<span class="k">if</span> <span class="n">distance</span> <span class="o"><</span> <span class="mf">10.0</span> <span class="ow">and</span> <span class="n">car</span><span class="p">.</span><span class="n">driver</span><span class="p">.</span><span class="n">stopped</span><span class="p">():</span>
<span class="n">at_location_b</span> <span class="o">=</span> <span class="bp">True</span>
<span class="n">state</span> <span class="o">=</span> <span class="n">State</span><span class="p">.</span><span class="n">WAIT_FOR_PLAYER_ITEM</span>
<span class="n">case</span> <span class="n">State</span><span class="p">.</span><span class="n">WAIT_FOR_PLAYER_ITEM</span><span class="p">:</span>
<span class="n">waiting_for</span> <span class="o">+=</span> <span class="n">delta</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="n">player</span><span class="p">:</span>
<span class="n">state</span> <span class="o">=</span> <span class="n">State</span><span class="p">.</span><span class="n">CONCLUDE</span>
<span class="k">elif</span> <span class="n">waiting_for</span> <span class="o">></span> <span class="n">wait_time</span><span class="p">:</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_failed"</span><span class="p">)</span>
<span class="n">case</span> <span class="n">State</span><span class="p">.</span><span class="n">CONCLUDE</span><span class="p">:</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">alive</span><span class="p">()</span> <span class="ow">and</span> <span class="n">at_location_b</span> <span class="ow">and</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="n">player</span> <span class="ow">and</span> <span class="n">player</span><span class="p">.</span><span class="n">has</span><span class="p">(</span><span class="s">"item"</span><span class="p">):</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_success"</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_failed"</span><span class="p">)</span>
</code></pre></div></div>
<p>Notice that this state machine implementation is not shorter than the previous manual state management implementation, but it’s so much easier to understand and allows us to add a level of resilience through fallback states to handle exceptional interruptions.</p>
<p>We could actually do better than the state machine! A game like this has many missions that require a car to wait for a passenger or particular conditions related to car’s location or passenger inventory. It would be really annoying if we had to re-write that code in 100 different variations..</p>
<h2 id="job-systems">Job Systems</h2>
<p>We could instead create a sort of a job driven mission description. In such a system, missions are defined as lists of jobs. Each job is a self-contained gameplay activity that can be customized with parameters and reused as many times as we want.</p>
<p>If we had such a system in place.. how would our mission description look like? Well for starters we no longer need to manually track everything in Update!</p>
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">Start</span><span class="p">():</span>
<span class="n">Jobs</span><span class="p">.</span><span class="n">executePackage</span><span class="p">([</span>
<span class="n">Job</span><span class="p">(</span><span class="nb">type</span><span class="o">=</span><span class="n">WAIT_FOR_PLAYER</span><span class="p">),</span>
<span class="n">Job</span><span class="p">(</span><span class="nb">type</span><span class="o">=</span><span class="n">DRIVE_TO</span><span class="p">,</span> <span class="p">{</span><span class="n">location</span><span class="o">=</span><span class="s">"location_b"</span><span class="p">}),</span>
<span class="n">Job</span><span class="p">(</span><span class="nb">type</span><span class="o">=</span><span class="n">WAIT_FOR_PLAYER</span><span class="p">,</span> <span class="p">{</span><span class="n">time_limit</span><span class="o">=</span><span class="mi">5</span><span class="o">*</span><span class="mi">60</span><span class="p">}),</span>
<span class="n">JobSuccess</span><span class="p">(</span><span class="nb">type</span><span class="o">=</span><span class="n">IF_INVENTORY_HAS</span><span class="p">,</span> <span class="s">"item"</span><span class="p">),</span>
<span class="n">JobFailure</span><span class="p">()</span>
<span class="p">])</span>
</code></pre></div></div>
<p>With this approach we could magically eliminate the Update function! I mean in reality the Job system is doing that internally, but hey.. makes life easier.</p>
<p>Of course designing and developing a job system like this for a large game is not a trivial task and this example is too simplified to reflect what a real world implementation might look like. However, a game with 100s of missions like that would definitely benefit from this.</p>
<p>The job driven mission system is perfect for this particular case. It’s a great example of the perfect tool for the job. It also opens up some interesting capabilities. We now have a mission system that’s data-driven! this means we can define missions visually, from within the game, allows us to implement mod support, etc.</p>
<p>This implementation is suitable for an ECS driven-engine and is multi-threading friendly as well.</p>
<p>Speaking of multi-threading..</p>
<h2 id="coroutines-and-states">Coroutines and States</h2>
<p>I was first exposed to this approach with Unreal Engine 3. Its UnrealScript language has a <a href="https://docs.unrealengine.com/udk/Three/MasteringUnrealScriptStates.html#11.2%20STATES%20IN%20UNREAL%20ENGINE%203">built-in way to define a state machine per script</a>. What’s special about those state machines is that they run in parallel with that script’s conventional Update() function. This appears unimpressive at first glance, but practically? you could write your code in a way that forgoes many of the annoyances of manual frame-to-frame state management.</p>
<p>So the last approach which happens to be my current favorite, utilizes coroutines (or any similar feature). In this context coroutines are essentially functions that run concurrently with your <code class="language-plaintext highlighter-rouge">Update()</code> and normal event handling callbacks until completion:</p>
<ul>
<li>Each coroutine encapsulates a specific self-contained task.</li>
<li>Coroutines can be chained one after the other producing a sequence of events executing one after the other across time.</li>
<li>These coroutines continue until their completion or until the object containing them is freed.</li>
<li>This means we can actually have a <code class="language-plaintext highlighter-rouge">while true:</code> style infinite loop running a continuous sequence of events until the object is freed! think enemies that perform pattern attacks.</li>
</ul>
<p>How would our mission sequence look like with this approach? Due to the variation in implementations between different engines and languages, I’m gonna base my example here on how Godot implements coroutines:</p>
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">enum</span> <span class="n">State</span> <span class="p">{</span>
<span class="n">RUN</span><span class="p">,</span>
<span class="n">MISSION</span>
<span class="p">}</span>
<span class="n">state</span> <span class="o">=</span> <span class="n">State</span><span class="p">.</span><span class="n">RUN</span>
<span class="c1"># if the player takes longer than 10mins, mission fails
</span><span class="n">mission_time_limit</span> <span class="o">=</span> <span class="mi">10</span> <span class="o">*</span> <span class="mi">60</span>
<span class="k">def</span> <span class="nf">Update</span><span class="p">(</span><span class="n">delta</span><span class="p">):</span>
<span class="n">switch</span> <span class="n">state</span><span class="p">:</span>
<span class="n">case</span> <span class="n">State</span><span class="p">.</span><span class="n">RUN</span><span class="p">:</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="n">player</span><span class="p">:</span>
<span class="n">run_sequence</span><span class="p">()</span>
<span class="n">state</span> <span class="o">=</span> <span class="n">State</span><span class="p">.</span><span class="n">MISSION</span>
<span class="n">case</span> <span class="n">State</span><span class="p">.</span><span class="n">MISSION</span><span class="p">:</span>
<span class="c1"># Here we can handle any special interruptions we want to account for
</span> <span class="n">mission_time_limit</span> <span class="o">-=</span> <span class="n">delta</span>
<span class="k">if</span> <span class="n">mission_time_limit</span> <span class="o"><=</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_failed"</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">run_sequence</span><span class="p">():</span>
<span class="k">yield</span><span class="p">(</span><span class="n">Task</span><span class="p">.</span><span class="n">DriveTo</span><span class="p">(</span><span class="n">what</span><span class="o">=</span><span class="n">car</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s">"location_b"</span><span class="p">),</span> <span class="s">"task_complete"</span><span class="p">)</span>
<span class="k">yield</span><span class="p">(</span><span class="n">Task</span><span class="p">.</span><span class="n">WaitForPassenger</span><span class="p">(</span><span class="n">what</span><span class="o">=</span><span class="n">car</span><span class="p">,</span> <span class="n">who</span><span class="o">=</span><span class="n">player</span><span class="p">,</span> <span class="n">time_limit</span><span class="o">=</span><span class="mi">5</span><span class="o">*</span><span class="mi">60</span><span class="p">),</span> <span class="s">"task_complete"</span><span class="p">)</span>
<span class="k">if</span> <span class="n">car</span><span class="p">.</span><span class="n">passenger</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">player</span><span class="p">.</span><span class="n">has</span><span class="p">(</span><span class="s">"item"</span><span class="p">):</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_failed"</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">announce</span><span class="p">(</span><span class="s">"mission_success"</span><span class="p">)</span>
</code></pre></div></div>
<p>Note that:</p>
<ul>
<li>We don’t really need a state machine here but I included it to illustrate how it can work together with coroutines.</li>
<li>We assume the announce function kills the mission object interrupting any ongoing coroutines.</li>
</ul>
<p>This might be the best general approach for state management. It produces clean compact readable code and costs almost no time/effort to implement the runtime for. If your language of choice has some form of coroutines, you’re good to go!</p>
<p>I’m interested to see how this coroutines approach would look like in Unity? also C++20? or anything else you use, <a href="https://twitter.com/zenithsal">tweet</a>/comment me an implementation :)</p>
We are not alone maybe #12021-05-04T00:00:00+00:00https://zenithsal.com/futurism/2021/05/04/we-are-not-alone-maybe-1
<p>I’ve always claimed that I have proof the universe is full of intelligent life (according to our definition of intelligence), and it’s simply that we ARE the perfect example of intelligent life in our universe as there is literally nothing about our existential circumstances that’s special or unique and most of our planet’s complex life evolved within the last 600 million years. Now look at all we know about the universe from its largest parts (galaxies?) to the smallest (quantum particles?), there is not one thing in our universe that’s one of itself. Everything has billions, trillions, and beyond, of itself; even at the scale of a single galaxy.</p>
<p>Our recent technological awakening is laughably small compared to the age of this solar system or life on this planet; or even how long homosapiens have been around. Electricty was discovered in the 1800 as well as radio waves and first combustion engine invention. Took about a hundred years or so to get to the first airplane. Then about 70 to send humans to the moon, and 15 years after, the internet. We are on a crazy accelerating ride towards a completely unkown reality and at any given point we have no concept or notion of what possibilities lie beyond the next major civilization disrupter until after the thing actually happens!</p>
<p>Imagine attempting to explain to a normal person in 1900 that someone will create a machine that allow men to fly in the sky 3 years from today, you’d be laughed at or called insane. We are so shit at predicting how our reality is going to change next, it’s a genuine miracle we made it this far.</p>
<p>Our tiny technological awakening means that 100% (or pretty damn close) of all intelligent life in our galaxy has been around significantly longer. Imagine another intelligence that had a tiny technological headstart on us, could we ever be capable of comprehending something that will be invented after 5000 years of exponential technological advancement from where we are now? that’s impossible.</p>
<p>Some great scifi writers were able to somehow navigate beyond the limits of our imagination and explore what may lie on the highway to wherever all of this is going, one of the best examples of this I’ve ever read is a short story by Isaac Asimov called “<a href="https://imgur.com/gallery/9KWrH">The Last Question</a>”. In it Asimov imagines how the very nature of humans will change across vast amounts of technological time co-evolving and eventually superseded by a thing that suspiciously resembles where Google is going for.</p>
<h2 id="but-what-about-the-fermi-paradox">But what about the Fermi paradox?</h2>
<p>That thing is not a law of physics or even a theory, it’s simply a philosophical question making many assumptions that could be completely wrong. In other words, it’s nothing more than a question without a clear answer and doesn’t really prove or disprove anything.</p>
<p>The biggest problem I have with the Fermi paradox is its assumption that what we know at this very moment about our reality, physics, and the universe.. are most of everything there is to know. That has already been proven false in so many ways. For example there is an assumption that radio waves are how all other intelligent civilizations communicate simply because that’s how we do it? Well, I’m connected to the internet via a focused light-beam travelling through an optical fiber cable.. no radio waves involved and it’s impossible to detect from outside the system. How about quantum particles? gravitational waves? whatever the heck is that weird energy pushing the universe to expand? or many other things we haven’t discovered or know anything about yet.. any of them could be used for communication somehow.</p>
<p>So I say.. the Fermi paradox is no longer valid.</p>
<h2 id="uaps">UAPs?</h2>
<p>UAPs (Unidentified Aerial Phenomenon) are what the US government calls what previously was known as UFOs. They changed the name because UFO became synonymous with crazy people trying so hard to make space ships and little green aliens a reality because they believe it almost on a religious level without following a valid process to prove or disprove. And also because a lot of the alleged sightings are not even an object but a weather phenomenon of some sort or a reflection of something.</p>
<h2 id="ouch-my-conspiracy-theory">Ouch my conspiracy theory</h2>
<p>One of the most wide spread and oldest conspiracy theories is that the american government are hiding that they are in posession of alien technology and/or they are in contact with some aliens on some level. You must have heard of area 51, roswell, alien abductions, or the endless stream of holywood movies portraying the government covering up alien involvement in things.</p>
<p>I was watching a <a href="www.youtube.com/watch?v=g89Zzz8a4E8&list=PLob1mZcVWOaiRpBuQDWKzNuBKBjNjajsT">series of short videos that investigate</a> and interview military personale involved in the recent government released UAP videos and I realized there is indeed a conspiracy, but it isn’t that someone has some secret information.. rather that the US government wants to pretend none of this is happening because executive military/government people who like ambition ladders consider any “aliens” like talk to be a threat to their ladder-climbing so they look the other way when it comes up and bury it in any way they can when no one is looking. There is a lot of stigma about it and it’s not just in the military but in society at large. This stigma was behind how long it took for this phenomenon to be confirmed.</p>
<h2 id="what-happened">What happened?</h2>
<p>A bunch of videos of these UAPs that were leaked previously were confirmed and re-released by the Pentagon, in essence proving that a portion of that UFO nonsense may actually have been real all along. What’s even more is that some military people who were present and involved in these recorded incidents stepped forward and talked about their experience and all they know and they all repeated the same thing: the government doesn’t care about this even when it’s evaluated as a potential risk to equipment or life.</p>
<p>The same reluctance and stigma are echoed by the majority of the science community. They have been constantly pushing anything related to possible intelligent life or looking for signs of extraterrestrial technology under the rug. This is going as far as blocking funding to research or projects that openly mention anything that can be connected directly or indirectly to “aliens”.</p>
<p>Here’s a podcast by Lex interviewing David Fravor who literally attempted to engage one of these things in an F/A-18 IRL:</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/aB8zcAttP1E" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<h2 id="so-now-we-believe-in-ufosuaps">So now we believe in UFOs/UAPs?</h2>
<p>Only that these things are impossible to identify and appear to be technological in nature and purposeful. If you saw those confirmed videos and heard what the eye witnesses involved said, these things whatever they are do not come from space but actually seem to hangout in and around our own oceans!</p>
<p>I was considering what this means. What they could be and how to find a way to logically think about this whole thing. And I felt I want to share my perspective.</p>
<p>But this post is long enough already. I want to write a lot about this as the non-sensical nature of these things intrigue me lol.. so in the next part I’ll examine some fun theories as to what these things could be in my very-madeup opinion.</p>
TIC-80 Cheatsheet2020-08-02T00:00:00+00:00https://zenithsal.com/gamedev/2020/08/02/tic-80-cheatsheet
<p>This a self-contained cheatsheet I created for TIC-80:</p>
<p><a href="https://zenithsal.com/assets/documents/tic-80_cheatsheet.pdf">Here’s the PDF</a></p>
<p>And a hi-quality PNG:</p>
<p><img src="https://zenithsal.com/assets/documents/tic-80_cheatsheet.png" alt="tic80refpng" /></p>
Resurrection and Game Off2019-11-06T00:00:00+00:00https://zenithsal.com/gamedev/2019/11/06/resurrection
<p>I resurrected a bunch of old projects done for either fun or while job hunting:</p>
<ul>
<li><a href="http://zenithsal.com/other/my-phaser-playground/Project1/mrwhite.html">Mr. White</a></li>
</ul>
<p>This is a demo made to breath life into a mockup screenshot I found online. Don’t remember where I got the mockup from but I like the vibe :)</p>
<p>Demo is written using javascript/PhaserJS directly on the <a href="https://aws.amazon.com/cloud9/?origin=c9io">sadly-ruined-to-milk-for-money-by-amazon website Cloud9</a>. I find it infuriating that rather than supporting the c9 platform and the growing community that used it for small projects, Amazon ate the service and now only allow using it through their hyper-complex-absurdly-massive AWS mess of enterprise stuff.</p>
<ul>
<li><a href="http://zenithsal.com/other/shapeverse2/">Shapeverse</a></li>
</ul>
<p>This is a simple shapes application written in Typescript/Angular. It lets you: create/delete shapes, select and transform existing shapes, and saves everything by default so if you refresh the page it should restore your scene.</p>
<ul>
<li><a href="http://zenithsal.com/other/smb1">SMB1</a></li>
</ul>
<p>This is a demo to try to imitate Super Mario Bros character controls as close as possible. Written using Typescript/PhaserJS in Cloud9 (when it was usable). I didn’t intend for it to be a full game.</p>
<h2 id="remastering-zamron">Remastering Zamron</h2>
<p>Through October, myself and my brother worked to remaster an old game of mine, Zamron Encounter. We had two goals:</p>
<ol>
<li>Porting game graphics to use hardware accelerated Stage3D in Flash. The game used Flash/AS3 software rendering for graphics which is awfuly slow and buggy.</li>
<li>My brother wanted to re-make game art for fun and so far he did a great job!</li>
</ol>
<p>Technically the re-master is 95% done, there are two bugs left to resolve (albeit tricky ones) and we can re-release a much better version of Zamron.</p>
<p>Artistically, my brother finished level art and a bunch of other stuff. Still working on monsters and player textures.</p>
<p>There is a larger goal to eventually start a new project to remake Zamron from the ground up using a modern engine into a full product. The re-mastering effort serves two purposes: having a usable prototype to base the remake on, and developing a work pipeline between us two.</p>
<p>Will talk more about Zamron’s remaster progress in the future.</p>
<p>Here’s a sneak peek for what we currently have:</p>
<video width="720" height="480" autoplay="">
<source src="https://zenithsal.com/assets/videos/zamron_sneakpeek.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<h2 id="currently-working-on-game-off-2019">Currently working on: Game Off 2019</h2>
<p><a href="https://itch.io/jam/game-off-2019">Game Off 2019</a> is a relaxed 30 days game jam that just started a few days ago that me and my brother are participating in. The theme for this one is: <strong>Leaps and Bounds</strong>. So far we have a few concepts in progress and I hope by next week we’ll be able to show some progress.</p>
Benchmarking using simplebench script2019-10-03T00:00:00+00:00https://zenithsal.com/benchmarking/2019/10/03/simplebench
<p>A while ago I used a simple benchmark to very roughly compare performance on multiple platforms: <a href="http://zenithsal.com/pc-6002/2018/04/30/pc-6002-vs-80s-computers-benchmark">PC-6002 vs 80s Computers Benchmark</a> and got some interesting results.</p>
<p>Recently I got a Raspberry Pi 4 and wanted to figure out how its new CPU compare to other platforms so I went back to that simple benchmark I used, scaled it up by 1000x and used it in many different ways on many different devices and platforms. I think the results are noteworthy :) but it’s still just for fun, this is by no means a benchmark that should be taken seriously.</p>
<p>The simple bench I used looks like this:</p>
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">math</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="n">all_primes</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">t1</span><span class="o">=</span><span class="n">time</span><span class="p">.</span><span class="n">time</span><span class="p">()</span>
<span class="n">skip</span><span class="o">=</span><span class="bp">False</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">100000</span><span class="p">):</span>
<span class="n">skip</span><span class="o">=</span><span class="bp">False</span>
<span class="n">k</span> <span class="o">=</span> <span class="n">math</span><span class="p">.</span><span class="n">floor</span><span class="p">(</span><span class="n">math</span><span class="p">.</span><span class="n">sqrt</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">i</span><span class="p">)))</span> <span class="o">+</span> <span class="mf">1.0</span>
<span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="nb">int</span><span class="p">(</span><span class="n">k</span><span class="p">)):</span>
<span class="n">k1</span><span class="o">=</span><span class="n">i</span><span class="o">/</span><span class="nb">float</span><span class="p">(</span><span class="n">j</span><span class="p">)</span>
<span class="n">k2</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">k1</span><span class="p">)</span>
<span class="k">if</span> <span class="n">k1</span><span class="o">==</span><span class="n">k2</span><span class="p">:</span>
<span class="n">skip</span><span class="o">=</span><span class="bp">True</span>
<span class="k">break</span>
<span class="k">if</span> <span class="n">skip</span><span class="p">:</span>
<span class="k">continue</span>
<span class="n">all_primes</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
<span class="n">elapsed</span><span class="o">=</span><span class="p">(</span><span class="n">time</span><span class="p">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="n">t1</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"Prime count = "</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">all_primes</span><span class="p">)))</span>
<span class="k">print</span><span class="p">(</span><span class="s">"Python Time="</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">elapsed</span><span class="p">))</span>
</code></pre></div></div>
<p>Rewritten to: C++, C#, Lua, Javascript, and GDScript</p>
<p>Here are the systems I ran simplebench on:</p>
<ul>
<li>Raspberry Pi 4: Cortex A72 1.5GHz, Raspbian</li>
<li>Raspberry Pi 3: Cortex A53 1.2GHz, Raspbian</li>
<li>Raspberry Pi Zero W: ARMv6 1GHz, Raspbian</li>
<li>Desktop PC: AMD Ryzen 5 1600 3.2GHz, Windows 10</li>
<li>Desktop PC: AMD Ryzen 7 3700X 3.6GHz, Windows 10</li>
<li>Mini PC: Intel Pentium 4415U 2.3GHz, Kubuntu 18.04</li>
<li>Laptop: Intel Core i5-4258U 2.4GHz, Kubuntu 18.04</li>
<li>Laptop: Intel Core i7-8550U 1.8GHz, Kubuntu 18.04</li>
<li>Laptop: Intel Pentium 4415Y 1.6GHz, Windows 10</li>
<li>Laptop: AMD E-450 1.6GHz, Debian</li>
<li>Mobile: Snapdragon 855 2.84GHz+1.78GHz, Android 9</li>
<li>ShieldTV: nVIDIA Tegra X1 2GHz, Android 8</li>
</ul>
<p>Here are the runtimes I used to run the benchmarks on:</p>
<ul>
<li>GCC 7+ (alternatively clang) with -std=c++14 and -O3 flags</li>
<li>Mono</li>
<li>Lua 5.1+ and luajit</li>
<li>NodeJS 8</li>
<li>Godot 3.1</li>
<li>Python 2.7</li>
<li>PyPy</li>
<li>termux for Android devices</li>
</ul>
<p>I wanted to put minimal time into this so I didn’t try to run everything on every platforms, just what’s easily doable.</p>
<p>For each measured time, I ran the simplebench script/binary more than 10 times and took the shortest achieved time:</p>
<table>
<thead>
<tr>
<th>Platform</th>
<th>Lua</th>
<th>Python27</th>
<th>PyPy</th>
<th>NodeJS</th>
<th>GCC/C++</th>
<th>Mono/C#</th>
<th>Luajit</th>
<th>Godot/GD</th>
<th>RustC</th>
</tr>
</thead>
<tbody>
<tr>
<td>RaspberryPi4/Cortex A72 1.6GHz</td>
<td>0.61s</td>
<td>4.3s</td>
<td>0.14s</td>
<td>0.061s</td>
<td>0.045s</td>
<td>0.136s</td>
<td>0.087s</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>RaspberryPi3/Cortex A53 1.4GHz</td>
<td>1.191s</td>
<td>10.22s</td>
<td>0.34s</td>
<td>0.157s</td>
<td>0.092s</td>
<td>0.49s</td>
<td>0.163s</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>RaspberryPiZeroW/ARMv6 1GHz</td>
<td>5.32s</td>
<td>60.62s</td>
<td>1.78s</td>
<td>0.682s</td>
<td>0.29s</td>
<td>2.091s</td>
<td>1.004s</td>
<td> </td>
<td>0.25s</td>
</tr>
<tr>
<td>Laptop/Core i5 4258U 2.4GHz</td>
<td>0.22s</td>
<td>1.2s</td>
<td>0.041s</td>
<td>0.018s</td>
<td>0.015s</td>
<td>0.045s</td>
<td>0.025s</td>
<td>0.637s</td>
<td> </td>
</tr>
<tr>
<td>Laptop/AMD E-450 1.65GHz</td>
<td>1.17s</td>
<td>7.2s</td>
<td>0.210s</td>
<td>0.110s</td>
<td>0.079s</td>
<td>0.233s</td>
<td>0.152s</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Mobile/Snapdragon 855 2.84GHz</td>
<td>0.36s</td>
<td>1.68s</td>
<td> </td>
<td>0.013s</td>
<td>0.020s</td>
<td> </td>
<td> </td>
<td>0.758s</td>
<td> </td>
</tr>
<tr>
<td>Laptop/Core i7 8550U 1.8GHz</td>
<td>0.18s</td>
<td>1.0s</td>
<td>0.037s</td>
<td>0.012s</td>
<td>0.011s</td>
<td>0.053s</td>
<td>0.018s</td>
<td> </td>
<td>0.004s</td>
</tr>
<tr>
<td>Laptop/Pentium 4415Y 1.6GHz</td>
<td>0.46s</td>
<td>3.65s</td>
<td>0.094s</td>
<td>0.020s</td>
<td>0.030s</td>
<td> </td>
<td> </td>
<td>1.411s</td>
<td> </td>
</tr>
<tr>
<td>Desktop/AMD Ryzen 5 1600 3.2GHz</td>
<td>0.22s</td>
<td>1.38s</td>
<td>0.031s</td>
<td>0.008s</td>
<td>0.011s</td>
<td> </td>
<td>0.011s</td>
<td>0.725s</td>
<td> </td>
</tr>
<tr>
<td>Desktop/AMD Ryzen 7 3700X 3.6GHz</td>
<td>0.156s</td>
<td>1.26s</td>
<td>0.026s</td>
<td>0.007s</td>
<td>0.008s</td>
<td>0.014s</td>
<td> </td>
<td>0.496s</td>
<td> </td>
</tr>
<tr>
<td>ShieldTV/Cortex A57 2.01GHz</td>
<td>0.745s</td>
<td>4.73s</td>
<td> </td>
<td>0.049s</td>
<td>0.012s</td>
<td> </td>
<td>0.056s</td>
<td>1.496s</td>
<td>0.012s</td>
</tr>
<tr>
<td>Laptop/Atom x5-z8350 1.44GHz</td>
<td>0.998s</td>
<td>8.78s</td>
<td>0.433s</td>
<td>0.095s</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Mini/Intel Pentium 4415U 2.3GHz</td>
<td>0.269s</td>
<td>1.52s</td>
<td>0.043s</td>
<td>0.014s</td>
<td>0.014s</td>
<td>0.063s</td>
<td>0.016s</td>
<td> </td>
<td>0.007s</td>
</tr>
</tbody>
</table>
<h2 id="conclusions">Conclusions:</h2>
<h4 id="snapdragon-855">Snapdragon 855</h4>
<p>Mobile phone processors are catching up to laptop processors very quickly. I’ve read that Snapdragon 855 is similar in performance to a current gen core i3, and these results confirm that. It’s especially impressive that Snapdragon 855 is almost exactly matching a desktop PC Ryzen 5 1600 in Godot/GDScript and very close in Lua and Python.</p>
<h4 id="python">Python</h4>
<p>CPython is so incredibly slower than everything else which comes as a no surprise, some of my old CPython/PyGame games struggled to hit 60 fps on laptop processors at the time without some sort of just-in-time compilation thrown in (back then I used <a href="http://psyco.sourceforge.net/">Psyco</a>)</p>
<p>Pypy runtime (which is a decendent of psyco, full jit compilation) is impressively quick in comparison to CPython, it almost matches mono actually, it’s a surprise pypy hasn’t become the dominant python runtime yet! I think it ought to be.</p>
<h4 id="lua-and-luajit">Lua and LuaJIT</h4>
<p>As expected, lua is very fast for a fully interpreted language. I wish CPython was closer to that.</p>
<p>LuaJIT is damn impressive. Actually really close to native C++ performance! Which is insane.</p>
<h4 id="javascript">Javascript</h4>
<p>The anomaly here is NodeJS which uses the excellently optimized <a href="https://v8.dev/">Google V8 engine</a>. Not only did it match but actually surpass native C++ performance on several platforms. I have no explanation other than blaming it on timer precision? but I’m not surprised its performance is that good as it not only runs 100% of the web, but a growing list of desktop/mobile applications like this very editor I’m using to write these words now.</p>
<p>It’s worth noting that the startup time when running <code class="language-plaintext highlighter-rouge">node simplebench.js</code> is almost as slow as compiling the C++ version. This indicates some hardcore jit compilation taking place before actual execution of the script starts.</p>
<h4 id="godotgdscript">Godot/GDScript</h4>
<p>Godot’s GDScript is not as bad as I thought it’ll be, about 2x CPython. Alone it would make Godot a terrible solution for bigger games, but luckily Godot allows C++ modules to be used for critical bits and Mono/C# support is almost ready for prime time. I’m hoping at some point in the future they decide to reimplement GDScript to compile to Mono in the future.</p>
Tetris using TIC-80 on Shield TV2019-08-04T00:00:00+00:00https://zenithsal.com/gamedev/2019/08/04/tetris-on-shield-tv
<p>Weather not being so nice through this weekend with an upcoming quick 2 weeks vacation where it’s summertime, I thought I’ll do a fun indoors thing on Saturday.</p>
<p>A while ago I set up <a href="https://tic80.com/">TIC-80</a> on NVIDIA Shield TV and hooked up a bluetooth keyboard and mouse, the idea is to do some light gamedev directly on the TV while chilling on the couch. It’ll be like the most relaxed form of development possible :)</p>
<p>I thought I’ll try something very simple, a minimal tetris written as straight forward as possible was what I went with. I enjoyed it thoroughly and how easy and fast developing it on lua was. It only took me a few hours to finish covering all features I wanted. I think this might be the fastest game I’ve ever finished to date!</p>
<p><a href="https://tic80.com/play?cart=912">Play TVTetris here</a></p>
<p><img src="https://zenithsal.com/assets/gifs/tvtetris.gif" alt="tvtetris" /></p>
Amiga A500: A520 S-Video Mod2018-06-01T00:00:00+00:00https://zenithsal.com/amiga/2018/06/01/amiga-a500-a520-s--video-mod
<p>When I bought my <a href="https://twitter.com/zenithsal/status/735033118126538753">Amiga A500</a> from <a href="https://www.trademe.co.nz/">TradeMe</a> it came with a compatible monitor which had some old-monitor problems related to picture quality. I expected that as CRT monitors do tend to deteriote in quality over the years and also tend to die suddenly.</p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/my_amiga_a500.jpg" alt="my_amiga_a500" title="Day 1 Amiga A500" /></p>
<p>I was not proven wrong as the monitor did die a few weeks later with a click and a whine.</p>
<p>The Amiga A500 has a video-out port but puzzlingly it outputs in greyscale only.</p>
<p>I searched for how to connect the Amiga to a modern monitor using either RGB or HDMI and found that the only indirect way to do it is using an ugly commodore Amiga adapter device called A520 which provides an RCA video-out signal in color as well as RF out.</p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/a520.jpg" alt="a520" title="Commodore A520" /></p>
<p>Someone was selling a pair of these on ebay so I got them, they both worked but one of them seemed to need some maintenance as it required a bit of fiddling around when plugged in to output in color. Sometimes it insists on only outputing blurry greyscale.</p>
<p>I ran the output to an LCD TV using RCA video and audio out, both produced awful blurry quality picture that made it very difficult to read any text. Since then the Amiga was all but unusable.</p>
<h1 id="modifying-a520-to-output-s-video">Modifying A520 to output S-Video</h1>
<p>I had to decide what to do with the Amiga (either sell it or find a way to get good quality output making it usable again), when doing a quick search I found this <a href="http://members.iinet.net.au/~davem2/overclock/A520.html">great step-by-step guide</a> for converting the A520 to output S-Video signal which should make it usable again.</p>
<p>I decided to try it. Ordered all the electronics components needed 2 weeks ago and when they arrived setup a work area and spent a day going through all the steps. After many hours and 3 solder-iron burns I got it done. I just needed to test it.</p>
<h1 id="s-video-to-rca-video-out">S-Video to RCA Video Out</h1>
<p>S-Video output means I get two signals out of the modified A520 one called Chroma (letter C) and one called Luma (letter Y for some reason). It wasn’t clear in the guide how to convert that to a single RCA video-out signal, there are commercial S-Video to RCA converters but I felt since I went this far might as well try adding the conversion to the circuit.</p>
<p>Upon googling, I was surprised that this conversion requires a single component and it’s extremely easy to do! Just a single capacitor 470 pF across the Chroma and Luma outputs.</p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/svideo_to_rca.gif" alt="svideo_to_rca" /></p>
<p>Did a quick breadboard test and voila! It got video out to display on TV:</p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/svideo_testing.jpg" alt="svideo_testing" title="Testing conversion of S-Video to RCA video" /></p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/svideo_testing2.jpg" alt="svideo_testing2" title="Looking Good! Time to wrap up" /></p>
<p>The difference was very clear even through my phone’s camera:</p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/svideo_before_after_comparison.jpg" alt="svideo_before_after" title="Comparing video output from original A520 and modified A520" /></p>
<p>Adding that capacitor to the output then rewiring and reseating the board, and we have a modified A520 ready for use:</p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/modified_a520_ready.jpg" alt="a520_ready" title="Finished A520" /></p>
<p>I left it running for several hours to make sure everything is working as it should</p>
<p><img src="https://zenithsal.com/assets/photos/amiga500/svideo_done.jpg" alt="svideo_ready" title="S-Video A520 ready!" /></p>
PC-6002 Sprites Library: SPRITESR2018-05-31T00:00:00+00:00https://zenithsal.com/pc-6002/2018/05/31/pc--6002-spritesr
<p><a href="https://github.com/Salwan/pc6002/tree/master/SPRITESR" title="PC-6002 Git Repo: SPRITESR">SPRITESR</a> is a work-in-progress sprite library to automate drawing and animating sprites. SPRITESR is written to work specifically with N66 SR Mode 6 Screen 2 (Warka PC-6002, NEC PC6001 Mk2 SR, NEC PC-6601 SR, and NEC Mr PC).</p>
<p><a href="https://zenithsal.com/assets/pc6002/picard.d88" title="SPRITESR demo disk for N66 SR emulator">SPRITESR Demo: disk for N66 SR emulator</a></p>
<video width="640" height="480" autoplay="" loop="">
<source src="https://zenithsal.com/assets/videos/spritesr_1.webm" type="video/webm" />
Your browser does not support the video tag or webm videos.
</video>
<p>To run the demo in the emulator, insert <a href="https://zenithsal.com/assets/pc6002/picard.d88" title="SPRITESR demo disk for N66 SR emulator">floppy disk image</a>, go to mode 6 then type:</p>
<div class="language-vb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">bload</span><span class="s">"picard"</span><span class="p">,</span><span class="n">r</span>
</code></pre></div></div>
<p><a href="https://github.com/Salwan/pc6002/tree/master/SPRITESR" title="PC-6002 Git Repo: SPRITESR">SPRITESR Git Repository Here.</a></p>
<h2 id="features">Features</h2>
<p>SPRITESR provides 8 sprite slots that auto-redraw on VSYNC at half rate (30 fps).</p>
<p>Sprites coordinates can be dynamically updated and actual bitmap data can be changed to allow multi-frame animations.</p>
<p>SPRITESR works best for 8x8 pixels sprites but there is no hard limit, it can draw any size of sprite defined with two conditions: height must be divisible by 2, and width must be divisible by 4.</p>
<p>However for larger than 8x8 sprites flicker may occur.</p>
<p>SPRITESR allows specifying which sprites were changed this frame by calling the procedure SPRITESR_SETREDRAW. It will only fully redraw changed sprites and skip clearing unchanged sprites (useful for minimizing flicker slightly).</p>
<h2 id="modules">Modules</h2>
<p>The library is currently made up of the following modules:</p>
<ul>
<li>n66sr_bios.asm: definitions for a number of N66 SR BIOS calls (addresses) and useful system constants.</li>
<li>vsync.asm: vsync user event setup utility.</li>
<li>fastclear.asm: fast screen 2 clearing procedures covering all 3 areas of VRAM.</li>
<li>spritesr.asm: fast sprite drawing in direct VRAM accessible rectangle in screen 2 which starts at 0, 12 and has width/height of 256x188. PNG60 was updated with new functionality to support exporting p6bmp binaries directly usable by SPRITESR.</li>
</ul>
<p>The demo is made up of the following modules:</p>
<ul>
<li>picard.asm: actual demo code setting up all sprites, reading input, and updating sprites accordingly.</li>
<li>sprites.asm: definitions for a number of test sprites with different sizes.</li>
</ul>
<h2 id="implementation-details">Implementation Details</h2>
<p>SPRITESR is currently written entirely in z80 assembly and doesn’t make use of COMPILE60 tool yet.</p>
<p>I went through multiple attempts to implement fast sprites, for the life of me I still can’t figure out what’s wrong with VRAM in SR screen 2.. for some reason writing directly to rectangular area 0,0 to 255,11 or 256,0 to 320,200 just produces garbage despite the memory map clearly being marked for those areas in all information I found.</p>
<p>The VRAM layout is also odd. Each 2 horizontal pixels are directly equal to 1 byte but these pairs of pixels are arranged in 8 pixel blocks (4 bytes of memory) representing 4x2 pixels on screen:</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/vram_pixelblock_layout.gif" alt="vram_pixelblock_layout" title="VRAM Pixel Blocks Layout" /></p>
<p>When drawing sprites, rather than doing it pixel by pixel it’s done by block where every 4x2 pixels make 1 block which means width and height of sprites must be divisible by 4x2.</p>
<p>This produces very fast drawing approaching hardware sprites performance although things get costly quickly the larger the sprites get. As a consequence of drawing blocks of pixels the animation must be done in steps of 2 pixels for both horizontal and vertical movement.</p>
<p>For the garbage areas at the top and right there are two ways to write pixels correctly:</p>
<ol>
<li>Output Y coordinate to 2 special ports: 0xce (low) and 0xcf (high) and read/write pixels from/to X coordinate 0 to 320 mapped directly to address 0x0000.</li>
<li>View screen 1 (text screen) and set screen 2 as work area. When writing data directly to screen 2 vram in this case it works flawlessly but you can’t see screen 2 in the meantime so this isn’t useful.</li>
</ol>
<p>First method always works perfectly but is noticeably slower as 2 bytes need to be output for every horizontal line.</p>
<h2 id="introducing-vsync">Introducing VSYNC</h2>
<p>The missing piece in the puzzle was how exactly to eliminate or at least minimize flicker?</p>
<p>In N66 mode you get multiple pages and the ability to set which page is viewed instantly and also set which page to work on and video memory will update accordingly.</p>
<p>This allowed a straight forward double buffering drawing technique, no need to interrupt on VSYNC and time drawing correctly.</p>
<p>In N66 SR you only get a single graphics page, so double buffering is no longer possible.</p>
<p>While searching for information about the platform online I ran across <a href="http://www.tiny-yarou.com/">TinyYarou’s blog</a> where he writes about his projects for the P6 platform, in one particular blog post he demonstrates a project he did in N66 SR BASIC and briefly mentions something about VSYNC interrupt usage.</p>
<p>I could not find any information I could use about what’s that interrupt’s address, nor how to set it up and use it. I sent him a message through <a href="https://twitter.com/tiny_yarou">twitter</a> and he replied with a perfect assembly code snippet showing exactly what I’m looking for!</p>
<p>I immediately put together a demo and it worked! no more flicker or at least a lot less compared to just directly redrawing sprites.</p>
<p>This became the basis for SPRITESR’s current sprite drawing and animating method. vsync.asm module is mostly based on that code snippet.</p>
<ul>
<li>sprite movement without VRTC:</li>
</ul>
<p><img src="https://zenithsal.com/assets/photos/pc6002/picard_firstlook.gif" alt="picard_no_vrtc" /></p>
<ul>
<li>sprite movement with VRTC:</li>
</ul>
<p><img src="https://zenithsal.com/assets/photos/pc6002/picard_vsync_working.gif" alt="picard_vrtc" /></p>
<h2 id="limitations">Limitations:</h2>
<ul>
<li>Due to how VRAM in SR screen 2 work, sprites are limited to rectangular area starting at 0, 12 with width/height = 256x188.</li>
<li>Sprites are cleared using background color specified, meaning the background must be a solid color.</li>
<li>Sprite overlap is problematic as background clearing will overwrite sprite pixels below.</li>
<li>No transparency is supported.</li>
<li>Sprite movement horizontally and vertically can only be 2 pixels at a time due to the VRAM layout.</li>
</ul>
<h2 id="planned-features">Planned Features</h2>
<ul>
<li>Allow supporting simple dithered background clear colors.</li>
<li>Attempt implementing some sort of transparency with minimal performance impact.</li>
<li>Implement simple overlap detection between user-marked sprites.</li>
<li>Simple tile map support, each tile is 16x16 pixels and may be used for clearing sprite backgrounds if performance impact was acceptable.</li>
<li>Tile map scrolling support using the ROLL hardware scroller available in SR, single direction only horizontal or vertical.</li>
</ul>
<h2 id="procedures-list">Procedures List</h2>
<h3 id="vsync-module-vsyncasm">VSYNC Module (vsync.asm)</h3>
<ul>
<li>SETVSYNCEVENT: start vsync event</li>
<li>ENDVSYNCEVENT: end vsync event</li>
</ul>
<p>VSYNC event automatically calls event: VSYNCEVENT (implemented in SPRITESR)</p>
<h3 id="fastclear-module-fastclearasm">FASTCLEAR Module (fastclear.asm)</h3>
<ul>
<li>CLEARSCREEN2: slow clears all screen 2.
<ul>
<li>Set clear color: register C (0x0 to 0xf)</li>
</ul>
</li>
<li>FASTCLEARSCREEN2: fast clears sprite rectangle in screen 2 @ 0, 12 (256x188).
<ul>
<li>Set clear color: register C (two 16 colors 0x00 to 0xff)</li>
</ul>
</li>
<li>CLEARSCREEN2TOP: slow clears screen 2 top area.
<ul>
<li>Set clear color: register C (0x0 to 0xf).</li>
</ul>
</li>
<li>CLEARSCREEN2RIGHT: slow clears right area of screen 2.
<ul>
<li>Set clear color: register C (0x0 to 0xf)</li>
</ul>
</li>
<li>FASTCLEAR: fast fill memory using given value.
<ul>
<li>Start address: HL</li>
<li>Size high byte: D</li>
<li>Size low byte: B</li>
<li>Clear value: C</li>
</ul>
</li>
</ul>
<h3 id="spritesr-module-spritesrasm">SPRITESR Module (spritesr.asm)</h3>
<ul>
<li>Sprites data init and update: SPRITESR_DATA0 to SPRITESR_DATA7</li>
<li>SPRITESR_SETREDRAW: mark sprite updated and should be redrawn this frame.
<ul>
<li>Use sprite index: register A (0 to 7)</li>
</ul>
</li>
<li>SPRITESR_REDRAWALL: mark all sprites updated (full redraw) this frame.</li>
<li>FASTDRAWSPRITE: draw a sprite exported by PNG60 for mode 6 (-6 -f flags).
<ul>
<li>Sprite data address: HL</li>
<li>X coordinate: C</li>
<li>Y coordinate: B</li>
</ul>
</li>
<li>FASTCLEARSPRITE: clear sprite are using given color.
<ul>
<li>Sprite data address: HL</li>
<li>X coordinate: C</li>
<li>Y coordinate: B</li>
<li>Clear color (two pixel colors 0x00 to 0xff): A</li>
</ul>
</li>
</ul>
<h2 id="next-objective">Next Objective</h2>
<p>Compile SPRITESR as a usable z88dk library. Implement the same bouncy sprites demo in C.</p>
<h2 id="more-fun-experiments">More fun experiments</h2>
<p><img src="https://zenithsal.com/assets/photos/pc6002/picard_firstlook_vsync.gif" alt="many_picards" /></p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/subzero_sprite.gif" alt="subzero" /></p>
PC-6002 C Compiler Frontend: COMPILE602018-05-13T00:00:00+00:00https://zenithsal.com/pc-6002/2018/05/13/pc--6002-compile60
<p>COMPILE60 is a simple front-end I wrote in Python/Tkinter to simplify C compilation and linking of PC-6002 projects.</p>
<p>Installation and usage instructions are in the readme.md file: <a href="https://github.com/Salwan/pc6002/tree/master/COMPILE60" title="PC-6002 Git Repo: COMPILE60">COMPILE60 git</a></p>
<p>COMPILE60 requires <a href="https://www.z88dk.org/forum/">z88dk</a> to work and of course a PC-6001 emulator to run the binaries.</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/compile60_scrnshot_window.png" alt="compile60_scrnshot_window" title="COMPILE60" /></p>
<p>Limitations:</p>
<ul>
<li>At the moment, N66 SR (Mode 6) support is listed but it doesn’t exist in z88dk yet (working on it).</li>
<li>Limited options that don’t include more advanced features like optimization</li>
</ul>
<p>A few planned features to be implemented some day:</p>
<ul>
<li>Compiling output directly into a virtual floppy disk image rather than using P6 cassettes</li>
<li>Embedding support for PNG60 tool to import and compress bitmaps to N66-BASIC</li>
</ul>
PC-6002 Extra History2018-05-07T00:00:00+00:00https://zenithsal.com/pc-6002/2018/05/07/pc--6002-history
<p>I expected a troubled commercial history for the PC-60 due to the limited information about it, but I wanted to understand why and I’ve been researching the history of the PC-60 platform in Japan this last week.</p>
<p>My main source of information was the only related magazine I was able to find online in <a href="https://archive.org/">archive.org</a>, IO Magazine. In every issue starting around page 200 there is an impressive amount of technical information about multiple platforms from that era as well as entire source code listings for software and games for these platforms.</p>
<p>Armed with a Japanese OCR solution and Google translate, I went through all issues from 1984 to 1986 and collected all PC-60 information and source code I was able to find.</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/iomagazine_pc60sr.jpg" alt="iomagazine_pc60_sample" title="PC-60 Ad" /></p>
<p>Here are a few things I learned:</p>
<ul>
<li>Last generation of PC-60 was not a very successful platform in Japan. It was out around the end of 1984 and advertised actively for 6 to 7 months afterwards. Then focus shifted towards PC-80 and PC-88 which were much more successful and lasted until the late 80s.</li>
<li>Besides PC-6001 Mk2 SR and PC-6601 SR there was another variant branded: NEC Mr PC that shared the BIOS and N66 SR BASIC. Mr PC failed outright it seems, it was only advertised for a few months then disappeared completely.</li>
<li>The naming system is greatly confusing. Instead of numbering their systems incrementally NEC just kept adding random letters and numbers which I’m sure didn’t help and caused a fragmentation in the userbase.</li>
</ul>
<p><a href="https://zenithsal.com/assets/photos/pc6002/iomagazine_mrpc.jpg"><img src="https://zenithsal.com/assets/photos/pc6002/iomagazine_mrpc_small.jpg" alt="iomagazine_mrpc" title="NEC Mr PC" /></a></p>
<p>So no surprise there, the userbase was limited in Japan and only around 4 technical books were published about PC-60 SR, I found none of those online.</p>
<h2 id="new-information-about-the-platform">New Information about the platform</h2>
<ul>
<li>PC-6001 and its later variants were targeting students. PC-6601 and Mr PC were targeting more advanced users and included a special mode that allows overlaying an external video signal as background. PC-8001 was for business and commercial applications. The successor to all of them turned out to be the PC-8801 which had many variants in the following years all using N88 BASIC.</li>
<li>In N66 SR BASIC, There are a group of BASIC instructions that spit out a <a href="http://zenithsal.com/pages/pc6002#basicReference_NotAvailable">strange NA ERROR</a> if you attempt to use them. NA stands for Not Available which simply indicates the instruction’s triggers are there but they are not doing anything. Apparently there is a version of N66 SR that comes on disk which implements all these extra instructions.</li>
<li>All Microsoft BASIC implementations were designed to be extensible. So you can actually add your own instructions or extend existing ones if you have all the info, and I’ve seen a couple of projects in I/O magazine that do just that, the most impressive is a full Z80 assembler implemented as a BASIC interpreter extension.</li>
</ul>
<p><img src="https://zenithsal.com/assets/photos/pc6002/iomagazine_z80assembler.JPG" alt="iomagazine_z80assembler" title="Z80 Assembler" /></p>
<h2 id="technical-information">Technical Information</h2>
<p>The amount of technical information I was able to find about the PC-60 platform is severely limited and exclusively in Japanese. I have not found a single dedicated detailed overview of the internals of the platform, just fragments here and there and a few books for PC-80 platform which I can only guess uses a similar BIOS.</p>
<p><a href="https://zenithsal.com/assets/photos/pc6002/iomagazine_pc66sr_info.JPG"><img src="https://zenithsal.com/assets/photos/pc6002/iomagazine_pc66sr_info_small.jpg" alt="iomagazine_techinfo" title="MrPC BIOS" /></a></p>
<p>Another potential source of technical information I found was a conversion tool for PC-80 games to PC-60 that the Japanese PC-60 community developed. These are available online and they use assembly code commented in Japanese. <a href="http://sbeach.seesaa.net/article/449239254.html">Here’s Wizardry 1 conversion kit for example</a>. I tested one of the conversions and the result tested the limits of the emulators, it was glitchy! but it used all SR features which makes it a good target for reverse-engineering.</p>
<p>The last and most direct source of internal technical info for N66 BASIC (excluding SR) is support for PC-6001 in the z88 development kit which includes a standard C library, graphics, floating-point math, joystick, PSG sound, and even a simple sprite library.</p>
<p>Therefore and in order not to reinvent the wheel, I decided to switch from <a href="http://sdcc.sourceforge.net/">SDCC</a> to <a href="https://z88dk.org/">z88dk</a> for my C pipeline and I am working on a build tool and vscode integration.</p>
<p>Once everything is working, I will start implementing support for SR and extending the z88 devkit to include more graphics features and FM chip access (Yamaha YM2203).</p>
PC-6002 PNG-to-BASIC2018-05-02T00:00:00+00:00https://zenithsal.com/pc-6002/2018/05/02/pc--6002-PNG--to--BASIC
<h2 id="the-png-pipeline">The PNG Pipeline</h2>
<p>The first utility I wanted to build was a set of tools to convert any appropriately scaled-down PNG to be viewable directly in PC-60 BASIC.</p>
<p>I’ve used Python for the scripts that convert and generate the necessary data plus the 3rd party tool <a href="http://retropc.net/isio/mysoft/">txt2bas.exe available online</a>.</p>
<p>I was able to draw directly using the PC-60 palette using <a href="https://zenithsal.com/assets/pc6002/pc60.txt" title="PC-60 Paint.NET palette file">this palette profile I made for Paint.Net</a>, then convert the PNG to a BASIC program for display.</p>
<p>I drew this small logo for PC-6002, here it’s getting unpacked in the emulator in Mode 5:</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/warka6002_m5_bmp_loader_cropped.gif" alt="warkaanim_gif" title="Al-Warka 6002" /></p>
<p>When I started experimenting on converting larger PNGs I immediately ran into RAM limits, back then this used to be a major bottleneck in my projects. The palette in PC-60 is tiny (16 colors) and as a result there are many repeated bytes in the pixel data, so I developed a simple RLE compression-decompression method in Python and ported it to BASIC. It was pretty effective I was able to load bigger more-detailed images.</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/avinfwars_m6rle.gif" alt="avinfwars_gif" title="Infinity War poster converted and displayed in PC-60 N66 SR BASIC" /></p>
<p>The pipeline I went with to achieve all required features is pretty straightforward:</p>
<ol>
<li><strong>PNG60.py</strong>: script to read a PNG, make sure it’s compatible, map all its colors to the closest colors in the PC-60 palette, then exports the resulting color data as a binary color list that matches PC-60’s video memory layout. It supports Mode 5 and 6. It outputs binary files using extension: “.p6bmp”</li>
<li><strong>p6bmp2bas.py</strong>: this is the workhorse in the system, it reads PNG60’s output binary files and pre-processes them first for PC-60 applying optional RLE compression. Then generate a BASIC program that includes all required code to display the bitmap as well as the bitmap data. It outputs the basic program as a “.bmp.bas” file.</li>
<li><strong>txt2bas</strong>: this is a tool developed by japanese PC-60 developers and is <a href="http://retropc.net/isio/mysoft/">available online</a>. It simply converts the BASIC program generated by p6bmp2bas script to a .p6 casette file that can be loaded directly in any PC-60 emulator using the “cload” command and then executed using the usual “run” command. The two supported modes are: Mode 5 Page 3, and Mode 6.</li>
</ol>
<p><img src="https://zenithsal.com/assets/photos/pc6002/yamaha_mt07_m6rle.gif" alt="yamaha_mt07_gif" title="My dream bike -Yamaha MT-07- in all the 16 color glory (Mode 6)" /></p>
<p>These tools are all grouped into a package usable via a few batch files I wrote to automate all the stages of the pipeline and directly output the .p6 file from a PNG file.</p>
<p><a href="https://github.com/Salwan/pc6002">I setup this repository</a> for the pipeline package (folder “PNG60”) and I will be constantly updating it with any new stuff I develop in the future.</p>
<h2 id="planned-features">Planned Features</h2>
<p>I’ve pretty much implemented most of what I wanted to experiment with however the size/detail of PNGs I can convert over to PC-60 is still limited by memory even after RLE compression. I would like to reimplement the last stage of the pipeline to directly export to loadable binary data on a floppy disk (using BASIC’s BLOAD command) which is much faster and allows loading full-screen bitmaps directly.</p>
<p>Additionally, the current method to convert colors to PC-60 palette is just a simple RGB comparison to figure out which PC-60 color is the closest. As a result, many colors in exported bitmaps get approximated to gray which is right in the middle of the RGB range. I’d like to make sure to use the whole 16 colors palette and do some half-tone/dithering to fake more colors.</p>
<p>Next: I’ll be working on ditching BASIC for C/Assembly-programming and expand on <a href="http://zenithsal.com/pages/pc6002">this reference page I’m writing</a>.</p>
PC-6002 vs 80s Computers Benchmark2018-04-30T00:00:00+00:00https://zenithsal.com/pc-6002/2018/04/30/pc--6002-vs-80s-computers-benchmark
<h1 id="the-benchmark">The Benchmark</h1>
<p>Didn’t have much time last week to finish working on a PNG-to-PC-6001 compressed bitmaps pipeline (next blog post) but I saw <a href="https://www.youtube.com/watch?v=pxye-RbKFpY">this video on youtube</a> and thought this would make a great quick test of performance level for 80s computers! (mostly z80-based) to understand how they compare to each other.</p>
<p>I used the exact same program in the video:</p>
<div class="language-vb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="mi">10</span> <span class="n">FOR</span> <span class="n">I</span><span class="o">=</span><span class="mi">2</span> <span class="n">to</span> <span class="mi">1000</span>
<span class="mi">20</span> <span class="n">K</span><span class="o">=</span><span class="n">INT</span><span class="p">(</span><span class="n">SQR</span><span class="p">(</span><span class="n">I</span><span class="p">))</span><span class="o">+</span><span class="mi">1</span>
<span class="mi">30</span> <span class="n">FOR</span> <span class="n">J</span><span class="o">=</span><span class="mi">2</span> <span class="n">TO</span> <span class="n">K</span>
<span class="mi">40</span> <span class="n">K1</span><span class="o">=</span><span class="n">I</span><span class="o">/</span><span class="n">J</span>
<span class="mi">50</span> <span class="n">K2</span><span class="o">=</span><span class="n">INT</span><span class="p">(</span><span class="n">K1</span><span class="p">)</span>
<span class="mi">60</span> <span class="n">IF</span> <span class="n">K1</span><span class="o">=</span><span class="n">K2</span> <span class="n">THEN</span> <span class="n">GOTO</span> <span class="mi">90</span>
<span class="mi">70</span> <span class="n">NEXT</span> <span class="n">J</span>
<span class="mi">80</span> <span class="n">PRINT</span> <span class="n">I</span>
<span class="mi">90</span> <span class="n">NEXT</span> <span class="n">I</span>
</code></pre></div></div>
<p>This is mostly a test of the embedded BASIC interpreter rather than the processing power in these computers. I’m sure running compiled assembly code should deliver similar performance since all Z80 PCs are running at the same frequency.</p>
<table>
<thead>
<tr>
<th>PC</th>
<th>Processor</th>
<th>Total Time</th>
</tr>
</thead>
<tbody>
<tr>
<td>Amstrad CPC 464</td>
<td>Z80 @ 4MHz</td>
<td><em>1:20</em></td>
</tr>
<tr>
<td>Commodore 64</td>
<td>6502 @ 1MHz</td>
<td><em>2:15</em></td>
</tr>
<tr>
<td>PC-6001 Mk2 N66</td>
<td>Z80 @ 4MHz</td>
<td><em>8:38</em></td>
</tr>
<tr>
<td>PC-6002 (PC-6001Mk2SR) N66 SR</td>
<td>Z80 @ 4MHz</td>
<td><em>3:44</em></td>
</tr>
<tr>
<td>MSX 1 (<a href="https://en.wikipedia.org/wiki/Sakhr_Computers">Al-Sakhr 170</a>)</td>
<td>Z80 @ 4MHz</td>
<td><em>3:54</em></td>
</tr>
<tr>
<td>MSX 2 and 2+</td>
<td>Z80 @ 4MHz</td>
<td><em>3:57</em></td>
</tr>
<tr>
<td>Amiga A500 AmigaBasic</td>
<td>68000 @ 7.16MHz</td>
<td><em>0:35</em></td>
</tr>
<tr>
<td><a href="http://smilebasic.com/en/">Nintendo 3DS: SmileBASIC</a></td>
<td>ARM11 @ 804MHz</td>
<td><em>0.086s</em></td>
</tr>
<tr>
<td><a href="https://www.asus.com/2-in-1-PCs/ASUS-Transformer-Mini-T102HA/specifications/">This Laptop</a>: <a href="https://pastebin.com/0RN4fb0p">Python</a></td>
<td>Atom x5-Z8350 @ 1.44GHz</td>
<td><em>0.337s</em></td>
</tr>
</tbody>
</table>
<p>The massive variance in performance is surprising! the PC-6001 Mk2 is especially disappointing.. which is a mystery as it shares the same architecture with MSX, and both use a BASIC interpreter developed by Microsoft around the same time.</p>
<p>The PC-6002 (PC-6001 Mk2 SR) BASIC N66 SR version is much better and is close to MSX’s performance which is what I expected.</p>
<p>Ultimately, both are left in the dust when compared to the excellent architectures in the Amstrad CPC 464 and the C64 which is powered by a 6502, a much more efficient processor (same processor as the Nintendo NES).</p>
<p>On the other hand, the Amiga architecture is way ahead along with Atari ST, both targeted a different market (much more expensive at the time) and powered by the 68000 which went on to power the SEGA Genesis/Mega Drive later on.</p>
<p>For comparison with how far things have come, the difference between this low-power low-performance tablet-laptop I’m using to write this now and the CPC 464 is merely 238x (lol). But if we theoretically drop down the clock for this Atom x5-z8350 from its normal frequency 1.2GHz to 4MHz (a factor of approximately 1/300), it would run the <a href="https://pastebin.com/0RN4fb0p">same benchmark program in CPython</a> in approximately: 0.337s * 300 = 1:41.10 which puts it below the CPC 464.</p>
<p><a href="http://smilebasic.com/en/">Nintendo 3DS’s SmileBASIC</a> is an interesting one, the developers who created it are fans of NEC PC architectures so it’s essentially a modern extended implementation of that, with impressive performance and a high level of polish.</p>
<p>By the way, the ARM processor architecture is historically a grandchild of the 6502 processor. In fact the initial instruction set was developed using the BBC Micro BASIC!</p>
<p>Another interesting thing is that the Z80 processor was developed to be software compatible with the Intel 8080 machine language.</p>
PC-6002: The Pixels - Part 12018-04-21T00:00:00+00:00https://zenithsal.com/pc-6002/2018/04/21/pc--6002-the-pixels-part-1
<h1 id="toolbox">Toolbox</h1>
<p>The most important tool you need is a good emulator! Here are two excellent emulators with all necessary settings and files as well as a collection of PC-6001 games and demos for testing <a href="https://mega.nz/#!yugQDCqY!KZSDhtveWfBtMtP8Qx8s-GudQO7hdkIxOciNmjjuX7c">here</a>:</p>
<ul>
<li>PC6001VW3: Full featured accurate emulator with a built-in debugger and many useful tools.</li>
<li>iP6+: Light-weight emulator, great for quick testing.</li>
</ul>
<p>Of course both emulators use Japanese ROMs, maybe in the future if I had access to a Warka ROM chip I could dump it and use that instead. The main difference is language, the Warka had an Arabic font built-in while the PC-6001 had Japanese fonts.</p>
<h2 id="assembly-programming">Assembly programming</h2>
<p>All PC-60 models use a Z80 processor. I found a nice tutorial online that goes through setting up and using ZASM (z80 assembler) to compile PC-6001 programs then injecting them into PC-6001 at runtime using the PC6001VW3’s debugger: <a href="http://web.archive.org/web/20180620180805/http://www.geocities.jp/tiny_yarou/asmdev/asmdev.html">http://www.geocities.jp/tiny_yarou/asmdev/asmdev.html</a> (japanese)</p>
<p>This is the easiest development path for deployment, it also produces the fastest & smallest code. For actual programming though, assembly may not be for everyone.</p>
<p>I will cover development using z80 and ZASM in a future post.</p>
<h2 id="c-programming">C programming</h2>
<p>For the next level we will introduce a C compiler that supports Z80 and integrate it into the pipeline. I am still working on the deployment pipeline but it’s already working as I managed to deploy correct PC-6001 code.</p>
<p>I am using <a href="http://sdcc.sourceforge.net/">SDCC</a> with a combination of tools and scripts to compile output.</p>
<p>I will cover the C programming pipeline for PC-6001 in a future post.</p>
<h1 id="mode-5-the-pixels">Mode 5: The Pixels</h1>
<p>For this trip through Pixel lane, we’ll use MODE 5 with 4 PAGES.</p>
<p>The main sample program this exploration is based on is written by Tiny Yarou who seems to be the most active PC-60 developer on the internet. Here’s the sample program: <a href="http://www.tiny-yarou.com/p6sample.html">http://www.tiny-yarou.com/p6sample.html</a></p>
<p>The information are in Japanese of course but the BASIC code and hex code tell us everything we need.</p>
<p>What the sample does is use SCREEN mode 3 in PAGE 2 and 3 as a front-buffer and a sprite-buffer.</p>
<p>It first draws a simple sprite sheet to PAGE 3. Then switches to PAGE 2 and uses a z80 program and parameters set via BASIC POKE instructions to blit the sprites to custom X and Y coordinates.</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/asmblit.gif" alt="asmblit_gif" /></p>
<p>The coordinates and size of sprites are limited by a single rule: all X values must be multiples of 8. SCREEN mode 3 is 320 pixels wide so X range must be 0 to 40.</p>
<h2 id="reverse-engineering">Reverse Engineering</h2>
<p>The BASIC code in the sample is self-explaintory, it sets up addresses, writes the z80 procedure to RAM using POKE, draws the sprite sheet, and then execute the procedure continuously.</p>
<p>Disassembling (and reverse engineering) the z80 procedure, I was able to learn a lot:</p>
<figure class="highlight"><pre><code class="language-nasm" data-lang="nasm"><span class="c1">; PC-6001 MkII (64K) Mode 5 Page 4</span>
<span class="c1">; Blit function: from spritebuffer page to frontbuffer</span>
<span class="k">ORG</span> <span class="mh">0D000H</span><span class="c1">;</span>
<span class="c1">; Symbol def</span>
<span class="no">SPRBUF</span><span class="kd"> EQU</span> <span class="mh">4000H</span>
<span class="no">SCRBUF</span><span class="kd"> EQU</span> <span class="mh">8000H</span>
<span class="nl">START:</span>
<span class="nf">DI</span>
<span class="nf">LD</span> <span class="nv">HL</span><span class="p">,</span> <span class="mh">0000H</span> <span class="c1">; 00GY</span>
<span class="nf">LD</span> <span class="nv">DE</span><span class="p">,</span> <span class="mh">0000H</span> <span class="c1">; 00GX</span>
<span class="nf">CALL</span> <span class="nv">MOVETOY</span>
<span class="nf">LD</span> <span class="nv">BC</span><span class="p">,</span> <span class="nb">SP</span><span class="nv">RBUF</span> <span class="c1">; GP00</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">PUSH</span> <span class="nv">HL</span>
<span class="nf">LD</span> <span class="nv">HL</span><span class="p">,</span> <span class="mh">0000H</span> <span class="c1">; 00PY</span>
<span class="nf">LD</span> <span class="nv">DE</span><span class="p">,</span> <span class="mh">0000H</span> <span class="c1">; 00PX</span>
<span class="nf">CALL</span> <span class="nv">MOVETOY</span>
<span class="nf">LD</span> <span class="nv">BC</span><span class="p">,</span> <span class="nv">SCRBUF</span> <span class="c1">; PP00</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">EX</span> <span class="nv">DE</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">POP</span> <span class="nv">HL</span>
<span class="nf">LD</span> <span class="nv">A</span><span class="p">,</span> <span class="mh">0DDH</span>
<span class="nf">OUT</span> <span class="mh">0F0H</span><span class="p">,</span> <span class="nv">A</span>
<span class="nf">LD</span> <span class="nv">C</span><span class="p">,</span> <span class="mh">14H</span> <span class="c1">; SY = 20</span>
<span class="nl">SETUP:</span>
<span class="nf">LD</span> <span class="nv">B</span><span class="p">,</span> <span class="mh">02H</span> <span class="c1">; SX = 2</span>
<span class="nf">PUSH</span> <span class="nv">HL</span>
<span class="nf">PUSH</span> <span class="nv">DE</span>
<span class="nl">HORCPY:</span>
<span class="nf">LD</span> <span class="nv">A</span><span class="p">,</span> <span class="p">(</span><span class="nv">HL</span><span class="p">)</span>
<span class="nf">LD</span> <span class="p">(</span><span class="nv">DE</span><span class="p">),</span> <span class="nv">A</span>
<span class="nf">SET</span> <span class="mi">5</span><span class="p">,</span> <span class="nv">H</span> <span class="c1">; adding 32</span>
<span class="nf">SET</span> <span class="mi">5</span><span class="p">,</span> <span class="nv">D</span>
<span class="nf">LD</span> <span class="nv">A</span><span class="p">,</span> <span class="p">(</span><span class="nv">HL</span><span class="p">)</span>
<span class="nf">LD</span> <span class="p">(</span><span class="nv">DE</span><span class="p">),</span> <span class="nv">A</span>
<span class="nf">RES</span> <span class="mi">5</span><span class="p">,</span> <span class="nv">H</span> <span class="c1">; subtracting 32</span>
<span class="nf">RES</span> <span class="mi">5</span><span class="p">,</span> <span class="nv">D</span>
<span class="nf">INC</span> <span class="nv">HL</span>
<span class="nf">INC</span> <span class="nv">DE</span>
<span class="nf">DJNZ</span> <span class="nv">HORCPY</span>
<span class="nf">POP</span> <span class="nv">DE</span>
<span class="nf">POP</span> <span class="nv">HL</span>
<span class="nf">PUSH</span> <span class="nv">BC</span>
<span class="nf">LD</span> <span class="nv">BC</span><span class="p">,</span> <span class="mh">0028H</span> <span class="c1">; 40 is the screen width</span>
<span class="nf">EX</span> <span class="nv">DE</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">EX</span> <span class="nv">DE</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">POP</span> <span class="nv">BC</span>
<span class="nf">DEC</span> <span class="nv">C</span>
<span class="nf">JR</span> <span class="nv">NZ</span><span class="p">,</span> <span class="nv">SETUP</span>
<span class="nf">LD</span> <span class="nv">A</span><span class="p">,</span> <span class="mh">011H</span>
<span class="nf">OUT</span> <span class="mh">0F0H</span><span class="p">,</span> <span class="nv">A</span>
<span class="nf">EI</span>
<span class="nf">RET</span>
<span class="nl">MOVETOY:</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">LD</span> <span class="nv">C</span><span class="p">,</span> <span class="nv">L</span>
<span class="nf">LD</span> <span class="nv">B</span><span class="p">,</span> <span class="nv">H</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">DE</span>
<span class="nf">RET</span>
<span class="nf">END</span></code></pre></figure>
<p>Here are some observations:</p>
<ul>
<li>Procedure program address is at 0xd000 (notice that 300 bytes are cleared in BASIC starting at that address)</li>
<li>PAGE 2 and PAGE 3 memory addresses are set (SCRBUF and SPRBUF), these are effectively the pointers to the first pixel in each. When number of pages is set to 3 instead of 4, the memory map is different and PAGE 2(SCRBUF) and PAGE 3 (SPRBUF) start at 0x4000 and 0x0000 respectively.</li>
<li>Notice DI and EI in the beginning and end effectively disabling hardware interrupts. Otherwise if an interrupt happens while the procedure is running, registers will get messed up. When I tried removing those I either got random looking noise and glitching or a crash then restart of the PC.</li>
<li>The last label ‘MOVETOY’ simply multiplies HL by 40 (which is 320 pixels divided by 8) and that’s how many bytes in memory represent a single horizontal line in mode 320x200.</li>
</ul>
<p>The rest is pretty straight forward assembly. What the procedure is doing on a high level is this:</p>
<ul>
<li>Figure out the pointer to the first pixel block in spritebuffer for the sprite and first pixel in frontbuffer to draw the sprite to.</li>
<li>Loop while copying bytes from spritebuffer to frontbuffer one horizontal line at a time.</li>
</ul>
<p>Every block of 8 pixels are represented by 2 bytes. The first is in the specified PAGE address and the second is offset by +0x2000 in memory (that’s what SET 5, H and D effectively do). The combination of the first and second bytes produces the pattern and colors of that particular 8 pixels block.</p>
<p>So the reason why X is limited to multiples of 8 is simply because thats how pixels are layed out in memory, if you want to change a single pixel/color from assembly you’d have to do some bit wrangling.</p>
<p>The way they managed to encode 8 pixels (16 color each) in 2 bytes is by cheating! Mode 3 is actually 160x200 where every pixel is doubled horizontally.
As a result this is how text looks like in mode 3:</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/mode3_text.gif" alt="mode3_text_gif" /></p>
<h1 id="sprite-movement">Sprite Movement</h1>
<p>PC-6001 doesn’t support hardware sprites (as far as I know), so moving sprites around requires some trickery.</p>
<p>In general, there are 2 methods to do this based on what I currently know:</p>
<ul>
<li>Backpage/frontpage switching: this will work only in Mode 5 a(Mode 6 has single graphics PAGE). Simply clear and move sprites in the backpage then switch pages and repeat.</li>
<li>frontbuffer movement: this will not look nice, but essentially clear sprite then draw it in new position. it won’t look nice because you will see the clearing and drawing.</li>
</ul>
<p>For both methods we need a clear procedure. So I modified the sample program to do just that:</p>
<figure class="highlight"><pre><code class="language-nasm" data-lang="nasm"><span class="c1">; PC-6001 MkII (64K) Mode 5 Page 3</span>
<span class="c1">; Blit Zero function: clears pixels from screen</span>
<span class="k">ORG</span> <span class="mh">0D080H</span><span class="c1">;</span>
<span class="c1">; Symbols table: LO HI</span>
<span class="c1">; SCRBUF ZP00 D08B D08C</span>
<span class="c1">; 00ZY D082 D083</span>
<span class="c1">; 00ZX D085 D086</span>
<span class="c1">; ZH D093</span>
<span class="c1">; ZW D095</span>
<span class="c1">; Screen width/8 D0A5 D0A6 </span>
<span class="c1">; Pattern value D098</span>
<span class="c1">; Attrib value D09C</span>
<span class="c1">; Symbol def</span>
<span class="no">SCRBUF</span><span class="kd"> EQU</span> <span class="mh">8000H</span>
<span class="nl">START:</span>
<span class="nf">DI</span>
<span class="nf">LD</span> <span class="nv">HL</span><span class="p">,</span> <span class="mh">0010H</span> <span class="c1">; 00PY</span>
<span class="nf">LD</span> <span class="nv">DE</span><span class="p">,</span> <span class="mh">0020H</span> <span class="c1">; 00PX</span>
<span class="nf">CALL</span> <span class="nv">MOVETOY</span>
<span class="nf">LD</span> <span class="nv">BC</span><span class="p">,</span> <span class="nv">SCRBUF</span> <span class="c1">; PP00</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">LD</span> <span class="nv">A</span><span class="p">,</span> <span class="mh">0DDH</span>
<span class="nf">OUT</span> <span class="mh">0F0H</span><span class="p">,</span> <span class="nv">A</span>
<span class="nf">LD</span> <span class="nv">C</span><span class="p">,</span> <span class="mh">14H</span> <span class="c1">; SY = 20</span>
<span class="nl">SETUP:</span>
<span class="nf">LD</span> <span class="nv">B</span><span class="p">,</span> <span class="mh">02H</span> <span class="c1">; SX = 2</span>
<span class="nf">PUSH</span> <span class="nv">HL</span>
<span class="nl">HORCPY:</span>
<span class="nf">LD</span> <span class="p">(</span><span class="nv">HL</span><span class="p">),</span> <span class="mh">0FFH</span> <span class="c1">; Write pattern value</span>
<span class="nf">SET</span> <span class="mi">5</span><span class="p">,</span> <span class="nv">H</span>
<span class="nf">LD</span> <span class="p">(</span><span class="nv">HL</span><span class="p">),</span> <span class="mh">0FFH</span> <span class="c1">; Write attribute value</span>
<span class="nf">RES</span> <span class="mi">5</span><span class="p">,</span> <span class="nv">H</span>
<span class="nf">INC</span> <span class="nv">HL</span>
<span class="nf">DJNZ</span> <span class="nv">HORCPY</span>
<span class="nf">POP</span> <span class="nv">HL</span>
<span class="nf">PUSH</span> <span class="nv">BC</span>
<span class="nf">LD</span> <span class="nv">BC</span><span class="p">,</span> <span class="mh">0028H</span> <span class="c1">; 40 is the screen width</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">POP</span> <span class="nv">BC</span>
<span class="nf">DEC</span> <span class="nv">C</span>
<span class="nf">JR</span> <span class="nv">NZ</span><span class="p">,</span> <span class="nv">SETUP</span>
<span class="nf">LD</span> <span class="nv">A</span><span class="p">,</span> <span class="mh">011H</span>
<span class="nf">OUT</span> <span class="mh">0F0H</span><span class="p">,</span> <span class="nv">A</span>
<span class="nf">EI</span>
<span class="nf">RET</span>
<span class="nl">MOVETOY:</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">LD</span> <span class="nv">C</span><span class="p">,</span> <span class="nv">L</span>
<span class="nf">LD</span> <span class="nv">B</span><span class="p">,</span> <span class="nv">H</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">HL</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">BC</span>
<span class="nf">ADD</span> <span class="nv">HL</span><span class="p">,</span> <span class="nv">DE</span>
<span class="nf">RET</span>
<span class="nf">END</span></code></pre></figure>
<p>I created a minimal test for the two procedures:</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/blitz_demo.gif" alt="blitz_demo_gif" /></p>
<p>For the next part, I’m going to write a tool to help import PNGs into N66 BASIC then code a movement function that does the blitting and clearing automatically.</p>
PC-6002: Let's Begin2018-04-20T00:00:00+00:00https://zenithsal.com/pc-6002/2018/04/20/pc--6001-lets-begin
<p>A long time ago when I was 11 and lived in Basra south of Iraq my parents thought it was a good idea to get me into computers and programming. I’ve always been a gamer since birth pretty much so it fit nicely.</p>
<p>The year was around 1996 and Iraq was way behind the world in computing due to unfortunate circumstances.</p>
<p>During the 80s however, Iraq was a regional pioneer in digital technology despite the devastating 8 years war with Iran, this growth was led by a national group of companies collectively named: Electronics Industry Company or EIC (شركة الصناعات الوطنية).</p>
<p>The EIC produced a variety of electronic products including a number of personal computers.</p>
<p>And there I was in 1996, at the appropriately named “The Computer Institute” in Basra standing in front of a collection of Warka 6001 computers among the usual green and amber display IBM 286s burning to learn to speak their language.</p>
<p>EIC produced two lines of personal computers both licensed from overseas manufacturers. The first was the Al-Warka الوركاء PC based on NEC’s popular Japanese PC-6001 series and targeting enthusiasts and students.</p>
<p>Al-Warka PC-6002 is identical to this, mine was in white:</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/nec_pc6001mk2sr_1.jpg" alt="pc6001_mk2_sr" title="PC-6001 Mk2 SR System" /></p>
<p>And the second line of products was called Salah Al-Deen صلاح الدين and these were based on 286 architecture (as far as I know) and targeted business and professional applications.</p>
<p>The computing course I signed up for along with 2 friends was an introduction to programming BASIC for the Al-Warka PC-6001. And I had a blast! Couldn’t wait to learn more.</p>
<p>Fast forward a few months later, our parents all agreed that getting us computers was better for our school than nintendos. I totally agreed. It happened quickly, I had two choices either a colorful used computer (which I now know was an Amstrad CPC 464) or an Al-Warka PC-6002, I liked the CPC but felt that I’d be alone since all my friends went with the Warka.</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/warka_6001.jpg" alt="warka_6001" title="Al-Warka 6001 with Arabic BASIC cartridge" /></p>
<p>( Photo from Yousif Abood’s blog, <a href="http://web.archive.org/web/20170113192343/https://medium.com/@yabood/how-i-got-my-first-job-repairing-computers-in-baghdad-13fc036d5b8b">this blog post about Warka history</a> )</p>
<p>It was a life-changing day when I turned that PC on for the first time! after the excitement calmed down I sat down and wrote a simple program I learned from a friend that makes a colored line move back and forth horizontally. Here it is running in all its emulated glory:</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/pc6001_dartingline.gif" alt="pc_6001_darting_line" /></p>
<p>All BASIC interpreters in PC-6001 series are developed by Microsoft. Al-Warka PC-6001 (equivalent to Japan’s NEC PC-6001 Mk2) offer 5 modes of BASIC 4 of which are there for back-compatibility. Mode 5 uses N66 BASIC and that’s the one I learned first.</p>
<p><img src="https://zenithsal.com/assets/photos/pc6002/mode5_basic.gif" alt="mode5_basic" /></p>
<p>This is how that simple moving line program looks like in N66 BASIC:</p>
<figure class="highlight"><pre><code class="language-vb" data-lang="vb"><span class="mi">10</span> <span class="n">SCREEN</span> <span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">:</span><span class="n">CLS</span>
<span class="mi">20</span> <span class="n">C</span><span class="o">=</span><span class="mi">2</span>
<span class="mi">30</span> <span class="n">LINE</span><span class="p">(</span><span class="mi">140</span><span class="p">,</span><span class="mi">100</span><span class="p">)</span><span class="o">-</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span><span class="mi">100</span><span class="p">),</span><span class="n">C</span>
<span class="mi">40</span> <span class="n">GOSUB</span> <span class="mi">90</span>
<span class="mi">50</span> <span class="n">GOSUB</span> <span class="mi">150</span>
<span class="mi">60</span> <span class="n">C</span><span class="o">=</span><span class="n">C</span><span class="o">+</span><span class="mi">1</span>
<span class="mi">70</span> <span class="n">IF</span> <span class="n">C</span><span class="o">></span><span class="mi">4</span> <span class="n">THEN</span> <span class="n">C</span><span class="o">=</span><span class="mi">2</span>
<span class="mi">80</span> <span class="n">GOTO</span> <span class="mi">30</span>
<span class="mi">90</span> <span class="c1">REM move left
</span>
<span class="mi">100</span> <span class="n">FOR</span> <span class="n">I</span><span class="o">=</span><span class="mi">0</span> <span class="n">TO</span> <span class="mi">20</span>
<span class="mi">110</span> <span class="n">PSET</span><span class="p">(</span><span class="mi">140</span><span class="o">-</span><span class="n">I</span><span class="p">,</span><span class="mi">100</span><span class="p">),</span><span class="n">C</span>
<span class="mi">120</span> <span class="n">PSET</span><span class="p">(</span><span class="mi">200</span><span class="o">-</span><span class="n">I</span><span class="p">,</span><span class="mi">100</span><span class="p">),</span><span class="mi">1</span>
<span class="mi">130</span> <span class="n">NEXT</span> <span class="n">I</span>
<span class="mi">140</span> <span class="n">RETURN</span>
<span class="mi">150</span> <span class="c1">REM move right
</span>
<span class="mi">160</span> <span class="n">FOR</span> <span class="n">I</span><span class="o">=</span><span class="mi">0</span> <span class="n">TO</span> <span class="mi">20</span>
<span class="mi">170</span> <span class="n">PSET</span><span class="p">(</span><span class="mi">180</span><span class="o">-</span><span class="n">I</span><span class="p">,</span><span class="mi">100</span><span class="p">),</span><span class="n">C</span>
<span class="mi">180</span> <span class="n">PSET</span><span class="p">(</span><span class="mi">120</span><span class="o">+</span><span class="n">I</span><span class="p">,</span><span class="mi">100</span><span class="p">),</span><span class="mi">1</span>
<span class="mi">190</span> <span class="n">NEXT</span> <span class="n">I</span>
<span class="mi">200</span> <span class="n">RETURN</span>
<span class="mi">210</span> <span class="n">END</span></code></pre></figure>
<p>My Al-Warka was a PC-6002 (which is equivalent to PC-6001 Mk2 SR) had 1 extra BASIC mode called “N66 SR” that’s super fast and has higher resolution screen modes and an extra FM sound chip! Which happens to be <a href="https://en.wikipedia.org/wiki/Yamaha_YM2203">Yamaha YM-2203</a> and sounded amazing through the internal speaker.</p>
<p>In Japan the PC-6001 Mk2 was very popular and loads of software was developed and sold for it throughout the 80s. Games and demos did trickle down and at one point I had 36 games in total on 3 floppy disks!</p>
<p>While Mode 6 is superior, it was rarely used. In both the Japanese and Iraqi programming scenes.</p>
<p>Here’s a modern music demo done by <a href="http://www.tiny-yarou.com/">Tiny Yarou</a> for PC-6001 Mk2 SR in Mode 6 that uses the YM2203 to its full potential:</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/sx2pbcmy_Hc" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>And this is his comment on the video translated through Google:</p>
<blockquote>
<p>Tried to make something like Ys with IISR + DISK. Previously, I made an extended RAM compatible version, but this is a disc version that works even without RAM. SR is faster than mkII, but it took more time to draw as much as VRAM increased, which made it far from comfortable</p>
</blockquote>
<p>I spent years programming on this PC. It’s basically my computing childhood.</p>
<p>While I got pretty good at BASIC and had a number of tricks to extend some things further with some magic POKEs and EXECs, I felt severely limited and dragged down by my very limited knowledge of the hardware architecture and the fact I never figured out how to program directly in Z80 and talk directly to the video and audio hardware.</p>
<p>There was no internet back then. All I had were 2 official manuals I found and copied (BASIC and the internal MONITOR debugger), the only other source of tricks were programs other people made and distributed through local programming gatherings, these resembled the <a href="https://en.wikipedia.org/wiki/Demoscene">demoscene</a> although on a much smaller scale.</p>
<p>I feel I have unfinished business. Many years later I visited Basra and was there for a few days, I purposefully dug out the PC-6002 and turned it on one last time, except this time I had access to information..</p>
<p>It took me most of a day but I wrote a simple BASIC/z80 program to write pixels to the screen buffer and measure how much time I could do it in (fill-rate basically). It was around 700ms to fill 320x200 16 color screen. I was floored! I could have done some basic level scrolling on the Warka if I knew what I was doing.</p>
<p>Since information outside of Japan is scarce about this PC. Armed with a set of tools and emulators, I’ll be writing a series of posts to cover different aspects of the PC-6001 Mk2/SR and programming for it using modern methods.</p>
<p>Here’s a listing of the PC-6001 Mk2 SR specs in as much detail as I have:</p>
<h2 id="processor">Processor:</h2>
<p>Main Processor: µPD 780C-1 (Z80 Compatible) clocked at 3.59 MHz to 3.9936 MHz depending on BASIC mode.</p>
<p>Co-Processor: ìPD8049 clocked 8 MHz, used for I/O management. Wasn’t able to find a datasheet for the chip.</p>
<h2 id="ram">RAM:</h2>
<p>Both Mode 5 and Mode 6 (N66 and N66 SR) give you 64KB of RAM.</p>
<h2 id="video">Video:</h2>
<p>The PC-6001 Mk2 SR had multiple video chips: MC6845 + M5C6847P-1</p>
<p>One or both of those chips are possibly modified.</p>
<h2 id="audio">Audio:</h2>
<p>N66 BASIC provided access to the usual PSG chip: AY-3-8910</p>
<p>Japanese PC-6001 Mk2 had a speech synthesizer. Al-Warka didn’t. In Mode 6 the TALK command does nothing.</p>
<p>N66 SR BASIC provided access to an FM chip: Yamaha YM-2203 in addition to the PSG chip.</p>
<p>They were both usable. So you can actually play 6 tracks at the same time: 3 FM and 3 PSG.</p>
<p>N66 SR BASIC came with 12 FM preset instruments and it also allowed programming your own instrument if you knew the right combination of magical POKEs to the right addresses.</p>
<h2 id="display">Display</h2>
<p>Al-Warka PC-6001 had TV-out and can be connected to any normal TV with component video. It also had an RGB display port.</p>
<p>Al-Warka PC-6002 had an RGB display port and required a compatible NEC monitor to work.</p>
<p>N66 BASIC provided 2 graphics modes and 2 to 4 PAGES for display that could be either text or graphics:</p>
<ul>
<li>40x20 text mode with 15 colors foreground 8 colors background.</li>
<li>320x200 @ 15 colors: pixels were written in pairs horizontally so in reality this was a 160x200 mode.</li>
<li>320x200 @ 4 colors: pixels were true 320x200.</li>
</ul>
<p>N66 SR BASIC provided 2 graphics mode as well. Always 2 PAGES, first is text and second is graphics.</p>
<ul>
<li>Selectable text mode: 40x20, 40x25, 80x20, 80x25 with 16 colors.</li>
<li>320x200 @ 16 colors: 15 color pixels</li>
<li>640x200 @ 4 colors: palette was selectable out of the groups of 4 from the 15 colors available.</li>
</ul>
<h2 id="storage">Storage</h2>
<p>3.5” floppy disks compatible with normal 3.5” floppies.</p>
<p>Standard storage per floppy is around 160 KB. I’ve seen one disk that had more than 320 KB and it blew my mind back then. So it’s either 160 or 320 in double-sided mode. Never knew how to format disks to have 320 KB.</p>
<p>My PC came with a system disk that had two tools: FORMAT and BACKUP.</p>
<p>FORMAT of course formats new floppies to be used by BASIC. The actual code is in BASIC but the format functions are in assembly so it just looked like magic to me.</p>
<p>BACKUP was a very primitive disk-to-disk copy utility, you had to sit there and swap the floppies 20-30 times until the copying is done. It took nearly 40 minutes. It essentially copied disk tracks one at a time.</p>
<p>There were two types of Floppy Disk Drives. Called B and BE. Mine was the BE type. They were one-way compatible (B works on BE) and the FORMAT tool is different for them.</p>
Neuromorphic Artificial Intelligence2017-12-10T00:00:00+00:00https://zenithsal.com/ai/2017/12/10/neuromorphic-artificial-intelligence
<p>This is mostly going to be an information dump. I’ve been researching this for a month or two and the amount of stuff happening out there these last few months is just mind-blowing. Progress achieved from mid 2016 till time of writing this post (end of 2017) wasn’t only impressive but paradigm shifting.</p>
<p>First off, this is not about robots or androids or skynet. This is about artificial intelligence that runs on software and hardware designed to resemble biological intelligence. Everytime you swipe through Snapchat’s filters, you’re running a variation of that intelligence that attempts to find where your face is, match its orientation and scale to superimpose dog-ears or makeup.</p>
<p>While exploring this stuff, you might want to listen to the Machine from <a href="http://www.imdb.com/title/tt1839578/">Person of Interest</a> which is perfectly appropriate:</p>
<figure class="video_container">
<iframe width="560" height="180" src="https://www.youtube.com/embed/7-4pmNnjj6k" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>To understand what this is about, read this entertaining exploration of artificial general intelligence and the technological singularity: <a href="https://waitbutwhy.com/2015/01/artificial-intelligence-revolution-1.html">Artificial Intelligence Revolution</a></p>
<p>Name of the game (so far): <em>Recusrive self-improvement via reinforcement learning</em> (+minimal human experts involvement)</p>
<h3 id="deepmind-google"><a href="https://deepmind.com/">Deepmind</a> (Google)</h3>
<h4 id="stated-goal">Stated goal</h4>
<blockquote>
<p>Solve intelligence. Use it to make the world a better place.</p>
</blockquote>
<h4 id="stated-purpose">Stated purpose</h4>
<blockquote>
<p>If we’re successful, we believe this will be one of the most important and widely beneficial scientific advances ever made, increasing our capacity to understand the mysteries of the universe and to tackle some of our most pressing real-world challenges. From climate change to the need for radically improved healthcare, too many problems suffer from painfully slow progress, their complexity overwhelming our ability to find solutions. With AI as a multiplier for human ingenuity, those solutions will come into reach.</p>
</blockquote>
<p>Viral influential work:</p>
<ul>
<li>AlphaGo Fan (?? months): 176 GPUs</li>
<li>AlphaGo Lee (6 months?): 48 TPUs v1</li>
<li>AlphaGo Master (3 months?): 4 TPUs v2</li>
<li>AlphaGo Zero (40 Days): 4 TPUs v2</li>
<li>AlphaZero (4 hours): 4 TPUs v2</li>
<li>Next step: Alpha ? (?)</li>
</ul>
<p><strong>Chess: AlphaZero vs Stockfish</strong></p>
<figure class="video_container">
<iframe width="720" height="405" src="https://www.youtube.com/embed/7-MborNxYWE" frameborder="0" allowfullscreen=""></iframe>
</figure>
<h3 id="openai-elon-musks-pre-emptive-plan-for-agi"><a href="https://openai.com/">OpenAI</a> (Elon Musk’s pre-emptive plan for AGI)</h3>
<h4 id="stated-goal-1">Stated goal:</h4>
<blockquote>
<p>Discovering and enacting the path to safe artificial general intelligence.</p>
</blockquote>
<h4 id="stated-purpose-1">Stated purpose:</h4>
<blockquote>
<p>OpenAI’s mission is to build safe AGI, and ensure AGI’s benefits are as widely and evenly distributed as possible. We expect AI technologies to be hugely impactful in the short term, but their impact will be outstripped by that of the first AGIs.</p>
</blockquote>
<blockquote>
<p>By being at the forefront of the field, we can influence the conditions under which AGI is created. As Alan Kay said, “The best way to predict the future is to invent it.”</p>
</blockquote>
<p>Viral influential work:</p>
<ul>
<li>Dota 2 1v1 AI destroying pro players</li>
<li>Next step: 5v5 Dota 2</li>
</ul>
<p><strong>Dota 2: Dendi vs OpenAI</strong></p>
<figure class="video_container">
<iframe width="720" height="405" src="https://www.youtube.com/embed/7U4-wvhgx0w" frameborder="0" allowfullscreen=""></iframe>
</figure>
<h2 id="rise-of-neuromorphic-computing-architectures">Rise of Neuromorphic Computing Architectures</h2>
<p>Current explosion in Neuromorphic Computing:</p>
<ul>
<li><a href="http://www.research.ibm.com/articles/brain-chip.shtml">IBM TrueNorth (DARPA)</a></li>
<li><a href="https://www.intelnervana.com/">Intel Nervana Neural Network Processor (First Neuromorphic desktop processor)</a></li>
<li><a href="https://blogs.nvidia.com/blog/2016/09/28/xavier/">NVIDIA Xavier (Tesla autopilot)</a></li>
<li><a href="https://cloud.google.com/tpu/">Google TensorFlow Processing Unit (Deepmind)</a> and <a href="https://www.tensorflow.org/">TensorFlow software</a></li>
<li>Apple Neural Processor (iPhone X)</li>
<li>Qualcomm Kirin 970 Neural Processing Unit</li>
<li>PowerVR Neural Net Accelerator</li>
<li>and many more ..</li>
</ul>
<p>Beginning of an international race in AI: <a href="https://www.technologyreview.com/the-download/609791/china-has-a-new-three-year-plan-to-rule-ai/">“Rule AI” action plan by China’s industry and information technology Ministry</a> Notice the focus on development and mass-production of neuromorphic processors.</p>
<p>Argument that computing power is nearing its peak is invalid. Neuromorphic computing is fundamentally different and is already exceeding traditional digital processing efficiency for Neural Network algorithms significantly.</p>
<p>Perhaps we won’t need a fundamentally different approach such as Quantum computing to hit a technological singularity after all!</p>
<h2 id="brain-emulation">Brain emulation</h2>
<p>Google since May 2017 has 10^17 ops-per-second spiking(?) neural network tensorflow processing pods (Able to perform the equivalent of <a href="https://en.wikipedia.org/wiki/Tensor_processing_unit">11.5 petaFLOPs</a>), <a href="https://en.wikipedia.org/wiki/Nick_Bostrom">Nick Bostrom</a> estimated 10^18 needed to simulate human brain neural processing capacity based on spiking neural networks model. <a href="http://www.fhi.ox.ac.uk/brain-emulation-roadmap-report.pdf">Report.pdf</a></p>
<p><em>Roadmap until 2099:</em></p>
<table>
<thead>
<tr>
<th>Level</th>
<th>Desc</th>
<th>CPU Demand (FLOPS)</th>
<th>Consumer Computing</th>
<th>Super Computing</th>
</tr>
</thead>
<tbody>
<tr>
<td>4</td>
<td>Spiking Neural Network</td>
<td>10^18</td>
<td>2042</td>
<td>2019</td>
</tr>
<tr>
<td>5</td>
<td>Electrophysiology</td>
<td>10^22</td>
<td>2068</td>
<td>2033</td>
</tr>
<tr>
<td>6</td>
<td>Metabolome</td>
<td>10^25</td>
<td>2087</td>
<td>2044</td>
</tr>
<tr>
<td>7</td>
<td>Proteome</td>
<td>10^26</td>
<td>2093</td>
<td>2048</td>
</tr>
<tr>
<td>8</td>
<td>States of protein compelxes</td>
<td>10^27</td>
<td>2100</td>
<td>2052</td>
</tr>
</tbody>
</table>
<hr />
<p>Multiple projects to simulate the human brain are underway:</p>
<ul>
<li><a href="https://www.humanbrainproject.eu/en/">Human Brain Project</a> -> <a href="http://apt.cs.manchester.ac.uk/projects/SpiNNaker/">SpiNNaker</a></li>
<li><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4387516/">Brain/MINDS</a></li>
</ul>
<p>And others</p>
<h2 id="cultural-impact">Cultural Impact</h2>
<p><a href="https://su.org/">Singularity University</a> aims to prepare academics and researchers around the world for exponential growth technologies like Artificial Intelligence. (<a href="https://en.wikipedia.org/wiki/Ray_Kurzweil">Ray Kurzweil</a>, Google)</p>
<p>AGI religion already exists although still very low-profile: Way of the Future (Sadly no longer online!)</p>
<h3 id="netflix">Netflix</h3>
<ul>
<li><a href="https://www.netflix.com/title/70197042">Person of Interest</a></li>
<li><a href="https://www.netflix.com/title/70266675">Transcendence</a></li>
<li><a href="https://www.netflix.com/title/70278933">Her</a></li>
</ul>
<h2 id="perspective">Perspective</h2>
<p>This is our future. There is a 50% probability that by year 2045 we will create an intelligence that will change humanity forever in ways we can’t even imagine now.</p>
<p>Change could either be uplifting us thousands of years forward or ending our civilization abruptly. We cannot stop it, we can only prepare to do it right by making sure the first AGI is what scientists and researchers call “friendly AI”.</p>
<p>Videos related to the topic:</p>
<figure class="video_container">
<iframe width="720" height="405" src="https://www.youtube.com/embed/MnT1xgZgkpk" frameborder="0" allowfullscreen=""></iframe>
</figure>
<figure class="video_container">
<iframe width="720" height="405" src="https://www.youtube.com/embed/8nt3edWLgIg" frameborder="0" allowfullscreen=""></iframe>
</figure>
<figure class="video_container">
<iframe width="720" height="405" src="https://www.youtube.com/embed/Xc2tiSH_eBg" frameborder="0" allowfullscreen=""></iframe>
</figure>
Week 45 Year 20162016-11-06T00:00:00+00:00https://zenithsal.com/updates/2016/11/06/week-45-year-2016
<p>I’m always working on something but don’t usually write about it. Since this week I updated my Jekyll blog so it works again as well as a few other weby things.. here is a compilation of what I was focusing on last week.</p>
<h2 id="static-blogweb-generators">Static Blog/Web Generators</h2>
<p>So this blog is powered by <a href="https://jekyllrb.com/">Jekyll</a> which is a static blog/web generator that is pretty straight forward and supported by github directly as it was actually developed by github developers.
The code for this website is in a normal public github repository. Using some special flags github rebuilds the website using jekyll every time I perform a new push with some changes.</p>
<p>Jekyll provides some useful tools:</p>
<ul>
<li><a href="https://jekyllrb.com/">Jekyll</a> compiler itself which can build the static website can also serve it locally for testing.</li>
<li><a href="http://kramdown.gettalong.org/">Kramdown</a> (a flavor of markdown) is used for formatting the actual content which you write directly using text, if you’ve ever edited a wiki page this is identical.</li>
<li><a href="https://shopify.github.io/liquid/">Liquid</a> is a templating script. It lets you write code directly as part of kramdown page content to generate and manipulate information without having to use javascript.</li>
</ul>
<p>While Jekyll-built websites are purely static there are ways to add dynamic content to them via services like Disqus or any social networking api.</p>
<p>There are many other solutions out there that allow generating static websites, some examples by technology:</p>
<ul>
<li>Using Ruby, <a href="https://middlemanapp.com/">Middleman</a> is more flexible, capable and complex compared to Jekyll. Better for creating websites that are more than blogs.</li>
<li>Using <a href="https://golang.org/">Go</a>, <a href="https://gohugo.io/">Hugo</a> has more features and generates sites faster so more suitable for bigger blogs.</li>
<li>Using Javascript/Node.js, <a href="https://hexo.io/">Hexo</a></li>
<li>Using Python, <a href="http://blog.getpelican.com/">Pelican</a></li>
</ul>
<p>Some great things about static website generators:</p>
<ul>
<li>Your blog/content will always exist as files so it’s very easy to reinstall website, change solution, move to another server, modify previous content, etc compared to classical server-side solutions that store data in a database.</li>
<li>Hosting is very easy, you can run your website off a dropbox, Google App Engine, AWS, classic HTML host, Heroku, Github, etc..</li>
</ul>
<p>One problem about them is that your host might upgrade the hosting toolkit which may break your blog or aspects from it. For example in this blog I used <a href="http://pygments.org/">pygments</a> to do code highlighting, that solution was removed when Github updated their Jekyll and was replaced by <a href="http://rouge.jneen.net/">rouge</a> instead.</p>
<hr />
<h2 id="javascript-is-awesome">Javascript is Awesome</h2>
<p>I’ve been interested in diving deeper into javascript for a while now, actually since I read <a href="https://www.amazon.com/Coders-Work-Reflections-Craft-Programming/dp/1430219483">Coders At Work: Reflections on the Craft of Programming</a> a few months ago. There are just so many interesting things going on in there.</p>
<p>A few javascripty things worth exploring:</p>
<ul>
<li>WebGL and engines like three.js allow us to use the GPU in our browsers. <a href="http://alteredqualia.com/xg/examples/car_zastava.html">Check this out and prepare your lower-jaw!</a></li>
<li>javascript subset <a href="http://asmjs.org/">asm.js</a> and <a href="http://kripken.github.io/emscripten-site/">Emscripten</a> toolkit gave us the ability to run Unity, Unreal, C++ code, etc in a browser.</li>
<li>Node.js for server-side applications, powers lots of the online services that we use everyday.</li>
<li>Building on top of what Node.js/asm.js/others did gave us the ability to develop actual applications for Desktop (<a href="http://electron.atom.io/">Electron</a>) and Mobile (<a href="https://cordova.apache.org/">Cordova</a>).</li>
<li>Continuous evolution of javascript driven game engines like <a href="https://github.com/photonstorm/phaser">Phaser</a></li>
<li>Ability to run javascript runtime engines honed to perfection like <a href="https://developers.google.com/v8/">Google V8</a> inside your own game engine.</li>
</ul>
<p>What developers were able to achieve using javascript in a few years is incredible. Who would’ve thought the same scripting solution that was abused to make annoying colorful gifs follow your mouse cursor would end up powering an entire OS! <a href="https://node-os.com/">node-os</a>.</p>
<hr />
<h2 id="javascript-full-stack">Javascript Full-stack</h2>
<p>I’m exploring the javascript fullstack which is powering a significant portion of our digital lives these days with the intention of using it for developing fully fledged backends for games including actually running game servers.</p>
<p>The javascript fullstack (also called <code class="language-plaintext highlighter-rouge">MEAN</code>) includes: MongoDB, Express, Angular.js, and Node.js.</p>
<p><img src="https://zenithsal.com/assets/photos/javascript_mean_flow_720.jpg" alt="js_mean_flow" title="MEAN flow" /></p>
<p>For this week I focused on Typescript and explored Angular 2 a bit.</p>
<p><a href="https://www.typescriptlang.org/">Typescript</a> is a flavor of javascript that implements most of the the ES6 standard (ECMA 2015) and designed so it can be compiled (or transpiled) into normal ES5 javascript that runs on any modern browser.</p>
<p>It adds many features and cleans up some messy things in javascript like its object oriented programming aspects, working with Typescript as a result feels a lot more straight-forward for developers who come from other languages and technologies.</p>
<p>The method I use to study new technologies is logging most of the useful information I learn into what I call a CodeBook (it started as a notebook with code-snippets but evolved into something else). CodeBooks act like memory-storage for me since my memory is pretty much done for hehe, I distill and summarise the information so that even if I don’t use the technology and many months later I needed to get back to it the information in these CodeBooks is organized in the exact same layout as my learned information and they are very short and quick compared to reading books or tutorials all over again.</p>
<p>Additionally, these CodeBooks act as an excellent resource when writing articles or researching something related.</p>
<p>For Typescript I needed to summarize the main features and differences that I’m interested in compared to javascript, so I ended up creating a single page cheatsheet that someone on the internet might find useful so here’s my Typescript Cheatsheet:</p>
<p><a href="https://zenithsal.com/assets/documents/typescript_cheatsheet.pdf"><img src="https://zenithsal.com/assets/photos/typescript_cheatsheet_thumb.jpg" /></a></p>
<p>Next I’ll be looking deeper into Angular 2, and then move on to MongoDB.</p>
<hr />
<h2 id="there-is-no-cloud">There is No Cloud!</h2>
<p><img src="https://zenithsal.com/assets/photos/thereisnocloud.jpg" alt="thereisnocloud" title="THERE IS NO CLOUD" /></p>
<p>The cloud you see, it’s just someone else’s computer.</p>
<p>A few days ago I was thinking, I should depend less on Google Drive and Dropbox since I’m close to my limit in storage and do not want to pay for it as I have many unused Gigabytes so I thought surely there is a way to run my own personal cloud storage solution and it would be cool to create the backend and frontend for that although I’d be lying if I said I can make time for that. Fortunately someone thought about that already and solved it excellently! this is <a href="https://owncloud.org/">ownCloud</a> a solution that allows you to host your own cloud service using Apache2, PHP, and MySQL (or MariaDB).</p>
<p>Perfect! I have an old Vaio laptop that I don’t use much with a mostly empty SSD and <a href="https://crunchbangplusplus.org/">Crunchbang++ (my favorite debian-based minimalist-distro)</a>, a good fiber connection, and a static IP through my ISP.</p>
<p>Took me half an evening to put everything together and it works! In addition ownCloud turned out to be a lot more than just a server, it even comes with a fully featured Desktop and Mobile apps (paid) to sync automatically with my cloud just like what dropbox and google drive do.</p>
<p>Spent some extra time setting up SSL on my new cloud. Used <a href="https://certbot.eff.org/">Let’sEncrypt Certbot</a> for that and it works very well. Setup is automatic and it configures Apache for you.</p>
<h2 id="let-there-be-git">Let there be Git</h2>
<p>Next evening I thought since I have my cloud running perfectly now, what if I take this a step further and setup my own Git hosting service?</p>
<p>Of course someone already thought about that and developed <a href="https://about.gitlab.com/">Gitlab</a> which let’s you do just that, basically run your own GitHub-like server complete with issue tracking, planning and other goodies I will probably not use.</p>
<p>A few hours later and voila! I have my git server running with unlimited repositories and more than a hundred GB shared with the cloud. However it’s running via HTTP and SSH auth. How about SSL so I don’t need SSH authentication? No dice there, Gitlab uses Nginx server internally and Certbot apparently only supports custom ports on Apache2.</p>
<p>I can still do it but truth be told I’d like to keep my cloud running on port 80. So job complete for now :)</p>
<hr />
<h2 id="fun-pocketchip-and-yay-gpu">Fun PocketCHIP and yay GPU!</h2>
<p><a href="https://getchip.com/pages/pocketchip">PocketCHIP</a> is one of those things that just talk to me.. once I saw the Ad I pre-ordered it immediately. It was delayed for 2-3 months but when it finally was in my hands, I was not disappointed!</p>
<figure class="video_container">
<iframe width="560" height="315" src="https://www.youtube.com/embed/2vPpA5DI94I" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>It’s no secret I’m a retro-games-tech enthusiast. This beauty runs on a $9 computer called <a href="https://getchip.com/">CHIP</a> with a single-core 1GHz ARM7 processor, 512MB of RAM, Mali-400 GPU, 4GB of internal memory, bluetooth/wifi, full-size USB, etc.. while the shell is ~$60 which includes an LCD, actual keyboard with metalic buttons, rechargable lithium-ion battery and a custom Debian-based mini-distro.</p>
<p>When you get the PocketCHIP it also comes with a licensed <a href="http://www.lexaloffle.com/pico-8.php">PICO-8</a> which is a beautiful integrated games platform that simulate retro hardware and is mainly based on LUA. It’s the perfect virtual platform to make games for using the pocketchip!</p>
<p>There was only one problem. Due to complications related to ARM’s policing of GPU drivers there is one big limitation. You can’t use the Mali-400 GPU because there are no drivers.. the community was trying to port its own drivers while NextThingCo team (CHIP’s makers) were also working on their own drivers with the hardware manufacturer and other interested parties. Two days ago an alpha image for PocketCHIP was released and it came with alpha GPU drivers for Mali-400 as well as a surprising new addition, a new driver for the internal device memory that unlocked the memory doubling it to 8GB instead of 4!</p>
<p>And here is a video showing pocketCHIP running Quake 3!</p>
<figure class="video_container">
<iframe width="560" height="315" src="https://www.youtube.com/embed/mjOc8ziOCZE" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
<p>And here’s me testing it:</p>
<figure class="video_container">
<iframe width="560" height="315" src="https://www.youtube.com/embed/tMNj61AT-k4" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>Awesome isn’t it! Great work and thank you NextThingCo!</p>
Mac OS X: Prologue2014-06-28T00:00:00+00:00https://zenithsal.com/hardware/2014/06/28/mac-os-x-prologue
<p><em>A word of warning: this is a very long post about nothing in particular, I just felt like writing something :)</em></p>
<h2 id="past-considerations">Past Considerations</h2>
<p>I’ve been mainly using Windows for most of my programming career starting with Windows XP. I also work on linux whenever possible but most game projects treat linux as a secondary platform to port to (if at all targeted) rather than a main platform of development so I always felt like my experience on POSIX-compliant operating systems was relatively lacking as a user and a developer due to less exposure despite a modest history of linux and open source community involvement.</p>
<p>In the past, I had a tendency to prefer expensive Windows power laptops and use them for development/gaming but I learned my lesson. Just by thinking about it I can almost feel the shoulder and neck pain from having to carry 3-4kg laptop plus accessories around for a day or several during gaming or programming events in addition to a battery that dies way too quickly for any practical work sessions. If you try to live on the bleeding edge of technology via laptops you’ll find yourself losing the fight pretty quickly (unless you own a personal bank that is). These things are non-upgradeable and get outdated fast.</p>
<p><img src="https://zenithsal.com/assets/photos/heavy_laptops.jpg" alt="heavy" title="Too Much Hardware" /></p>
<p>For stationary heavy coding, I prefer the unmatched flexibility and power of a full desktop. But I also do work on the move sometimes, for that I have a simple light 11.6″ AMD E-450 (2 cores at 1.65GHz) Windows 7 Sony Y series ultrabook for 2 years now. Its low specs and 1366x768 display resolution were only an annoyance until I tried to do some work on a big Flash project. It was very limiting and slow. For our current project at Meteoric: <a href="http://www.paragongame.com/">Paragon (a multi-platform indie space sim)</a>, it was nearly impossible to work effectively, a single code build could take up to 1 hour! I converted it to Ubuntu and tried to use it for our Linux development but I gave up within a day and preferred to develop on a virtual machine on my desktop (several orders of magnitude faster even when running 2 virtual machines).</p>
<p>So yeah, it is time to get a new work laptop!</p>
<h2 id="the-search">The Search</h2>
<p>I looked, and looked and looked. And nothing caught my eyes on the windows laptops front. For every laptop I research, there is always a deal-breaker somewhere. Too heavy; overheating; very short battery life; low build quality; bad screen; etc. In the past I might be more forgiving if the hardware was seductive enough (I’m looking at you Lenovo with core i7 Haswell and 2 SLI GPUs!).</p>
<p><a href="http://shop.lenovo.com/us/en/laptops/lenovo/y-series/y510p/#techspecs"><img src="https://zenithsal.com/assets/photos/lenovo_y510p.jpg" /></a></p>
<p>Looking for a new laptop in 2014 made it clear that the highest quality laptops are made by Apple, no doubt about it. But I kinda found MacBooks to be uninteresting in the past and that was due to me being unfamiliar with them for the most part and of course to their high cost of entry. When I was working at PeakGames we had a great developer in our team who did backend development and some front-end work too. While my workstation of choice was a core i7 beefy desktop his was a MacBook Pro. I found it fascinating that he could work effectively even when dealing with Flash IDE running in a virtual machine and he depended on the touchpad exclusively too! He is my proof that modern Macs are usable by developers in my field.</p>
<p>I decided to try. But first, I was facing the dilemma of whether to wait for the inevitable 2014 line of products or get the current 2013 refreshed generation. For that I researched Apple’s recent history and support policy of their older generations and I found it to be acceptable. They only release major upgrades to their product lines roughly once a year giving their products cycle extended lifetime and because they usually use the best hardware available the differences are incremental and small between generations, within 10% from a performance perspective. So even a 2012 MacBook is still technically very capable.</p>
<h2 id="air-vs-pro">Air vs Pro</h2>
<p>Next big question is which configuration to get, an Air or a Pro? that was a question I researched for a while and until the last second I was leaning towards a 13.3″ Air (2013). It was less expensive, its PCIe SSD and 4 threads core i5 should be sufficiently powerful for compiling/debugging large projects and my two favorite metrics: an unmatched battery life of 12 hours and at only 1.35 kg (2.96 pound) it was lighter than my old ultrabook! The only issues related to my usage are the limited non-upgradeable RAM of 4GB and the limited display resolution of 1280x800. For the RAM I had absolutely no idea how OSX memory usage is. The information I found online are mostly “you get more RAM to run more apps” kind of comments which are very subjective and don’t really provide any useful data. I know that OSX is like Linux in that it allocates as much memory as it thinks required even if most of it doesn’t end up being used by something and there is the swap factor, so it is a difficult metric to measure. I know that for a Windows 7 Home 4GB were perfectly enough for my usage, so I assumed that 1: it should also be sufficient for OSX Maverick and 2: Apple wouldn’t create a high quality product and put less RAM than it needs at the end.</p>
<p><img src="https://zenithsal.com/assets/photos/air_vs_pro.jpg" alt="airpro" /></p>
<p>The display resolution issue is more tricky. I got used to working on 1920x1080 and in fact most of the time I wish I have more space in my desktop monitor. Judging from past experience most likely 1280x800 will end up causing a huge pain especially if I’m planning to do serious amounts of work on the move in the coming months.</p>
<p>Pro on the other hand comes in 8GB and 2560x1600 Retina display, both magnificently solve the two issues I have with Air. Pro also comes with a slightly faster CPU, Don’t let the difference between Air’s 1.xGHz and Pro’s 2.xGHz fool you.. they will both throttle up to the same frequency range when heavy processing is required lowering the performance difference to 10%-15% for most practical cases. The Pro though is significantly more expensive than the Air, and frankly it’s not worth getting an entry level Pro because it matches the Air in limitations but provides less battery life (12h vs 9h) and slightly heavier (1.35 kg vs 1.5 kg).</p>
<p><img src="https://zenithsal.com/assets/photos/2560_vs_1920.jpg" alt="res_comparison" title="2560x1600 vs 1920x1080" /></p>
<p>I ended up taking the fall and shelling out the difference for an 8GB Retina Pro, but I’m keeping in mind Apple’s return policy in case I end up not finding enough justification for Pro over Air for my usage within the coming few weeks.</p>
<h2 id="first-impressions">First Impressions</h2>
<p>I’ve only had it for 2 days now but I’m already putting it under a fair amount of pressure, in fact writing this very post is nothing more than a usability stress test.</p>
<p>The RAM usage so far hovers around 4-7GB, which leads me to believe that going for the 8GB configuration was a sound decision.</p>
<p>Here are my current impressions, mostly positive for now:</p>
<ul>
<li>App icons sparkle in launchpad after they get updated.</li>
<li>Everything is silky smooth! 8D</li>
<li>Retina display includes an extremely useful feature, ability to scale view to get more space when needed up to maximum native resolution. That means for many window applications like any IDE really it’s possible to just up the display and instantly get more space. I wish my desktop monitor had something like that.</li>
<li>There are many differences in how keyboard works, nothing too annoying so far. Keyboard is physically excellent.</li>
<li>Touchpad is extremely accurate compared to the vaio touchpad and its fully clickable surface is more useful than I thought! dragging is a breeze.</li>
<li>It’s shocking how sturdy the palm wrest areas feel in comparison, the unibody really shines here I think.</li>
<li>Mac OSX comes with a LOT of useful software. Including stuff that make me very happy like Python and Ruby.</li>
<li>After installing brew, jekyll via gem, building latest ninja from source and then using that to build TextMate2 (which is what I’m using now to write this), the Linux vibe tickles my heart.</li>
<li>The magnetic charger makes the nerd in me very happy.</li>
<li>App icons sparkle in launchpad after they get updated.</li>
</ul>
<p>And the few negatives:</p>
<ul>
<li>Some Apple software feels a bit too intrusive for my taste.</li>
<li>My USB wireless mouse doesn’t work directly, probably requires some special drivers.</li>
</ul>
<p>That’s it, I’ll wrap this post here before I end up writing a book.</p>
<p>To be continued once I start getting some serious compiling/debugging done.</p>
<p><img src="https://zenithsal.com/assets/photos/pc_vs_mac.jpg" alt="pcmac" /></p>
Zenithia update - Rev 632013-10-07T00:00:00+00:00https://zenithsal.com/zenithia/2013/10/07/zenithia-update---rev-63
<p>Just a quick screenshot showing some progress:</p>
<p><img src="https://zenithsal.com/assets/screenshots/zenithia/zenithia_7102013_1.jpg" alt="Basic lighting shaders" /></p>
<p>I implemented a common shader library and 3 basic effects using shader model 3 and fx effects:</p>
<ul>
<li>Basic per-vertex lighting: ambient, diffuse, specular, and emissive lighting. Shader supports 1 point light and/or 1 directional light per-pass.</li>
<li>Basic per-pixel: same lighting equation but calculated per-pixel.</li>
<li>Wireframe shader for gizmo rendering.</li>
</ul>
<p>I also added basic camera and lights scene node objects.</p>
Zenithia update - Rev 572013-09-30T00:00:00+00:00https://zenithsal.com/zenithia/2013/09/30/zenithia-update-rev-57
<p>Today I worked on the mesh parsing section of Zenithia and got a basic scene-graph up and running that supports multiple nodes, meshes, subsets, and basic materials. The screenshot below is from a collada model exported from blender that includes multiple nodes, meshes, subsets, and textures.</p>
<p>The model is rendered using a simple fx effect and all resources are loaded in the resource thread and swapped to the scene at runtime by the resource system.</p>
<p><img src="https://zenithsal.com/assets/screenshots/zenithia/zenithia_3092013_1.jpg" alt="Collada Mesh Rendering" /></p>
<p>I also added a basic logic component to the list of components in Zenithia now, as its name implies any scene-node logic should go there as well as setting custom effect constants. Standard effect constants like transformation is set by the scene-graph automatically.</p>
Assets in Zenithia2013-09-29T00:00:00+00:00https://zenithsal.com/zenithia/2013/09/29/assets-in-zenithia
<p>Dealing with resources is one of the most complex aspects of a graphics/game framework, this is due to the fact that:</p>
<ul>
<li>there are a lot of resource types each could be using a different format.</li>
<li>some resources involve complex relatively expensive parsing.</li>
<li>some resource types need to be associated directly with a device object, and that introduces several caveats.</li>
</ul>
<p>I wanted Zenithia to be a streaming-based framework, so basically what I do is load all data from disk without blocking the main thread.</p>
<p>At the moment Zenithia follows this pattern to load resources:</p>
<ul>
<li>Resource system creates resource and calls resource.prepare() function in the main thread.</li>
<li>Resource system adds the resource to the task queue of the resource thread.</li>
<li>Resource thread calls resource.loadData() which will actually read all data from disk in the resource thread, this must not involve any device object access since Direct3D9 is tied directly to the creator thread (the main thread in this case) but Direct3D11 supports loading and creating objects in a secondary thread, so a lot of refactoring may takeplace later on to make use of that.</li>
<li>Resource system is notified when loading data is finished</li>
<li>Resource system calls resource.finalize()</li>
</ul>
<p>But this introduces a problem, what happens if the application tries to use a resource before its loading is finished?</p>
<p>At the moment my solution is very basic: each resource type generates a placeholder resource when resource.prepare() is called which makes the resource valid to be used immediately by any element in the framework. When resource.finalize() is called I interchange the placeholders with the actual loaded objects.</p>
<p>There could be a lot more involved and practical solutions, simplest is probably preloading a low-resolution version of the resource being created and using that as a placeholder until the actual resource is loaded. For example if it’s an in-game model then it would make sense to preload low resolution textures and meshes involved in addition to collision and physics information. I believe this is the exact process UnrealEngine3 uses except they load multiple resources concurrently and have a much more involved system for generating placeholders.</p>
Jekyll.. is cool!2013-09-18T00:00:00+00:00https://zenithsal.com/webdev/2013/09/18/jekyll-is-cool
<p>For the last two days, I’ve been looking at several solutions to setup a blog for this site, from blogging services like Wordpress.com and Blogger to fully fledged CMS-like solutions running on one of the many cloud-based platforms available today, I setup several blogs in the process to test and get a feel for it.</p>
<p>The solution that satisfies my needs without paying truckloads of money was Wordpress running on my own server rather than someone elses, and it works great! but Wordpress still doesn’t feel like a blog I would update frequently, something is missing.</p>
<p>While I was setting something up on GitHub I noticed a service called <a href="http://pages.github.com/">“GitHub pages”</a> a hosting service for static sites with the ability to set a custom domain and use the excellent github service for storing and modifying the actual files, then I found Jekyll.. and I immediately knew this is what I was looking for!</p>
<p><a href="http://jekyllrb.com/">Jekyll</a> is a blog-aware, static site generator in Ruby that is tied directly to GitHub services, Tom Preston-Werner (GitHub staff) wrote it for his personal usage and then it transformed into a broader solution with the help of the community.</p>
<p>Here is how it works basically: you create a set of text files that use multiple minimal scripting solutions like FrontMatter and MarkDown to write content. You then run Jekyll on these text files to build the actual HTML site.</p>
<p>The secret that makes Jekyll work is the amazing git and github hosting service. Adding modifying and building changes into the site can happen very fast because the whole process is ASCII-text only and straight forward especially if you like working with git.</p>
<p>The first issue I ran into after I setup Jekyll on my machine was that there is no notion of a home page in the themes that you can find for Jekyll including the standard theme.</p>
<p>I noticed that most developers that use the service set the archive page as their homepage, which is not what I wanted to do. I wanted the homepage to be a list of the latest created blog posts.</p>
<p>After a couple of hours of meddling with Liquid (the template scripting solution used by Jekyll/github) and Jekyll’s layout system, I managed to get it working! Added a new layout type called “home” that displays the latest 5 posts. However I have yet to figure out how to browse all posts in sets of 5, Liquid doesn’t provide access to URL parameters which might’ve been enough to solve the problem, one possible solution is implementing it completely client-side and that might require modifications to Jekyll so it generates a special set of files that are then parsed by javascript/browser.</p>
<p>Consequently, the main drawback is of course the lack of any kind of server-side functionality, databases are not very important anymore with the existence of incredibly capable social networks and services like disqus.</p>
<p>Just.. one more homepage feature before I push this post… :-)</p>
Introducing Zenithia2013-09-18T00:00:00+00:00https://zenithsal.com/zenithia/2013/09/18/introducing-zenithia
<h3 id="what-is-zenithia">What is Zenithia?</h3>
<p>Zenithia is a Direct3D 9/11 framework that I’m currently developing using C/C++. The scope of the framework is unknown at the moment as I’m developing it specifically to develop and demonstrate my C/C++ and graphics programming abilities.</p>
<h3 id="where-is-it">Where is it?</h3>
<p><a href="https://bitbucket.org/Salwan/zenithia-git/src/master/">Here in BitBucket</a></p>
<h3 id="design-philosophy">Design philosophy</h3>
<p>Zenithia’s main objective is to simplify and structure Direct3D API functionality providing a higher polished and practical interface for demos and games.</p>
<p>Overtime I’m planning to write more complex systems in Zenithia like: scenegraph, physics, and scripting.</p>
<p>The basic principles I’m following are:</p>
<ul>
<li>KISS (keep it stupidly simple)</li>
<li>YAGNI (you ain’t gonna need it)</li>
<li>Continuous refactoring</li>
</ul>
<h3 id="tools">Tools</h3>
<ul>
<li>Visual Studio 2010, C/C++</li>
<li>DirectX SDK/PIX</li>
<li>NVIDIA Fx Composer 2.5 and HLSL/fx for shader development</li>
</ul>
<h3 id="planned-features">Planned Features</h3>
<ul>
<li>Direct3D9 pipeline</li>
<li>Direct3D11 pipeline</li>
<li>Effects system</li>
<li>Input system</li>
<li>Collada parsing support</li>
<li>Character animation system</li>
<li>Scenegraph</li>
<li>Google V8 scripting</li>
<li>Bullet physics integration</li>
<li>Multi-threaded resource system</li>
<li>DirectCompute system</li>
<li>Audio system</li>
</ul>
<h3 id="demonstration">Demonstration</h3>
<p>The following code creates a vertex/index buffer, sets and checks input, creates an effect, then renders all:</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include <Zenithia.h>
</span>
<span class="n">ZManualMesh</span> <span class="n">mesh</span><span class="p">;</span>
<span class="n">mesh</span><span class="p">.</span><span class="n">createSubset</span><span class="p">();</span>
<span class="c1">// Vertex declaration</span>
<span class="n">ZVertexDeclaration</span><span class="o">&</span> <span class="n">vertex_declaration</span> <span class="o">=</span> <span class="n">mesh</span><span class="p">.</span><span class="n">getVertexDeclaration</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
<span class="n">vertex_declaration</span><span class="p">.</span><span class="n">pushElement</span><span class="p">(</span><span class="o">::</span><span class="n">VERTEXDECL_FLOAT4</span><span class="p">,</span> <span class="o">::</span><span class="n">VERTEXDECLUSAGE_POSITION</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
<span class="n">vertex_declaration</span><span class="p">.</span><span class="n">pushElement</span><span class="p">(</span><span class="o">::</span><span class="n">VERTEXDECL_FLOAT4</span><span class="p">,</span> <span class="o">::</span><span class="n">VERTEXDECLUSAGE_NORMAL</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
<span class="n">vertex_declaration</span><span class="p">.</span><span class="n">pushElement</span><span class="p">(</span><span class="o">::</span><span class="n">VERTEXDECL_FLOAT2</span><span class="p">,</span> <span class="o">::</span><span class="n">VERTEXDECLUSAGE_TEXCOORD</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
<span class="n">vertex_declaration</span><span class="p">.</span><span class="n">pushEndElement</span><span class="p">();</span>
<span class="c1">// Vertex buffer</span>
<span class="n">ZVertexBuffer</span><span class="o">&</span> <span class="n">vertex_buffer</span> <span class="o">=</span> <span class="n">mesh</span><span class="p">.</span><span class="n">getVertexBuffer</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
<span class="c1">// Create vertex buffer with 4 vertices</span>
<span class="n">vertex_buffer</span><span class="p">.</span><span class="n">create</span><span class="p">(</span><span class="n">vertex_declaration</span><span class="p">,</span> <span class="mi">4</span><span class="p">);</span>
<span class="c1">// Fill vertex buffer with data</span>
<span class="n">vertex_buffer</span><span class="p">.</span><span class="n">writeElements</span><span class="o"><</span><span class="n">D3DXVECTOR4</span><span class="o">></span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">vertex_positions_array</span><span class="p">,</span> <span class="mi">4</span><span class="p">);</span>
<span class="n">vertex_buffer</span><span class="p">.</span><span class="n">writeElements</span><span class="o"><</span><span class="n">D3DXVECTOR4</span><span class="o">></span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">vertex_normals_array</span><span class="p">,</span> <span class="mi">4</span><span class="p">);</span>
<span class="n">vertex_buffer</span><span class="p">.</span><span class="n">writeElements</span><span class="o"><</span><span class="n">D3DXVECTOR2</span><span class="o">></span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">vertex_texcoords_array</span><span class="p">,</span> <span class="mi">4</span><span class="p">);</span>
<span class="c1">// or fill all in one call using a vertex array</span>
<span class="n">vertex_buffer</span><span class="p">.</span><span class="n">writeVertices</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">vertex_data</span><span class="p">,</span> <span class="mi">4</span><span class="p">);</span>
<span class="c1">// Index buffer</span>
<span class="n">ZIndexBuffer</span><span class="o">&</span> <span class="n">index_buffer</span> <span class="o">=</span> <span class="n">mesh</span><span class="p">.</span><span class="n">getIndexBuffer</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
<span class="c1">// Create index buffer with 6 indices</span>
<span class="n">index_buffer</span><span class="p">.</span><span class="n">create</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span>
<span class="c1">// Fill index buffer with data</span>
<span class="n">index_buffer</span><span class="p">.</span><span class="n">writeIndices</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">index_array</span><span class="p">,</span> <span class="mi">6</span><span class="p">);</span>
<span class="c1">// Setup Input</span>
<span class="n">ZInput</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-></span><span class="n">mapKeyToAction</span><span class="p">(</span><span class="n">select_action_id</span><span class="p">,</span> <span class="n">KEYBOARD_ENTER</span><span class="p">,</span> <span class="n">ZINPUT_HIT</span><span class="p">);</span>
<span class="n">ZInput</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-></span><span class="n">mapKeyToAction</span><span class="p">(</span><span class="n">charge_action_id</span><span class="p">,</span> <span class="n">KEYBOARD_SPACE</span><span class="p">,</span> <span class="n">ZINPUT_HELD</span><span class="p">);</span>
<span class="n">ZInput</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-></span><span class="n">mapKeyToAction</span><span class="p">(</span><span class="n">exit_action_id</span><span class="p">,</span> <span class="n">KEYBOARD_ESCAPE</span><span class="p">,</span> <span class="n">ZINPUT_RELEASED</span><span class="p">);</span>
<span class="c1">// Check for input</span>
<span class="n">ZInput</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-></span><span class="n">process</span><span class="p">();</span>
<span class="k">if</span><span class="p">(</span><span class="n">ZInput</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-></span><span class="n">getActionState</span><span class="p">(</span><span class="n">exit_action_id</span><span class="p">))</span> <span class="p">{</span>
<span class="c1">// Exit</span>
<span class="p">}</span>
<span class="c1">// Effect</span>
<span class="n">ZEffect</span> <span class="n">effect</span><span class="p">;</span>
<span class="n">effect</span><span class="p">.</span><span class="n">loadFromFile</span><span class="p">(</span><span class="s">"assets/effect.fx"</span><span class="p">);</span>
<span class="c1">// Render everything</span>
<span class="n">D3DXMATRIX</span> <span class="n">matViewProjection</span> <span class="o">=</span> <span class="n">matWorld</span> <span class="o">*</span> <span class="n">matView</span> <span class="o">*</span> <span class="n">matProj</span><span class="p">;</span>
<span class="n">ZTexture</span> <span class="nf">diffuse_texture</span><span class="p">(</span><span class="s">"diffuse_texture.jpg"</span><span class="p">);</span>
<span class="c1">// Set shader constants</span>
<span class="n">effect</span><span class="p">(</span><span class="s">"matViewProjection"</span><span class="p">)</span> <span class="o">=</span> <span class="n">matViewProjection</span><span class="p">;</span>
<span class="n">effect</span><span class="p">(</span><span class="s">"texDiffuse"</span><span class="p">)</span> <span class="o">=</span> <span class="n">diffuse_texture</span><span class="p">;</span>
<span class="c1">// framework activates a valid technique</span>
<span class="n">effect</span><span class="p">.</span><span class="n">beginTechnique</span><span class="p">();</span>
<span class="k">while</span><span class="p">(</span><span class="n">effect</span><span class="p">.</span><span class="n">nextPass</span><span class="p">())</span> <span class="p">{</span>
<span class="c1">// draws for each pass in technique</span>
<span class="n">mesh</span><span class="p">.</span><span class="n">drawSubset</span><span class="p">(</span><span class="n">d3ddevice</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">effect</span><span class="p">.</span><span class="n">endTechnique</span><span class="p">();</span>
</code></pre></div></div>
It's been awhile :-)2013-07-23T00:00:00+00:00https://zenithsal.com/life/2013/07/23/its-been-a-while
<p><strong>This post is migrated here from my 2013 blog</strong></p>
<p>Exactly 1 year and 13 days since my last post here, here’s an extremely brief overview of what happened in a year:</p>
<ul>
<li>Left Small World Interactive and Egypt</li>
<li>Moved to Istanbul, Turkey and joined PeakGames (Flash/Actionscript3)</li>
<li>Made a lot of great friends</li>
<li>Crazy work hours (from 9am to 7pm) didn’t leave me much for anything, but the weekends of 2 days were awesome! I spent them all away from computers exploring nature and Turkey, I saw and did things I only experienced in my dreams :-)</li>
<li>Met an amazing girlfriend, spent a few incredible months together.</li>
<li>Girlfriend went home</li>
<li>Left PeakGames</li>
</ul>
<p><img src="https://zenithsal.com/assets/photos/tumblr/been-a-while.jpg" alt="Good days" title="Miss you all <3" /></p>
<p>So now, I’m exactly where I started a year ago, except with a little more money, experience, and a lot of amazing memories. These days I’m searching for a great job, somewhere outside Turkey where there is a competitive games industry and gamedev events.</p>
<p>Meanwhile, I’m back home in Istanbul going back to my roots.. to beautiful C/C++ working on Zenithia my Direct3D9 soon to be Direct3D11 framework, and I’m more inspired and driven than ever!</p>
<p>My near future is unknown, but I know it’ll somehow end up being awesome not so far ahead from now.</p>
<p>Happy Coding!</p>
Introducing Project Mystic2012-06-10T00:00:00+00:00https://zenithsal.com/gamedev/2012/06/10/introducing-mystic
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>Mystic is a new personal demo game project I’m working on, it’s supposed to be a multiplayer co-op variant of a space shooter, the exact details of gameplay are still not yet defined, but I already put a bunch of hours into it.</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/mystic-1.jpg" alt="mystic" /></p>
<p>p.s. Mystic is the project code name, the actual name of the game is going to be different.</p>
<p>The highlight features of Mystic are going to be:</p>
<ul>
<li>Multiplayer co-op gameplay, 1-4 players</li>
<li>Facebook integration</li>
<li>Player matching/game lobbies</li>
<li>Flash, shader-driven via Stage3D and AGAL</li>
</ul>
<p>Technically, my implementation is going to be:</p>
<ul>
<li>Design: fully iterative, I start with a rough idea and build gameplay experiments around it, keep what’s fun ditch what’s not, until I have a solid mechanic to build a game around and extend.</li>
<li>Platform: Flash 11+ and Stage3D with AGAL. Frankly I would go the Unity3D route if I had access to fullscreen shader-driven effects (or at least low-level access to render-to-texture), but the free version doesn’t allow either and I can’t afford the pro version for a mere experiment.</li>
<li>Shaders: AGAL, however by the time I start writing serious shaders I’ll look for a higher-level alternative, otherwise it may be worth it to do a CG assembly to AGAL converter (if that’s possible at all) and a few utility pythons to automate the process.</li>
<li>Graphics: 2D running on GPU with advanced shader effects (motion blur, lighting, particles, etc..), it should retain the soul of retro but looks and feels quite modern at the same time. I might go for something kinda like what Ethanon does: <a href="https://www.youtube.com/watch?v=Xmn6zhDJGLE">http://www.youtube.com/watch?v=Xmn6zhDJGLE</a></li>
<li>At first, I considered writing my own game framework on top of Stage3D, but then I discovered Starling and the fact it already includes most of what I had in mind like batch rendering and texture atlas support. But it lacks a main feature I need: shader functionality, by display object and fullscreen, so I have to add support for that myself, would still take a lot less time than if I started from scratch. Did I mention that Starling is open source? ^_^</li>
<li>Networking: this is still not very clear at the moment since the gameplay mechanics are not defined yet, my first choice would be Player.io but if I require high-frequency low-latency updates (aka UDP) <a href="https://playerio.com/">Player.io</a> might not be an ideal solution since it only supports TCP and apparently a maximum of 10 messages per second (100ms minimum latency) (<a href="http://playerio.com/forum/multiplayer/any-plans-for-udp-t34074">related discussion</a>). I might investigate other solutions like Heroku (if it’s capable of something like this at all), or perhaps directly running the server on a rented host. The problem here is that changing the server might mean changing the solution entirely, so if I picked something unsuitable and then wanted to switch to something else in the middle, I’ll probably have to rewrite the server-side from scratch.</li>
</ul>
<p>Goals:</p>
<ul>
<li>Creating an awesome game of course ;)</li>
<li>This would be my first personal multiplayer game, and first time doing motion prediction and latency compensation.</li>
<li>Adding full support for Facebook and Server/Client communication to my Actionscript 3 library.</li>
</ul>
<p>CODE NAW!</p>
Secon Month!.. wait what2012-05-01T00:00:00+00:00https://zenithsal.com/life/2012/05/01/second-month-wait-what
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>How… did this happen? its only been a month 0_o I felt like it was 6 months, which tells me I should probably party more often hehe.. but with who? its getting lonelier :(</p>
<p>I am somehow back to working on Flash games, and I don’t even see Unity that much these days, I dig Flash… really… my actionscript 3 library is awesome and I’m constantly developing it, the last major addition was a mini retro game engine which I appropriately called “Retro” (I know I know, I’m very creative), other than that during the last few days I paid a visit to the hellish part that handles automatic pausing/resuming and muting of everything while playing well with Flash events, Tweener, Input, Sound, Flint particles, etc… and it didn’t smell good at all. Furthermore, these days, I’m haunted by this insane desire… to remake Volguard! one of my favorite games on my first BASIC only iraqi-made computer, the good ol’ Warkaa.</p>
<p>An artist friend of mine said that obsessed programmers are haunted by their work, they walk around while thinking about it, they sleep while thinking about it, they even answer nature’s variety of calls while thinking about it (which tends to be a very meditative problem solving environment, I tell ya).. at that time I strongly denied what he said and made a cocky comment about how I can put work in the back of my head when I want to, but I left out the fact I don’t <em>always</em> <em>necessarily</em> want to do that, heh.</p>
<p>As for life itself.. what life? <em>scratches-head</em> I’m trying to put things back in order, but things just keep jumping back out… lol, what a mess.</p>
<p>The hardest thing I’m facing now is this new type of loneliness, I got lots of friends around me everywhere, but I can only communicate with them using a language/accent that’s either alien to me or alien to them, ensuring that any communication we have can only belong to the small-talk island, lacking depth and substance.. I’m hoping this will get better with time.</p>
First Month!2012-03-30T00:00:00+00:00https://zenithsal.com/life/2012/03/30/first-month
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>Yesterday was the last workday of my first month at Small World Interactive, so much stuff happened in the last few weeks, I met a lot of interesting people and made many new friends everywhere. I’m a little drained and low energy but I’m hoping it’ll get better in the next few days once I settle in my new place.</p>
<p>Life as a student had a much slower rate, it was very predictable and forgiving. Now it kinda feels like a jungle! I experience so many unknowns every single week and don’t really have time to slow down and process.. but I’m trying to enjoy this new life-style to the fullest, and I bet once I get used to it it’s not gonna feel chaotic anymore.</p>
<p>Yesterday, I went out to celebrate the end of the first month and I had lots of fun even though I was basically in zombie mode most of the time. I also had to say goodbye to two friends I know I’ll miss, and I really hate goodbyes… it’s like you are connected to someone by a thread and that thread suddenly snaps, leaving emptiness and memories behind.</p>
<p>On the technical front, Unity is awesome (of course) but it’s making me miss the flexibility I got used to in lower level solutions,.. and I’m also missing writing serious code, as in writing crafty complex code the whole day to do weird stuff only developers understand? I’m kinda becoming more design/rendering centric, I got shaderz in mah bloodstream baby :D</p>
<p>Cobalt FTW!</p>
<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/29142275&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe>
Globus - Diem Ex Dei2012-03-09T00:00:00+00:00https://zenithsal.com/music/2012/03/09/globus-diem-ex-dei
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/KjPuiabqFcc" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>Epic.</p>
First Weekend2012-03-09T00:00:00+00:00https://zenithsal.com/life/2012/03/09/first-weekend
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>Remember that interview I did under the influence of food poisoning? turns out I did great even though I don’t remember much of what happened :D</p>
<p>So you are now looking at the new Game Developer (aka. teh new guy) at <a href="https://www.linkedin.com/company/small-world-interactive/about/">Small World Interactive</a>, still under evaluation so my job description will be specified at a later time. But this means my plans to leave Egypt are taking a backseat now, and frankly I only wanted to leave so I could work in my field of choice since my options were very limited here.</p>
<p>Today happens to be my first weekend! and I’ve been having too much fun working in the last few days, at one point I coded an experimental anti-cheat patch and watched a capable hacker try to break-in using things as crazy as assembly and not be able to! my grin was epic and every time the thing crashes I’d high-five someone in the background.</p>
<p>I’m also going to move to Dokki (Cairo) probably in the next few days to be within walking distance from where I work, so goodbye 6th of October.. I’ll surely miss your empty quiet neighborhoods and great diverse restaurants.</p>
<p>Rock On!</p>
Aah Life..2012-03-02T00:00:00+00:00https://zenithsal.com/life/2012/03/02/aah-life
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>So a week ago, I drank a cup of hot chocolate made with a month old bad milk by mistake.. and I only realized how awful it tastes past half the cup.. I put it down and looked at the cup staring back at me with an evil smile and said: oh yeah? I’m shaking.. I’m shaking</p>
<p>That was a week ago, I couldn’t sleep an hour for the last 5 days, I’m dizzy and nauseas the whole day, and I’m taking 5 different pills that all do weird stuff and have long names I can’t pronounce. There are also some extremely weird symptoms, like 3 days ago I was trying to sleep for 6 hours uselessly.. I got up from bed and I was really dizzy and can’t focus my eyes! I saw everything in 2 I think I was cross-eyed for like an hour… or was that a nightmare? I really can’t tell anymore.</p>
<p>Just a short while ago, I actually managed to sleep for an entire 2 hours, hurray! I also had a dream that was not a nightmare at all, in one part people would fall on each other and roll like a ball that grows with more people as it goes (including yours truly), until they hit a wall, and every time I hit a wall, it felt so painful.. then I just get up and see everyone died and go like: I’m not dead because I workout everyday! <em>grin</em> lol</p>
<p>Then I totally got a camera-man, a mic, and ran around the streets asking people: “Do you think uncommented code is bad?” and I picked the best people to answer that question: an old homeless man and a drunk party girl, among others</p>
<p>that’s one multipart nightmare I will not soon forget… also my first nightmare with a sense of humor hehe</p>
<p>To top it all? I had a job interview that I had to go to right in the middle of this, sleep deprived and barely alive.</p>
<p>Life is good</p>
ٌReview Over!2012-02-26T00:00:00+00:00https://zenithsal.com/life/2012/02/26/review-over
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>Well, it has been a very productive month, I successfully reviewed most of the relevant knowledge to my current professional direction diving in deeper and filling what gaps I have in these subjects:</p>
<ul>
<li>Trigonometry</li>
<li>Calculus</li>
<li>Linear Algebra</li>
<li>C/C++</li>
<li>STL</li>
<li>Data Structures</li>
<li>Boost</li>
<li>Memory operations</li>
<li>Modularity</li>
<li>Portability</li>
<li>Multithreading principles and patterns</li>
<li>Windows API</li>
<li>Direct3D9</li>
</ul>
<p>On the code front, I did some work on Zamron based on the beta feedback I got via FGL (Flash Game License, a dead website for selling Flash games to publishers) but I’m going too slow.. I’ll probably give it a little more focus this month, and I’ve also been writing a Windows API/Direct3D9 framework that I’ll be using and developing iteratively for my demos, today I’m implementing the Mesh class (D3DXMESH is mostly obsolete, completely removed in D3D11), handling window resizing and device lost state, and writing a Camera class.</p>
<p>There will probably be a light weight scene graph in my near future along with a mandatory resource manager to sort out the mess, but I’ll only write those when I have practical use cases for them.</p>
<p>My first demo is going to be some basic fixed function pipeline thing that makes use of as many ffp features as possible: Texturing/Multitexturing, Blending, Stencils (planar shadow and mirrors), particles, and maybe some basic terrain rendering. The point is to prepare the framework for the shader heavy lifting that’s imminent.</p>
<p>For this new month I’m going to dive into rendering/graphics techniques and algorithms starting from Shader Model 2 generation and taking it from there.</p>
<p>Happy Coding Everyone! :D</p>
Crossroads2012-02-09T00:00:00+00:00https://zenithsal.com/life/2012/02/09/crossroads
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>Zamron my first big-ish indie game is finished! there are still a few tweaks here and there to do after I gather enough feedback from helpful first players, other than that it’s finished.</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/zamron-2.jpg" alt="Zamron in-game screenshot" /></p>
<p>Zamron (though may suck :D) is very important for me because I wanted to prove to myself that I can make a complete reasonably sized game from scratch and finish it alone doing everything from concept, development, art, and even the little sounds and music I have in there. In the past my personal games were mostly either too small, too ambitious for a single developer, or just a remake of something.</p>
<p>Now the big question is: what to do next? .. since I’m free from University now, only imagination (and my iraqi passport) are the limits, it even crossed my mind that I stick to flash indie games but make smaller highly polished games to generate a good income, meanwhile I move to live in <a href="https://en.wikipedia.org/wiki/Sharm_El_Sheikh">Sharm El-Sheik</a> or <a href="https://en.wikipedia.org/wiki/Hurghada">Hurghada</a> or something, take an apartment next to the sea and code wearing only shorts everyday on the beach :D It’s a dream? actually it’s very possible and I know of a few indie developers who chose to live and work like that, some even travel the world while they develop their games. That’s why the lifestyle of an independent game developer is so damn attractive, freedom! :)</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/beachcoding.jpg" alt="Beachcoding" /></p>
<p>beachcoding like a BOSS XD</p>
<p>But wait, there are many not so great facts about staying in Egypt as an indie, besides the fact it’s unstable economically and politically these days.. the whole environment is hostile to indies: absolutely no community and no support, no access to online services like kickstarter or paypal (paypal just blocks my account and freezes what’s in it once I access it from Egypt), and because of my iraqi passport I can’t even leave Egypt to anywhere unless I have a “serious” visa (like the filthy rich man visa).. so I can’t travel to indie festivals/conferences/jams/gatherings even if I want to and can afford to, though truth be told I haven’t tried anything like that yet so I’m not sure of its impossibility.</p>
<p>So now I’m ruling out indie game development as a full time career at this stage, my best option is to get back to my roots of native development, good old C++.. review what I know, tie the loose ends, and learn as much new stuff as possible, and then apply for a job in the industry when I’m comfortable enough. I’m no noob in C++ or low level graphics, my collective experience is worth nearly 4 years distributed between studying realtime graphics via Direct3D, doing contract visualizations for education institutes, working on a few personal and community projects, writing a few articles, and eventually working for a few months on an XBOX360 title.</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/collision-prevention-1.jpg" alt="Collision Prevention at Sea" /></p>
<p>[Visualization for Collision Prevention at Sea rules - contract 2007 - C/C++ and Ogre3D]</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/lang-lab-1.jpg" alt="Virtual Learning Lab" /></p>
<p>[Virtual Learning Lab Server, a virtual language teaching lab - contract 2006 - C/C++, Win32 API, and DirectPlay8 for networking]</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/reflection.jpg" alt="Zamron in-game screenshot" /></p>
<p>[Stencil reflection, a very old sample (2004!!!) - C/C++ and Direct3D9b :D]</p>
<p>Ugly stuff mostly hehe… I just really regret not keeping a single screenshot from the XBOX360 game I worked on at Timeline Interactive, it was very prettyh.. 8D</p>
<p>So the decision is, no more indie games and no more Flash.. from now on and for at least a whole year I’m to strictly concentrate on C/C++ and my specialty of choice and the jobs I want to apply for (got a bunch already). And I have a promising interview this month with an awesome game studio anyway so it all just comes together nicely.. I’m SOOO INSPIRED and motivated it’s CRAZY! Expect my awesomeness to start showing up next month in the form of modern graphics demos as part of my 2012 portfolio ;)</p>
<p>Stay awesome everyone! \o/</p>
The future of the games industry2012-02-01T00:00:00+00:00https://zenithsal.com/gamedev/2012/02/01/future-of-games-industry
<p><strong>This post is migrated here from my 2012 blog</strong></p>
<p>Attention spans continue to get shorter, apps start selling for 10 cents, AAA game teams get bigger, but the single player game gets smaller, all become subscription based.</p>
<p>Everyone on the planet with access to electricity releases an indie game, each game sells one copy to the authors mum. (LOL)</p>
<p>PS4 comes out, it’s an uzi with hdmi output, only plays ww2 fps shooters.</p>
<p>Zynga buys EA and Activision, WOW becomes a point and click mystery detective game on facebook, fifa actually gets better.</p>
<p>The internet starts broadcasting adverts every 7 minutes simultaneously world wide, but tailored to your search history, google starts selling premium advertless internet subscriptions.</p>
<p>Google/Apple/MS/Zynga merge, release chip that bolts into your head to replace reality.</p>
<p>Lion Head ship a game where you really can do anything.</p>
<p>Excerpt from: <a href="http://altdev.co/2011/06/06/the-games-industry-a-25-year-postmortem/">The games Industry a 25 year postmortem by Mike Diskett</a></p>
Happy New Year 2012 Everyone2011-12-31T00:00:00+00:00https://zenithsal.com/life/2011/12/31/happy-new-year-2012
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/aSq1cez_flQ" frameborder="0" allowfullscreen=""></iframe>
</figure>
Ludum Dare 22 - Competition Ends - Aftermath2011-12-19T00:00:00+00:00https://zenithsal.com/gamedev/2011/12/19/ludum-dare-22-aftermath
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>This LD is more awesome than the one before it even though I didn’t think beating LD21 was possible, until now there are <a href="http://ludumdare.com/compo/ludum-dare-22/?action=preview">over 700 games</a> made in 48 hours around the theme ‘Alone’! that’s just impressive.. its gotta be a world record.</p>
<p>As I’m checking the games now, I’m finding truly wonderful games, and since the theme ‘Alone’ is rather abstract, the ideas vary widely.. yes you can still find many generic side-scrollers, but also many innovative stylish games built around a deep concept.</p>
<p>Like for example, how about <a href="http://ludumdare.com/compo/ludum-dare-22/?action=preview&uid=2952">a lonely soccer player fighting aliens with a soccer ball? check</a> :D</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/ld22-1.png" alt="Final Trip Soccer" /></p>
<p>Well, how about my entry? … hmph… I actually failed :’(</p>
<p>Here’s how it went:</p>
<p>“Alone” is tricky to design a game around, and I never was one to go with just another generic game so I spent around 4 hours trying to come up with a good concept, by the end I had 6 different concepts, and non but one was actually something I’d like to play myself.</p>
<p>And even though I set out with the intention of doing something minimalist and compact, the concept I liked was very not like that.. I don’t know why I resist doing simple things that much, well I think I know but we’ll get to that later.</p>
<p>The concept I went with is for a game about standing alone in protest for your rights which eventually will lead to a revolution, that’s a scary concept hehe</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/ld22-2.jpg" alt="PROTEST" /></p>
<p>I went for limiting the artwork in hopes that it will make art creation go faster, the resolution was 320x200 scaled 2.5 times to fill 800x500 swf size, and I’m restricted to use 16 colors only (Inspired by EGA era displays).</p>
<p>I got two different possible art styles, I went with the one on the left of course:</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/ld22-3.png" alt="Concept 1" /></p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/ld22-4.png" alt="Concept 2" /></p>
<p>Because it’s a bit detailed for a 48 hours game, I thought I should only do the man animation, trying my hand at animating this took me some time of trial and error:</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/ld22-5.gif" alt="Running Player" /></p>
<p>No hands! yes well, the hands have their own separate animation, this way you can hold protest slogans, shield your face, throw a rock or something, while running :D</p>
<p>Then I started working on the game mechanics, during each protest you have to actually clash with the riot police for territory control, handling tear gas and water cannons etc.. while protecting and helping your fellow protesters who chose to stand beside you and fight for the same cause. I decided to include support for both Arabic and English, and to only concentrate on the main components because again the concept is too big.</p>
<p>I don’t check the news often, for whatever reason I thought I should see what’s going on while having dinner.. and I saw what’s going on in Egypt these last few days and I didn’t like where things are going. That put me in a situation, since I’m a non-egyptian living in Egypt at the moment, doing a game like this now might not be a great idea even if it’s not meant to be specifically about Egypt rather about protesting and peaceful revolution in general, so I suddenly got really demotivated and finally decided to just stop and leave this thing for a more suitable time. I really dislike getting mixed up in politics or similar issues and I’m afraid a game like this will find its way into that somehow even if I keep it English only.</p>
<p>By that time, I got only 1 day.. so back again I tried to come up with something simple that can be done in a day, minimalist resistant was still there and I ended up doing nothing yesterday :(</p>
<p>So that’s that, I failed LD22. Hopefully next LD I’ll do something friendlier, plus I really liked how some games tell a story and design a game around that (for example: <a href="http://ludumdare.com/compo/ludum-dare-22/?action=preview&uid=2982">Last Breath</a>).. I should learn how to create a game around a story rather than trying to come up directly with game concepts that relate to a theme. Actually, all the games I made so far don’t tell a story, this has to change.</p>
<p>So I was making an LD22 entry just like you, but then I took an arrow to the knee.. :D</p>
Hello Kongregate2011-12-13T00:00:00+00:00https://zenithsal.com/gamedev/2011/12/13/google-gegypt-2
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt.png" alt="gegypt" /></p>
<p>So I woke up today at 6:00am, left the house and went to <a href="https://sites.google.com/site/gegypt2011/">Google’s gegypt 2.0</a> Developers event, and here I am home again, only 16 hours of googley awesomeness later :D</p>
<p>On entering you see this, it was a little lonely, but stylish</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt-1.jpg" alt="gegypt" /></p>
<p>Inside there are multiple “tracks” each containing different seminars and events, and in between there was the chill out zone, and many other activities, and you had to pass through this Google arc:</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt-2.jpg" alt="gegypt" /></p>
<p>The epic chillout zone had all kinds of strange inventions to replace what we know as “chair”, also a couple of pong tables, fussball (FUS RODAAH!), recharge stations, drinks, sweets, strange man-made devices everywhere.</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt-3.jpg" alt="gegypt" /></p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt-4.jpg" alt="gegypt" /></p>
<p>The beanbags in particular were exceptionally comfortable, leading to some “accidental” sleep on occasion</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt-5.jpg" alt="gegypt" /></p>
<p>We got to see sneak-peaks of some revolutionary Google technologies in development like sci-fi use of voice recognition/google translate, how the new Android OS employed <a href="https://en.wikipedia.org/wiki/Near-field_communication">Near Field Communication</a>, and driverless cars (among many other equally wonderful stuff), felt like Startrek and got to talk to some awesome googlers, I can’t express in words how inspired I got to push myself further in my field after witnessing what these guys are creating.</p>
<p>It was an awesome event, even with my 10 hours of painful headache (which is still going) basically turning me into Zombie Developer.. by the last event I was fighting this strange urge in my guts to lift my arms and shout “BRAINZZZZZZZ”..</p>
<p>And, yes.., this is how I saw people most of the time..</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt-6.jpg" alt="gegypt" /></p>
<p>Also, Google cake! :3</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/gegypt-7.jpg" alt="gegypt" /></p>
<p>ps: Why can’t I stop listening to this?</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/YEt41bYQBgE" frameborder="0" allowfullscreen=""></iframe>
</figure>
Building a Wall - Will Smith2011-12-11T00:00:00+00:00https://zenithsal.com/quotes/2011/12/11/building-a-wall
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<blockquote>
<p>You don’t set out to build a wall. You don’t say ‘I’m going to build the biggest, baddest, greatest wall that’s ever been built.’ You don’t start there. You say, ‘I’m going to lay this brick as perfectly as a brick can be laid. You do that every single day. And soon you have a wall.</p>
</blockquote>
<p><em>- Will Smith</em></p>
Practical WebGL?2011-12-09T00:00:00+00:00https://zenithsal.com/gamedev/2011/12/09/practical-webgl
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>After taking a look at a few real WebGL demos including a quality platformer game, this thing is starting to look and feel even better than Flash Stage3D, and definitely faster since it doesn’t have the bloated Flash player underneath it. And because it’s based on OpenGL ES 2.0 it offers both a familiar API and a fully shader driven pipeline, it actually beats all past plug-in based approaches like O3D.</p>
<p>But let’s face it, WebGL as a game platform would still suffer from multiple disadvantages.. the major two being source accessibility allowing anyone with a browser to not only have direct access to the source but actually the ability to modify it on the fly, and difficulty of distribution (HTML5/WebGL games can’t be packaged as one file, until now at least). There are also some technical difficulties like HTML5 audio not being designed with realtime applications in mind, but these things are being fixed as the WebGL standard is developed.</p>
<p>It is still very exciting because of one thing: availability across a large user base.. given the fact that recent handheld devices have real GPUs built in them, things like <a href="https://en.wikipedia.org/wiki/Tegra">NVIDIA Tegra</a> will eventually close the performance/capabilities gap between handheld and mainstream graphics which is already kinda happening! take a look at gaming on the recent hot Android/Tegra3 based Asus Transformer Prime tablet (too much awesome :D)</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/hL5Pg15eDBU" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>So let’s imagine writing an HTML5/WebGL game that instantly runs on any WebGL supporting browser regardless of platform and looks as good as these games… not hard to do technically if it isn’t already possible, all the platform dependent mess is sorted by the browser while we get a thin layer between our game and the actual GPU underneath…</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/emoji-1.png" alt="Yeaaa" /></p>
<p>few WebGL demos: (supported browsers: Chrome 9+, Firefox 4+, Safari 5.1+, Opera 12+)</p>
<ul>
<li><a href="https://alteredqualia.com/three/examples/webgl_materials_skin.html">‘The head’ skin rendering demo (or WebGL shaders flexing some muscles)</a></li>
<li><a href="https://www.cake23.de/traveling-wavefronts-lit-up.html">Physical simulation running on WebGL fragment shaders</a></li>
<li><a href="https://alteredqualia.com">Alteredqualia has an amazing collection of WebGL demos</a></li>
<li><strong>DEAD</strong> <a href="http://inear.se/beanstalk/">Interactive music demo</a></li>
<li><strong>DEAD</strong> <a href="http://operasoftware.github.io/Emberwind/">Emberwind, a platformer game</a></li>
</ul>
<p>There are already a bunch of JS engines/frameworks for WebGL out there:</p>
<ul>
<li><a href="https://github.com/mrdoob/three.js">Three.js</a> - lightweight</li>
<li><a href="http://www.senchalabs.org/philogl/">PhiloGL</a> - mature (originally developed for O3D)</li>
<li><a href="http://www.glge.org/">GLGE</a> - a bit more complex with advanced capabilities</li>
</ul>
<p>and more!</p>
<p>Excitement!</p>
Creativity and Game Design - Chris Crawford (1988)2011-12-01T00:00:00+00:00https://zenithsal.com/gamedesign/2011/12/01/creativity-and-gamedesign
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Great talk, how this existed in 1988 is beyond me.. :)</p>
<h4 id="part-1">Part 1:</h4>
<figure class="video_container">
<iframe width="540" height="405" src="https://www.youtube.com/embed/zhRh5PwzV74" frameborder="0" allowfullscreen=""></iframe>
</figure>
<h4 id="part-2">Part 2:</h4>
<figure class="video_container">
<iframe width="540" height="405" src="https://www.youtube.com/embed/pqxL4dH_8D4" frameborder="0" allowfullscreen=""></iframe>
</figure>
<h4 id="part-3">Part 3:</h4>
<figure class="video_container">
<iframe width="540" height="405" src="https://www.youtube.com/embed/W2O5RVkpe3c" frameborder="0" allowfullscreen=""></iframe>
</figure>
<h4 id="part-4">Part 4:</h4>
<figure class="video_container">
<iframe width="540" height="405" src="https://www.youtube.com/embed/nDFvjYKJJJA" frameborder="0" allowfullscreen=""></iframe>
</figure>
The Job Hunt2011-11-30T00:00:00+00:00https://zenithsal.com/life/2011/11/30/the-job-hunt
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>It has been an exhausting few weeks looking for a job in game development, at one point I was talking to 4 interested employers at the same time, I could barely keep up, and I’m still talking and getting evaluated, no solid job offers yet though and only one of these companies apologized (apparently they gave the position I was being evaluated for to someone else, or maybe it was just because going there might take 2 months of embassy paperwork hehe) the rest are keeping me around for some reason.</p>
<p>The job opportunities I pursued vary widely, each has different requirements and responsibilities, and when I started looking I had no idea what to expect, I never hunted for a job like this and in fact I wanted to drown myself completely in it to learn how this works.</p>
<p>As usual I have an intricate plan I’m following that involve multiple stages and goals. The first stage was finished a few days ago, it involved applying to many interesting jobs via job sites as simply as sending my CV, no cover letter or attached work samples even if I have some (except for one job which was a big exception and a unique opportunity, took me 4 days of preparation to apply for it and my assessment is coming up next month!).</p>
<p>My goal for this first stage was to understand how companies evaluate candidates and get used to testing and interviews, and it was very interesting to see how many differences there are between companies in this regard, I guess it depends on company scale, how long have they been doing games and yes, how experienced they are in the field.</p>
<p>A second goal is to try working in the game industry before 2012, I was following the principle of “Whoever wants me first, gets me”. But it’s a bit unrealistic since it takes at least one month of paperwork to actually be able to go wherever the company is and I only had 2 months.</p>
<p>I’ll share a few lessons I learned that especially apply to long-distance gamedev job seeking:</p>
<ul>
<li>Don’t trust a mobile phone for telephone interviews, and I’m talking here about long-distance calls, the quality sometimes is so rubbish that all you hear is noise that slightly resembles a human voice, always keep a backup method at hand, Skype is wonderful at this.</li>
<li>Read the clues you get before the interview (if you get any) and prepare for that, if you’re not sure be prepared for anything, never assume what will happen.. Possible interviews might range anywhere between non-technical personal interviews done by HR employees, to tough academic-like tests with very limited time. If you are lucky you might get an interview with a senior or a lead developer, but that happens less than I expected, some companies will put you through up to 3 interviews until you get a chance to talk to someone from the dev team, or at least tell you what that company is actually doing at the moment!</li>
<li>If I was seeking experienced employees for my own company, I’ll either specifically ask for work samples that directly apply to the position they are applying for, or even better.. give them a practical task that takes around a week to do which directly resembles the responsibilities they will have if they got employed. Unexpectedly until this moment no potential employer asked me for either of these! This could possibly have something to do with applying through job sites rather than directly, and who I’m applying to.. big companies don’t even reply to job offers without samples.</li>
</ul>
<p>In the end, I was actually shocked that such opportunities are given just on the basis of a CV and nothing else, which brings me to where the real stuff will happen, Stage 2!</p>
<p>During the stage, rather than applying to jobs randomly, I’ll specifically <em>mark</em> a few jobs that I’m really interested in and completely excited about, provided all have similar requirements, then work hard for a 1-2 months to create substantial modern samples directly related to these requirements, be it code or demos, the goals being: to gain more experience in that field, to have something unique supporting my application, and so that when I apply to these jobs, I’m ready to work immediately on any related assessment tasks they might give me.</p>
<p>I already have 1 mark, let’s see how this goes.. :D</p>
<p>Happy job hunting everyone! here’s wonderful inspirational video:</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/QDmt_t6umoY" frameborder="0" allowfullscreen=""></iframe>
</figure>
Interview or Test, Can’t sleep2011-11-15T00:00:00+00:00https://zenithsal.com/life/2011/11/15/interview-test-cant-sleep
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Ok so I got “interviewed”/tested by game company X at around 3am today (due to the difference in timezones)… and now it’s 5:30am and I can’t sleep because I’m still running on “MUST STAY AWAKE!” fuel.</p>
<p>I was totally expecting a voice interview via Skype with verbal technical questions and discussions, and perhaps a few tests or assignments. I was preparing my microphone, and video camera just in case, warming up my voice and drinking hot chocolate. Few hours ago I reviewed multi-threading, network programming, animation, shaders, the whole thing..</p>
<p><strong>But,</strong> what I got was something that took me completely by surprise. First, it wasn’t a voice interview like I thought, only text chatting.. and between windows updater which repeatedly wanted to restart the computer the moment the “interview” started. and how funny I must’ve looked running around tripping on everything looking for pencils/pens and WHERE THE HELL DID I PUT THAT A4 PAPER PACK!! All of these are ok, they are part of the thing, the real surprise was that immediately after: Hello how are you? I get multiple questions in 3D Math, C/C++ and Data structures (some are a little tricky) with a time limit that only the interviewer knew (few minutes for every question), reminds me of university midterms and believe me.. my brain doesn’t like time limits like these, I just freeze and stare at nothing for most of the precious minutesesss.. usually</p>
<p>And that’s exactly what happened, I was like -_- for most of the time lol. I’d say I did pretty good in half the questions, and I have no idea how bad I was at the other half, but it was bad. I couldn’t have prepared better because there is no way I’d know this was supposed to be a pure coding test!</p>
<p>So, in conclusion, today I discover that preparing for inter-personal communication, and trying to write a hashmap implementation in 5 minutes using C/C++ without STL are entirely two different mindsets… I might have lost the job because of this, but next time it might happen, I’m going to be ready <em>flame-balls-fire-from-eyes</em></p>
<p>Next job interview going to be around Action Script 3. I love that thing it’s so easy to work with.. :D</p>
<p>now.. for MOAR SKYRIM!</p>
The Universe is leaking memory2011-11-12T00:00:00+00:00https://zenithsal.com/gamedev/2011/11/12/universe-leaking-memory
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>2 days of memory leakage hunting, I refactored at least 3 main components of the game (so far) and still about 4MB of memory leakage! who the hell is doing that??! I haven’t looked inside Away3D yet though..</p>
<p>As I’m digging deeper, I started to discover the horrors beneath.. you see Zamron had this life cycle so far:</p>
<ol>
<li>started as a hello world to test pseudo 3D in Flash</li>
<li>developed into a proof of concept in only 48 hours, the first 24 hours of that was spent trying to get a pseudo 3D engine working correctly</li>
<li>decided to give it a few more days and called it wolf</li>
<li>arrived at a “pseudo” good experience for a flash game, so I started expanding it hoping to turn it into some kind of game, the biggest mistake I did was trying to use wolf’s code as is, I should have started from scratch here.. I guess I just wanted to do it quickly in the spirit of Ludum Dare</li>
<li>Zamron idea was born as my entry for ludum dare october challenge, I didn’t make it in time. But I’m pretty close to finishing it now</li>
</ol>
<p>One of the worst problems I’m facing is the horrible base that was part of wolf, you’d think a retro fps should be simple enough to do, but as I’m adding more stuff to Zamron, those “simple enough” parts started to grow and get hairy.. which is where I am now, the only weapon I have against this uncontrolled growth is refactoring and more refactoring… :-/</p>
Zamron + Flash Memory Leaks?2011-11-11T00:00:00+00:00https://zenithsal.com/gamedev/2011/11/11/zamron-flash-memory-leaks
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>I’m having an issue with a massive memory leak about 8MB per level in Zamron, even though I’m making extremely sure to remove and nullify everything after a level ends… Away3D seems to not have a hand in it even though it’s what I’m using to render the game.</p>
<p>Going to investigate embedded textures and also look for any lingering events that might be causing this. Definitely had more productive days..</p>
<p>Here’s a hilarious song about pentiums and corporate nerds hehe</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/qpMvS1Q1sos" frameborder="0" allowfullscreen=""></iframe>
</figure>
Didn’t make it for October challenge :-(2011-11-01T00:00:00+00:00https://zenithsal.com/gamedev/2011/11/01/didnt-make-october-challenge
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>The number of games <a href="http://ludumdare.com/compo/october-challenge-2011/?action=preview">that has been submitted so far is 64!</a> some wonderfully awesome stuff in there :D</p>
<p>Alas, I couldn’t finish Zamron in time and not even close (today is the last submission day but I’m still working on level 3!), but now I’m so determined to finish it anyway.. it’s personal :<</p>
<p>My development/time plans were sound but the reason why I couldn’t finish it is probably because I didn’t do much work during the last 2 weeks or so, it has been a crazy month… I was assuming that my engineering degree will take = (rand() % 10) + 2 months giving me enough time to finish Zamron, First Defense, and Escapor.. however, I got it right in the middle of last month! and everything changed :’(</p>
<p>My job hunt began which takes a lot more time than expected! and I’ve been trying to demystify some new technologies used in games now that didn’t exist last time I worked on a AAA game, crash course in compute shaders? :D</p>
<p>I’m also trying to cure my assembly addiction by writing assembly shaders rather than the usual falling back to emulated Z80 on an 80s computer but why am I even mentioning this? it’s incredibly irrelevant hehe</p>
<p>And before I could even take a breath, <a href="http://ludumdare.com/compo/2011/10/28/introducing-the-mini-ld-30-togetherness/">mini-LD 30 is already scheduled for 4th of November, yes 3 days from now..</a> I need a flower with an even number of leafs so that when I do “enter, not-enter, …” I get a totally <em>random</em> not-enter.</p>
The Birth of Zamron2011-10-11T00:00:00+00:00https://zenithsal.com/gamedev/2011/10/11/birth-of-zamron
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/zamron-1.png" alt="Zamron screenshot" /></p>
<p>This is how the main menu looks like in Zamron Encounter at the moment ;)</p>
Setting up Stage3D on FlashDevelop 42011-10-05T00:00:00+00:00https://zenithsal.com/gamedev/2011/10/05/setting-up-stage3d
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p><strong>NOTE: Flash is killed by Adobe so I expect all URLs listed here to vanish</strong></p>
<p>Since Flash 11 is released yesterday, I thought I might as well try the Stage3D (Molehill), at least to set my development tools if I wanted to do something with it in the near future..</p>
<p>The information out there about Stage3D and setting it up with FlashDevelop is confusing and outdated, google didn’t help much, I followed what seems to be the main method to set up the incubator playerglobal.swc and an unofficial flash player debugger which I couldn’t get to “debug” things, then I just found that Adobe did release an official player debugger and playerglobal.swc yesterday! but google didn’t show it in the results probably because it’s very recent and I couldn’t find a direct link for it easily within Adobe Flex/Flash developers pages today (probably because I’m blind), so here it is if someone missed it: <a href="https://www.adobe.com/support/flashplayer/downloads.html">https://www.adobe.com/support/flashplayer/downloads.html</a></p>
<p>To set Flash 11 (Stage3D Molehill) up with FlashDevelop 4, first you need <a href="https://www.adobe.com/devnet/flex/flex-sdk-download.html">Flex SDK 4 (get the latest stable)</a> if you don’t have it already and set it up normally with FlashDevelop 4, then:</p>
<ol>
<li>download playerglobal11_0.zip (or whatever the latest version is)</li>
<li>download the Windows Flash Player 11.0 Projector content debugger (“flashplayer_11_sa_debug_32bit.exe”)</li>
</ol>
<h3 id="setting-up-playerglobalswc">Setting up playerglobal.swc</h3>
<ul>
<li>rename “playerglobal11_0.zip” to “playerglobal.swc” (don’t uncompress it!)</li>
<li>navigate to {YourFlex4SDKFolder}\frameworks\libs\player\11.0\</li>
<li>overwrite the playerglobal.swc you find there with the downloaded file</li>
</ul>
<h3 id="setting-up-flashdevelop-with-flash-player-debugger-11">Setting up FlashDevelop with Flash Player Debugger 11</h3>
<ul>
<li>In FlashDevelop, goto Tools -> Program Settings -> Flash Viewer</li>
<li>Change “External Player Path” to point to your “flashplayer_11_sa_debug_32bit.exe”</li>
<li>In your project properties, set the platform to Flash Player 11.0, the SDK to the latest Flex 4 SDK you have.. then in Compiler Options -> Additional Compiler Options add this: “-swf-version=13”</li>
</ul>
<p>That’s it :D
Happy Coding!</p>
<p>Userful resources:</p>
<ul>
<li><a href="https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html?filter_flashplayer=32.0">Recent AS3 Language reference compiled using asdoc</a></li>
<li><a href="https://zenithsal.com/downloads/AGALMiniAssembler.zip">AGALMiniAssembler download (it’s not part of the SDK!)</a></li>
<li>AGALMiniAssembler Primer: <a href="http://web.archive.org/web/20111214082058/http://ryanspeets.com/flash/agalminiassembler-primer/">http://web.archive.org/web/20111214082058/http://ryanspeets.com/flash/agalminiassembler-primer/</a></li>
<li>AGALMiniAssembler opcodes: <a href="https://zenithsal.com/assets/photos/tumblr/agal-1.png">Mindmap-1</a>, <a href="https://zenithsal.com/assets/photos/tumblr/agal-2.png">Mindmap-2</a></li>
</ul>
Hello World Molehill (Stage3D)2011-10-05T00:00:00+00:00https://zenithsal.com/gamedev/2011/10/05/hello-world-molehill
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/molehill.jpg" alt="Hello World Molehill" /></p>
<p>Hello Flash 11 Molehill! :D</p>
<p>Written from scratch, don’t trust most examples out there they are either using API things that changed in the release Flash 11 or are just written using substandard Actionscript 3 (aka. stupidly)… in both cases you get an empty screen with stats showing correctly.</p>
Back to the University2011-09-28T00:00:00+00:00https://zenithsal.com/life/2011/09/28/back-to-university
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p><strong>WARNING:</strong> <em>this post is written while being very sleepy, my linguistic abilities deteriorate during this state, so excuse anything that doesn’t make sense hehe</em></p>
<p>Today, no sleep, and 7 hours of work, then I went to University to check whether my engineering BSc certificate is … made.. yet I guess, and it wasn’t, they postponed me to 1st of October (3 days from now, not bad).</p>
<p>And since there aren’t many of my friends left, most graduated and the few left are in lectures or going to lectures, I should normally feel old and leave the vicinity asap but this time I didn’t. I just kinda kept walking around and thinking, looking at new trees that grew, old trees that are no longer there, new features and signs of age that I didn’t notice before, almost like visiting an old dream, there were many new faces I’ve never seen before, and some old ones.. most look sad and gloomy like an extinguished candle, but the new ones are still happy and full of energy, lit. I couldn’t help but reflect on my own education chronicles, and then I realized something…</p>
<p>Our higher education system is so flawed it feels like military service, in what sense you might ask? well simply, it doesn’t seem to have any tangible rewards! you work your ass off for years to no end without even seeing anything of what you study in reality (academia sigh..), you suffer and fight and pass one challenge after another, and no one and nothing shows you any kind of reward waiting at the end in exchange for all this hard work, not only that but everyone seems to put pressure on you, the professors, the parents, and even society.. eventually you just give up fighting against it and lose all your energy after a year or two, perhaps three if you got a strong heart.. and kinda go into this zombie-like existence, eat-sleep-study-suffer and sometimes you can’t even find time to sleep!</p>
<p>Based on that model, most students I met during my aimless wandering immediately go into describing how much they suffer once I ask how is his/her study going?</p>
<p>..</p>
<p>But here is the realization, today I discovered there is a reward! for the first time in my life I feel like I actually was rewarded a little for all these years of effort. How? well, though still intangible, the reward is that you did it! you outsmarted the flawed academic system! \o/</p>
<p>I can now look at any mean professor from the old days and evil-laugh while pointing: “MUAHAHAHA <em>point</em> you tried your best but you couldn’t stop me!.. I survived!”.</p>
<figure class="video_container">
<iframe width="540" height="405" src="https://www.youtube.com/embed/ARt9HV9T0w8" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>^ this should probably be the official students anthem</p>
<p>Great, what a realization… only possible if you’re high on sleep deprivation</p>
Wolf is still alive…2011-09-26T00:00:00+00:00https://zenithsal.com/gamedev/2011/09/26/wolf-still-alive
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Yes, a 3 day project that lasted.. well a lot more than 3 days obviously. I’ve been logging a few details about progress in twitter for reference, working is going much slower than the initial burst of work because I didn’t plan for something this big :-S</p>
<p>But I feel like I learned things and solved new types of problems, so it’s all in good sports :) here’s a little brief on how things went so far:</p>
<h2 id="level-system">Level System</h2>
<p>Enhanced the invisible level system, each level is formed of 3 different textures to provide good flexibility, though the demo level I’m still using fails to show any of that heh.</p>
<p>I’m trying this new method of decoding levels as pixels in a texture, so each pixel represents something, a wall, floor, door, or enemy maybe.. the actual data held by the pixel is a little bit complicated, almost like a pixel scripting language :D</p>
<h2 id="collision-detection">Collision Detection</h2>
<p>Collision detection between player-walls, player-enemy, player-projectile-enemy, all working and sufficiently optimized, the projectiles collision detection took me some time and 3 different methods until I arrived at something I’m satisfied with, here are the methods I tried:</p>
<ol>
<li>
<p>A mathematical method of detection, very fast detection. But it had problems and sometimes it just didn’t work, so I canceled it.</p>
</li>
<li>
<p>A ray casting based method, where the projectile casts a ray that is then checked against bounding spheres of enemies and obstacles like walls. But that sounded like too many space calculations, most are probably useless.</p>
</li>
<li>
<p>A pixel based method I came up with, it involves drawing a small representation of the whole level in memory (walls, floor, enemies, players, etc) while color coding each type of objects, then just moving along the projectile path 10 units at a time checking for the first color encountered, then doing a more comprehensive test by object type. I think this is a pretty fast method with good flexibility. And with a little trick it can even handle varying height ;)</p>
</li>
</ol>
<p>Here’s how the projectile collision map looks like: (scaled up 200%)</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/wolf-2.jpg" alt="Wolf Minimap" /></p>
<p>Bonus, I could actually use it as a mini-map! :D</p>
<p>And here ends my quest for perfect collision detection, thank god I didn’t get into method 4, which involved BSP and PVS… wtf? it’s just a retro shooter dude.. I should learn to do it caveman style, MAKE IT WORK NAW or I club you.</p>
<h2 id="performance">Performance</h2>
<p>I’m a bit haunted with a performance hungry ghost, so here is a short list of tweaks I did (so far):</p>
<ol>
<li>Compiling performance, this is a very annoying thing that actively helped in prolonging this once 3 days project, this is flash for gods sake it shouldn’t take 10 minutes to build an SWF :(</li>
</ol>
<p>So I just kinda switched to Flex, flash is out of the picture, guess what? compiling time is ZERO, I just run… I didn’t even expect that big a difference.</p>
<ol>
<li>
<p>Custom geometry: rather than drawing a cubic block for everything, I’m only drawing the necessary faces to create the level, all I did was create a custom cube class with the ability to remove faces as needed.</p>
</li>
<li>
<p>Tweaked clipping, renderer, and actually thinking of creating my own clipping method..</p>
</li>
</ol>
<p>Oh yes, enemies can fire stuff now! blue stuff… no idea what yet.</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/wolf-3.jpg" alt="Wolf Enemies" /></p>
<p>hmm… ugly hehe</p>
Zeitgeist: Moving Forward 20112011-09-21T00:00:00+00:00https://zenithsal.com/futurism/2011/09/21/zeitgeist-moving-forward
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>The most revolutionary documentary I’ve ever seen about humanity, it’s problems, and it’s future, and it actually presents impressive technological solutions.. a total eye opener.. I’m actually joining the Zeitgeist movement~! :D</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/4Z9WVZddH9w" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>Related links:</p>
<ul>
<li><a href="">http://www.thezeitgeistmovement.com/</a></li>
<li>The alternative social system project that’s featured in the zeitgeist documentary: <a href="">http://www.thevenusproject.com/</a></li>
</ul>
Wolf Timeplan2011-09-19T00:00:00+00:00https://zenithsal.com/plan/2011/09/19/wolf-timeplan
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Wolf gets 48 more hours of work now, so I need to concentrate on the basics of the game
I'm hoping to get to something playable at the end..
Processing.............................. .. . .
\\\
I have a full plan dO_Ob !!
|_|
Description
Day 1:
Optimize rendering area 0.5
up-down variation while walking 1
much faster motion and rotation 0.5
Custom billboard class 2
Enemy test, class/sprite/in level 2
Player vs Enemy collision detection 1.5
Player-fire var Enemy collision detection 3
Enemy can fire 0.5
Player vs Enemy-fire collision detection 1
TOTAL 12 hours
Day 2:
Test trigger wall 1
Player actions collision 3
Triggering works correctly with id 1
Windows 2
Shotgun class/sprite/in level 2
Random enemy motion, Pistol/shotgun working 2
HUD showing health 1
TOTAL 12 hours
In case Day 1 and 2 are successful,..
Day 3:
Add doors 1
Doors openable with triggers 1
Doors motion while opening 2
Design 3 enemies 1
Add 3 enemies to test level 1
enemy behavior 3
Main menu, prepare for multiple levels 2
HUD notification text "You found a mighty pistol!" etc 1
TOTAL 12 hours
This is getting rediculous
Day 4:
HUD weapons 2
HUD ammo 2
Design level pack class 2
Create a bunch of levels 3
Design 2 monsters 3
TOTAL 12 hours
... okay this is the last day
Day 5:
Add 2 monsters class/sprite/in levels 2
Monster 1 AI 2
Monster 2 AI 2
Custom cube geometry with hidden surface removal 3
Create more levels 3
TOTAL 12 hours
FUUUUUUUUUUUUUUUUUUUUuuuuuuuuuuuuuuuuuuu
Day 6:
Fog experimentation, performance adjustment 4
More levels, adjust for fun 5
Throw in some music 3
TOTAL 12 hours
Day 7:
Release, then fucking die of exaustion 12
TOTAL 12 hours
...
and to think I wanted to add spells and magic to it...
</code></pre></div></div>
Wolf: Post Mortem2011-09-17T00:00:00+00:00https://zenithsal.com/gamedev/2011/09/17/wolf-post-mortem
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Well I said I will stick to simple ideas, then completely went over that by trying to make a retro fps shotter with support for multiplayer in 72 hours max hehe</p>
<p><a href="https://zenithsal.com/gamedev/2011/09/09/exp-rapid-indie-gamedev">Read the experiment details here</a>, for reference.</p>
<p>This is my first try, I called the whole thing “Wolf” not the game but the whole project. And of course, I didn’t quite make it, but I made something from scratch and by all means it’s an impressive result for 3 days of normal work, it isn’t a full game though, only a good base for one.</p>
<p>Take a look, a pixelated on purpose game :)</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/wolf-1.jpg" alt="Wolf Prototype" /></p>
<p>Here, try the demo « <a href="https://zenithsal.com/other/wolf/wolf.html">WOLF DEMO</a> » controls: arrow keys, A/D for strafing, Ctrl for firing, and 1/2 to switch weapon (punching or a pistol you can pick up).</p>
<p>I faced a number of frustrations that unfortunately were a result of introducing untried and untested Flash 3d libraries to power the game, but hey, I learned my lesson :)</p>
<h2 id="what-went-wrong">What Went Wrong</h2>
<h3 id="1-flash-3d-libraries">1. Flash 3D Libraries</h3>
<p>Flash 3D (for Flash 10) is fail, it cannot be used for 3d games period, even if it’s something as simple as wolf. And it’s not the 3d libraries fault, in fact these are wonderfully crafted libraries with many smart tricks to speed things up (though buggy).. but it’s ultimately Flash 10’s crappy performance and its full software implementation.</p>
<p>When I started evaluating libraries, I did a superficial evaluation and picked Sandy3D because it looked like the simplest of them, all I needed was something that can draw simple textured polygons and textured billboards. That’s it!</p>
<p>Initial Sandy3D tests on my Netbook yielded relatively acceptable results, however there was a very annoying problem with the texture perspective correction that makes textures “bleed”, the only solution was to set a quality parameter per object (which actually just tessellates for more polygons). On the Netbook setting this quality parameter to any value above 1 takes the performance down many notches into unplayable territory. I guess it’s ok if it’s on the Netbook, atom processors don’t pack much mojo anyway… the shock came when I went back home and tested things on my 3 core Phenom desktop, it also kills performance!</p>
<p>I started working on wolf the next day, and the first thing I had to do was find a way to obtain good visual results and more performance.. a few hours later I gave up on Sandy3D so started looking for alternatives. I tested one of the best 3D Flash engines around, Away3D.. turns out it doesn’t have a serious perspective correction problem and provides much better performance.. So I made the hard decision to switch libraries, I had to learn Away3D from scratch and port everything I have to it, on the way I got really frustrated with the camera in Away3D… its camera is very weird, ultimately what I didn’t know is that I must attach a “lens” object to the camera to set working perspective projection, the tutorial doesn’t say anything about that, eventually I started reading examples in case I missed something and found out!</p>
<p>Then came Sprite3D, so buggy and I couldn’t figure out why, it disappears when it wants, it changes position and jumps around.. its whole positioning took an hour or two to get right. Working on Sandy3d was much smoother.</p>
<p>After several hours, near the end of the first day, I was thinking of trying Alternative3D which although closed source seems to be the only library made specifically for games, but I decided to stick with Away3D for better or worse.</p>
<h3 id="2-fps-games">2. FPS games</h3>
<p>these things are complex, even a retro fps like this has many elements to make. It’s also a lot less forgiving compared to 2D games when it comes to relationship between quick hacky code and fun gameplay.</p>
<h2 id="what-went-right">What Went Right</h2>
<h3 id="1-quickly-made-art">1. Quickly made art</h3>
<p>Even though things were made pretty quickly, and there aren’t many to begin with.. the demo looks kinda stylish :)</p>
<p>I used a camera and my hand to make the player hand, which I admit was a lot of fun ^_^ I modeled the pistol quickly using wings3d and did a quick rendering using POV-Ray, very simple but looked good.</p>
<h3 id="2-breaking-flash-ide-ties">2. Breaking Flash IDE ties</h3>
<p>Using Flash 3D libraries forced me to do most things in as3 code, the whole fla file is very simple.. this is a good thing because depending on the fla file caused problems especially with collaborative work in the past.. it’s buggy, binary, and cannot be merged easily.</p>
<h2 id="next-challenge">Next Challenge</h2>
<p>The next experiment, I’m gonna do the exact opposite… choose a very simple idea, but polish it as much as I possibly can within the time limit.</p>
<p>For wolf, I’ll see what people think about it as it is now, if I get enough positive opinions, I’ll give it another 72 hours, no more.</p>
<h2 id="time-report">Time Report</h2>
<p>I’m timelapsing all my work, this way I could go back later and remove all non-work related screen shots.. I get a good time estimation this way :)</p>
<p>Chronolapse set to take 1 screenshot every minute.</p>
<p>Day 1 (14/9/2011): 725 screenshots = 12 hours of work</p>
<p>Day 2 (15/9/2011): 573 screenshots = 9.5 hours of work</p>
<p>Day 3 (16/9/2011): 513 screenshots = 8.5 hours of work</p>
<p>out of 72 hours, I worked for 30 hours.</p>
<p>Ideal work hours = 10 hours/day</p>
<p>Achieved 100% efficiency :D</p>
Wolf: Follow Up2011-09-17T00:00:00+00:00https://zenithsal.com/gamedev/2011/09/17/wolf-follow-up
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>I couldn’t sleep yesterday, I slept this morning around 10 am (being nearly 25 hours awake.. typical) only to be awaken by the gas company wanting to install the new gas line in my kitchen around 2 pm, that’s 4 hours of sleep… but all is well :)</p>
<p>I was kinda harsh on Away3D, that’s probably because I come from a native performance background, when I draw a polygon and watch the framerate drop 0.01 frames I freakout and start running and cursing. In addition to that doing this rapid gamedev thing kinda twists how I judge stuff, I want to get things done as fast as possible (within minutes ideally) and if a solution doesn’t act the way I think it should at the time, it costs me preciousss minutesesss, and then I start cursing more.. yep, there is a lot of cursing involved in gamedev :D</p>
<p>Today is my rest and I’m taking things at a much slower pace, I went to Away3D site and looked at the showcase demos they have for the first time, and there are pretty impressive things in there! like Raveleijn (a dutch MMORPG) for example:</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/xGtTaUGAUF8" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>Great, now I feel like an ass, especially since one of the developers of Away3D twitt..ed (?) me asking about what kind of problems I was facing and suggesting I take it to the away3d forums, and I was pretty ticked off at the time but I think he understood the situation. (btw I love open source projects like away3d, honestly love them, I want to marry one and have little forks.. I have like a fetish for open source projects.. ok I’m gonna stop now lol)</p>
<p>Oh yes, about Wolf… so I ran around and showed what I have to different kinds of people, other indie game developers (who are all awesome) ask immediately about what am I going to do about the lighting and that I should add at least fog so the polygon popping (due to aggressive clipping) is less noticeable.. Gamers give the occasional encouragement while hiding the fact they are comparing my Wolf to Call of Duty (CoD doesn’t stand a chance), meanwhile people from outside the games community just get confused with a “what is this I don’t even…” look.</p>
<p>Now there is a decision to be made, but first the purpose behind Wolf was to hit multiple targets at once with one ray:</p>
<ul>
<li>Work on Flash 3D libraries to figure out what they are all about, are they useful for serious projects?</li>
<li>Create a complex game iteratively depending on emerging design, there is no classic design document or any kind of presuppositions about what it should be neither mechanically nor artistically, basically I’m just making up things as I go</li>
<li>Develop the skill of finishing games quickly, learning to sacrifice the right things in exchange for shorter development time, with the main objective being fun gameplay</li>
<li>Trolling teh internet, which is what I’m doing right now ;)</li>
</ul>
<p>Obviously, Wolf isn’t even a game yet.</p>
<p>So the decision is, will I give it another 72 hours of development? in which case I should specify exactly what to do during the 3 days to hopefully arrive at a playable fun game at the end.. or should I just accept the lessons I learned here and move on to the next challenge?</p>
<p>p.s I just realized a quick method to give Wolf considerably more performance, just render to a smaller screen and scale up! it’s supposed to look pixelated to begin with, I’m just pixelating it in HD hehe</p>
Our Little World2011-09-15T00:00:00+00:00https://zenithsal.com/gamedev/2011/09/15/our-little-world
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Watching the little gamedev twitter world, I find notch working on Minecraft and releasing 1.8, Chevy Ray is enthusiastically developing a new game with a bunch of artists, John Carmack like usual mumbling about weird things related to displays and refresh rates, I think he’s creating an intergalactic space ship out of old CRT monitors or something.. whatever it may be, it can probably reach escape velocity..
IndieCade independent games festival is announcing it’s finalists! http://www.indiecade.com/index.php/2011/Finalists/ then accusing notch of causing their website to go down hehe notch is like a living breathing DoS attack
And Terry Cavanagh celebrating because his game “At a distance” is a finalist at indiecrade!
And I’m coding my own little thing, I couldn’t help but smile =) I like this little world, and I want to stay in it..</p>
Experiment: Rapid Gamedev2011-09-09T00:00:00+00:00https://zenithsal.com/gamedev/2011/09/09/exp-rapid-indie-gamedev
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>It might be getting old, but I will again mention that participating in Ludum Dare was the best decision I made this year, I urge all game developers interested in the skill of making actual games (rather than just talking about it or making cute main menus -I did both hehe-) to try it and work hard at succeeding, the moment you succeed in finishing fun games within 48 hours,.. the results will surely send shockwaves into your future.. it’s such a pure concentrated experience in gamedev, it’s just beautiful.</p>
<p>And just so you know, I’m not the only one who’s going crazy about game jams all of a sudden.. because of the massive awesome success in LD#21, next weekend alone (at the 17th) there are 7.. <a href="http://ludumdare.com/compo/2011/08/29/5-jams-in-one-weekend/">yes that’s 7 different game jams! this is a first..</a></p>
<p>Let me clarify a few things that I’m being asked about:</p>
<p>My timetable experiment is not over, I’m just testing things with the training wheels off, and I’m now -unconsciously- much better at time management! (<a href="https://en.wikipedia.org/wiki/Four_stages_of_competence">unconsciously competent</a>) I’ll go back home tomorrow and perhaps put the training wheels back on for further improvement</p>
<p>About why I haven’t worked on First Defense recently, I frankly was shocked after LD#21… and I said it in the post-mortem, Prison Escapor a game I developed in 72 hours is more fun and have more creative and commercial value than my most ambitious First Defense design!</p>
<p>I know why First Defense took all this time (and it still has one level that isn’t even that fun!).. I pushed quality too far. And even with a bit of help from my friend the talented Islam Wazery (Menopia), the quality is still too much for a first commercial first Flash game (second Flash game now after Escapor :D), so now I find myself a bit stuck. and I have a hard decision to make:</p>
<ul>
<li>Toughen up: I could toughen up and carry on with First Defense until it’s finished, this could take anywhere between 2 months and 4, I don’t know anymore.</li>
<li>Lower quality: I could drop the quality level, even though the design depends on it, and that will make First Defense of even less value as a game than it is now, but at least I can finish it much faster, perhaps in a month.</li>
<li>Cut My Losses: Only create a demo of a few missions, the first 4 most likely including 1 boss fight, using current quality, and release it on Kongregate as a free demo. If people liked it and demanded more, we could return to First Defense later to make more stuff.</li>
</ul>
<p>I’m leaning towards the last one, seeing that it’s the only way I could leverage the code and art we made so far and at the same time, I could move earlier into projects that sound, look, and play more indie. Menopia if you are reading this now, I’d like to hear what you think.</p>
<h1 id="new-experiment-rapid-indie-gamedev">New Experiment: Rapid Indie Gamedev</h1>
<p>What will happen if I kept doing back-to-back 48 hours personal game jams? :D</p>
<p>Most likely I’ll die of exhaustion in two weeks, or if I’m lucky I’ll stay in a good mental institute for a month eating brainz and living like a zombie, but how about I add a little balance to it, and a few rules…</p>
<p>Let’s see, hmm… okay… time to list the rules:</p>
<ol>
<li>I am to make a game and finish it in 48 hours based on a single idea (Death, Sleep, Dreams, Escape, Defend, etc…), that’s the main goal.</li>
<li>In case I couldn’t finish it entirely, I can add 24 more hours, which should be enough to create a few more levels and pretty much make the game more complete.</li>
<li>I release the game somewhere players/testers can test, rate, and comment. And take a 24 hours well earned rest.</li>
<li>After the rest, if the game isn’t that good, and players didn’t like it or the concept as a whole, I just start a new game. <go back to 1></li>
<li>If it has potential, and players liked it, I get 48 hours to polish it and create better graphics, sound effects, add music, more levels, etc..</li>
<li>Then I get 24 more hours to prepare game for release, I may contact a sponsor or just release it directly for free.</li>
</ol>
<p>For now, I’ll stick to simple ideas like Escapor, until I’m comfortable enough and capable to expand to larger games, at which time I get to modify the allowed time to develop the game. So if I for example think that a game concept will take me 96 hours to develop, I’ll do that. If it wasn’t enough I’ll add half the time (48 hours) to finish it.. Then release it for testing, and if it’s good I’ll take another 96 hours of polish then 48 hours to prepare and release the final version.</p>
<p>This means even though the initial creation time is 96 hours (4 days), the game may expand to nearly 12 days.. which for games is very logical since the rule states that when you think you finished 90% of a game, you should know you still have to finish the other 90% ;)</p>
<p>12 days + 2 fun days a week = 15 days, about 2 weeks</p>
<p>This is quite an ambitious experiment, and as usual it may end up an epic fail or a win. Regardless I’ll learn so much, and that’s the point.. ^_^</p>
<p>I’ll say what I think is possible rewards out of this to encourage myself in the near future:</p>
<ul>
<li>Making and finishing <em>normal</em> games becomes child’s play, allows me to move to something even more ambitious</li>
<li>Designing games is a skill that is very hard to learn, because it can’t be defined solidly, it’s very conceptual and non-technical. This experiment will give me very precious insights into game design, to the point I am not able to foresee the directions it can develop towards at the moment.</li>
<li>Best of all, I’m very confident that if I keep it up for 2+ months, I’ll be able to generate a very good monthly income that can only get fatter :D think $6000/month or something within 6 months, indeed I’ve seen indie game developers do even better than that, most famous is Notch and his masterpiece of game design Minecraft.. a single game that made him $20,000,000 in less than a year, and it’s still in beta!</li>
</ul>
<p>Only imagination is the limit, and imagination embraces the entire world, so Einstein would say :)</p>
<p>Here’s a little motivational speech:</p>
<figure class="video_container">
<iframe width="540" height="304" src="https://www.youtube.com/embed/eaIvk1cSyG8" frameborder="0" allowfullscreen=""></iframe>
</figure>
Happy Eid2011-08-31T00:00:00+00:00https://zenithsal.com/life/2011/08/31/happy-eid
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Hi! This is the first day of Ramadan ending holiday, so happy eid!!! :D</p>
<p>After Prison Escapor, I had to come to Alexandria for the holiday submitting to my family’s demands, and at the same time I was interested in visiting a place in Alexandria (Egypt) called <a href="https://ideasgym.com/">IdeasGym</a> which is a wonderful project that concentrates on after-school activities for kids of ages starting from around 6 years up to 18 years.</p>
<p>It aims to introduce them to a fun science, art, and social environment while keeping them healthy via working-out in the mini-gym and eating healthy food, I’ve seen wonderful things in there and the place -although not very big- has a lot of potential and shows a lot of promise.</p>
<p>Among the activities they provide: Robotics via robotics kits (a very rare thing here), cinematic production and direction, architectural/mechanical/electronic oriented activities, and of course, many artistic activities as well.</p>
<p>I had the honor of being invited there by the project manager to talk about possibly giving game development and design courses for multiple age ranges..</p>
<p>Teaching this profession to kids is not easy, because I believe it mainly depends on how much passion for making games the individual has. Needed knowledge is not centralized in a field of study like in academic fields, but it’s all over the place and it’s up to the interested individual to choose which things to get into and study.. however, if we’re talking about merely giving kids a taste of what making games feels like, I think that’s easier to accomplish.</p>
<p>There are a number of game design schools in the world, not many but there are a few.. and even if they actually teach game design and development practically for several years including multiple group projects.. If you ask a game studio head whether s/he prefers fresh junior game developers coming from related academic backgrounds (ie. Computer Science) or those coming from game schools (like Full Sail or DigiPen), the response you get most of the time is that they are both on the same grounds, it all depends on how much passion each put into gamedev.</p>
<p>I’m kinda conflicted about this, success in teaching gamedev is not going to be an easy thing to accomplish and the fact there is a language and social barrier for me in here won’t probably help me with the kids.</p>
<p>On the Cloud Mill front, I’ve developed the new website (link obsolete) to be partially dynamic, all pages there are generated by the python app hosted on the google app engine platform, I’m now trying to tackle creating complex relations between entities in the datastore (google app engine has a very different solution for databases) and also planning for an easy way to add and edit new content to the site, including games. Life is good!</p>
Post Mortem: Prison Escapor #LD482011-08-23T00:00:00+00:00https://zenithsal.com/gamedev/2011/08/23/postmortem-prison-escaptor-ld
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>If I spend three days every week like I spent the last three days weird things will happen.. I’ve learned so much and I needed those lessons so bad, while I’m at it I finished my first flash game and the first game I design from scratch! and it only took 3 days.. <a href="http://ludumdare.com/compo/ludum-dare-21/?action=preview&uid=4775">Prison: Escapor.</a></p>
<p>LD#21 was wonderful, <a href="http://ludumdare.com/compo/ludum-dare-21/?action=preview">nearly 600 games were submitted</a>, and I felt like I’m competing head-to-head in a race with so many great game developers from all around the world, some just starting, some with 10+ years of experience, some own game companies, and some are considered legends in game development/design.</p>
<p>The first thing I’m wondering about is why First Defense took this long, several months really, and is still no where to be finished… while a game that took me 3 days to finish from concept to release has more game design value, playability, and experience in it?</p>
<p>Through this experience, I created a timelapse video of my whole work for the first time, one screenshot every 30 seconds using <a href="https://code.google.com/archive/p/chronolapse/">Chronolapse</a>. By the time I finished and submitted the game, I got more than 4800 screen shots! that amounts to exactly 40 hours of work, which is a very useful thing to know =)</p>
<p>Here’s the timelapse video:</p>
<figure class="video_container">
<iframe width="540" height="405" src="https://www.youtube.com/embed/ysWkSg8Lxw4" frameborder="0" allowfullscreen=""></iframe>
</figure>
<p>Heh… game over indeed ^_^</p>
<h2 id="what-went-right">What Went Right?</h2>
<h3 id="1-using-cmg-framework">1. using CMG framework</h3>
<p>I built the CMG framework slowly with First Defense as I’m learning ActionScript 3 and Flash, it’s still far from being a complete framework or bug free. But using it was the best decision I made because here I have a framework which I know every little detail about that does most of the grunt work for me freeing me to concentrate on the game creation part, and it felt good… minutes after I started working I got something to show :)</p>
<h3 id="2-persisting-to-finish-the-game">2. persisting to finish the game</h3>
<p>My original intent was to enter the competition, which only allows 2 days of work. But I was nowhere close to finishing by the time it ended, even when the LD servers crashed and we got 12 more hours of extended time, the game was barely playable by then.</p>
<p>At first I almost gave up, but then I said what the hell? I’ll go for the jam (3 days contest), which allowed me 12 more hours to work at that point, and somehow I managed to finish, even if I didn’t really think I would make it in time.</p>
<p>The strange thing is,.. this has been a recurring theme over every challenge I carried out, at one point it feels kinda hopeless and I want to just give up, but then I get stubborn and force myself to keep carrying on and I usually make it!</p>
<p>So from now on, everytime I hit that “<em>I can’t do it</em>” point, I know it’s time to work even harder because I’m close to success :D</p>
<h3 id="3-timelapsing-the-whole-thing">3. Timelapsing the whole thing</h3>
<p>This is a wonderful thing, it’s like a complete record of every moment the project went through.. creating features, squashing bug, and sometimes even frustration all show in the video.. and of course the moment of triumph when the game is finished and released :)</p>
<p>When the timelapse software is working in the background, it feels a bit like someone is watching what I do closely, that someone is me later on.. so procrastination and wasting time with useless things are much less likely to occur if I know my future-self is watching.</p>
<p>It also shows how much I get distracted at work with things I should just shut off, like news or facebook or something, going to check facebook even for half a minute means my line-of-thought will be lost, whatever I was coding I’m going to have to find what I was trying to do with it and most likely I’ll end up writing buggy code and <em>facepalm</em> myself later.</p>
<h2 id="what-went-wrong">What Went Wrong</h2>
<h3 id="1-the-game-concept-was-too-much-for-my-first-48-hours-contest">1. The game concept was too much for my first 48 hours contest</h3>
<p>Most other entries included a simple design and simple mechanics following a known genre, pattern based enemies (if there are enemies), and mostly simplistic environments. There are exceptions though, there are those who did much more than that, but they are usually quiet experienced with game contests like this one and know exactly what to concentrate on.</p>
<h3 id="2-irc-notch-and-ld-blog">2. IRC, Notch, and LD blog</h3>
<p>IRC channel #ludumdare, Notch livestreaming himself working on his entry, and LD blog entries that I read/write, all served as distractions. And you can see pretty clearly in the timelapse how many times I got distracted with those… more than I thought.</p>
<h3 id="3-incomplete-experience-with-flash">3. Incomplete experience with Flash</h3>
<p>Flash has a weird way of dealing with things that sometimes doesn’t make sense. Before Prison Escapor, the only game I finished in flash was pong which is hardly a game and it was many years ago. I had confidence in my knowledge in Flash and my framework to not face tricky situations.</p>
<p>But I did, many in fact, the two that took most of the time during the second and third day:</p>
<ul>
<li>Building multiple levels in Flash editor (I haven’t done that yet in First Defense)</li>
<li>The strange relationship between child and parent movieclips as opposed to construction and events, this is a very basic thing and I’m actually shocked I didn’t have problems in the past due to this misunderstanding.</li>
</ul>
<p>The first problem, turns out I was completely wrong in how I structure my levels, that goes for First Defense too, I had to refactor the whole flash project to follow a better approach that allows easy level creation.</p>
<p>The second problem, drove me crazy for an hour or so until I figured out the issue.. you see, child movieclips are constructed then added to scenes (event), before their parent’s constructor is even called! doesn’t make sense… even if children should be constructed before parents, they shouldn’t be added to stage before their parents are even constructed!
Lazy developers…</p>
<p>Best and quickest solution is to create a new event that is fired on the first ENTER_FRAME received.. call it FIRST_FRAME or something, in which parents are guaranteed to exist.</p>
<p>There was another little issue worth mentioning too, involving static globally accessible classes (singletons), I have a few (about 3).. of course these classes will not be reconstructed when scene changes, so all data they have will be carried around between scenes, which is very useful. But it means you have to make sure to reinitialize them manually at the right time.</p>
Timetable draft 3: still going!2011-08-18T00:00:00+00:00https://zenithsal.com/life/2011/08/18/timetable-draft-3-stillgoing
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>I’m exceptionally happy with how the timetable turned out to be much more suitable to me compared to the first one, I have been sleeping from 12-8 for about a week now. I managed to keep the timetable going in Alexandria.</p>
<p>Eventually though I started to get seriously frustrated with how slow working on the netbook was. I mean everytime I built the swf file as debug I’m forced to wait for 5+ minutes while the Netbook nearly hangs with all resources nearing 100% (RAM and two CPU cores!), by the last day I would take a break every single time I wanted to test the swf, that was not cool. But I’m back to my working PC now :)</p>
<p>I’ll share with you the method I’m using to control my sleep rhythm, I’ve been struggling with sleeping rhythm problems for as long as I can remember, as far as primary school, maybe these would help someone out there..</p>
<ol>
<li>Specify a time to wake up, this <strong>must</strong> be constant.</li>
<li>For many years, I’ve been lying in bed to read and write and sometimes even work on my laptop. If you are anything like me, this should stop now. Never lie down unless you want to sleep, bed is for sleeping.</li>
<li>Plan for going to sleep 8 hours before the time you wake up, but don’t go to sleep unless you start dozing off (micro-sleep) while reading a book or working on something for example.</li>
<li>Don’t watch TV before sleeping, it’s flashy bright and may disturb your natural sleeping habits. Read a book instead or work on something, you’ll know when you’re ready to sleep.</li>
<li>It’s ok if you didn’t feel sleep creeping in until 6 or even 5 hours prior to the time you wake up, your biology will automatically make up for it the next day by making you sleep earlier.</li>
</ol>
<p>And that’s it!</p>
<p>I’m preparing to start <a href="http://ludumdare.com/compo/category/ld-21/">Ludum Dare 21</a> competition tomorrow, I’ll start it by sleeping hehehe because it officially starts at 12am, but I’ll keep the game theme in mind while sleeping.. usually helps with arriving at great ideas the next day :)</p>
<p>I will not be staying up for the whole 48 hours, in fact I’m not planning to change my sleeping habits at all. This way I get 16 hours of sleep and 32 hours of work. Good enough for me.</p>
<p>I’m going to use Flash, and may use the same techniques I’m using in First Defense, in fact I might use a bunch of code files directly from my flash library, but I’m going to have to share it with Ludum Dare community before Ludum Dare 21 starts. Or may be write things from scratch to make the experience more.. pure :D</p>
Timetable Draft 3: Day 22011-08-11T00:00:00+00:00https://zenithsal.com/life/2011/08/11/exp-timetable-draft-3-day-2
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Fantastic! I managed to keep a timetable this time.. yesterday was mostly spent on the way between Cairo and Alexandria, I met a new friend from south korea on board the train, had fun time with the cultural exchange, and got directions to a few korean restaurants in Maadi which serve Kimchi :)</p>
<p>Second day, today, I worked about 10 hours, I can say I really did work for about 7 hours of them? which is still pretty good, working on my Netbook usually goes well from a performance point of view but this time things were a little extra slow and extra unresponsive, turns out I’m out of ram! even though 1GB should be very sufficient for the apps I’m using, something was not right…</p>
<p>Digging deeper, the first thing I discovered was that visual studio 2010 installed a full fledged automatically running SQLServer which alone is taking about 150MB of physical ram in services (ie. it doesn’t even show up in the task manager!), after eliminating it, I went ahead and eliminated Windows services that I don’t use. Things like the Search Indexer (doesn’t work anyway), IE8 (epic fail browser), etc.</p>
<p>Netbook works nicely now, I also had a performance problem playing 720p H.264 decoded video, which I think is classified as HD (1280x720 frame size), I use VLC but for the sake of HD videos on Netbook… get Media Player Classic Home Cinema edition, disable it’s internal filters for H264 and Matroska, install DivX codec pack and disable deblocking, which is an expensive post-decoding filter to eliminate blocky artifacts caused by compression, blocks don’t look that bad anyway in an HD video.</p>
<p>I did the save/load process in First Defense via SharedObject today, which was surprisingly very easy, and completed game pausing with tags, though I’m not very sure about the weak reference implementation which abuses Dictionary keys, I’ll keep a close eye on dangling elements. I have a backup method to pause if the current automated system turns out to be more problem than solution later on.</p>
<p>Today I leave you with an in-depth interview with <a href="https://www.cnet.com/news/markus-notch-persson-the-mind-behind-minecraft-q-a/">Markus Persson and Daniel Kaplan, most wanted men in the game industry for Minecraft.</a></p>
<p>Also I don’t seem to get tired of listening to this by Moderat, it kinda feels like how my brain works on the inside hehehe</p>
<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/11090821&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe>
Experiment: Timetable draft 32011-08-10T00:00:00+00:00https://zenithsal.com/life/2011/08/10/exp-timetable-draft-3
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Yesterday, I didn’t have internet, I sat down and analyzed what was bad about draft 1 timetable. The things I came up with are as follows:</p>
<ul>
<li>It was too restrictive and quite inflexible. Everything depends on how strict I followed the timetable</li>
<li>It didn’t feel like I have a choice for the whole day</li>
<li>Some days I have an errand or two which would happen at a random time, sometimes there is an event or a party that I want to go to, either of these would throw the whole timetable off</li>
<li>There are so many different things to do every week, it causes a bit of confusion, and takes time from the higher priority things.</li>
</ul>
<p>The only advantage of draft 1 timetable, is the balance between creativity and work. Which I admit felt really good, work is stressing, creativity is letting go. But I’m gonna try not to do that this time.</p>
<p>So I first created draft 2, but didn’t like it. I moved to draft 3, and I think it’s a pretty good balance between choice and using 100% of my time.</p>
<p>This time, I have two types of days, work days and fun days. Following the <code class="language-plaintext highlighter-rouge">work hard, play hard</code> idea, I should work for 10 hours in work days, and not work at all during fun days!</p>
<p>Every week, I get 5 days of work, and 2 days of fun. It’s up to me to decide what each weekday is, according to my plans and commitments during that week. Furthermore, each type of days has 2 variations to it, I get to choose either variation. This means there is a fair amount of choice in how each week will look like.</p>
<p>I also identified that I don’t sleep 8 hours everyday, most of the times 7 hours. So I used that additional hour as part of the timetable, while giving myself the option to sleep 8 hours if I was tired and needed it that day.</p>
<p>Here’s the timetable of choices:</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/timetable-3.jpg" alt="Timetable Draft #3" /></p>
<p>I also printed a special calendar to keep track of how everyday goes through.</p>
<p>I’m going to Alexandria in a few hours to my family’s place, this is a big test. It’s hard to keep any kind of time management in there.</p>
Experiment: Timetable Post Mortem 12011-08-08T00:00:00+00:00https://zenithsal.com/life/2011/08/08/exp-timetable-postmortem
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>The timetable experiment was not a big success, maybe only a small one?.. But I think it helps me gauge my time better, I’m now thinking what to do next. Boy this is going to be a long post.</p>
<p>Fact is, I’m a very ambitious man, there is so much I want to do, experience, and master, it may take me my whole lifetime to go through just the major stuff. So now, I’m questioning my tendency to do everything and not abandon any of my interests no matter how silly, which seriously impacts the bigger goals I have.
I think the reason for this tendency is that when I learn and build experience with something for sometime, say 6 months. Then not work on it for a year. Then trying to go back to doing something with it, I discover it’s as if I never really learned and experienced it. This is really frustrating for me, it feels like I lost all those months and now I need to lose more months and put more effort into getting it all back.</p>
<p>The best example I can perhaps give is the Ogre3D graphics engine. I had to relearn it 3 times from scratch distributed over nearly 4 years, and I can’t help it! no matter how much effort and time I put into Ogre3D, 6 months later it’s like I never worked on it, I’m even reluctant to mention experience with Ogre3D in my cv because I know I have to relearn everything! In reality though, everytime I relearn it I understand it more because software development is an incremental skill. Us developers say that at any point in your professional life, if you look back at code you wrote 6 months ago, the stupidity and naivetés will be absolutely shocking :D</p>
<p>I tried to deal with this in the past using what I called “Code Book”, at first it was just a notebook with code snippets I find useful, a C++ logging system for example, that was of course before I became good enough to write what I need myself.</p>
<p>When I didn’t need snippets anymore, code books developed into something else, I used to read something, a book about Direct3D for example, learn each chapter and write examples on it. And after that I would write the essence of what I learned in the code book. This way a chapter of about 50 pages is translated into 8 pages of concentrated knowledge written in a format I understand quickly.
I have many code books I wrote in the past, covering: C/C++, STL, Python, PHP, ColdFusion, UnrealScript, Direct3D9, HTML/CSS/Javascript/SQL, Java, and Assembly
And when I say PHP for example, I’m not only talking about the language itself, rather web development with PHP as a whole. So security, databases, web techniques, etc.. about 100 pages of hand written concentrated information, now that I look at it, it’s really an achievement all by itself, perhaps I should write books out of it?
“Concentrated PHP for Time Travelers” because reading 100 pages in 2 days that contain 800 pages worth of information is time travel :P</p>
<p>Glad I remembered code books, but you know why I stopped doing them? I didn’t need the basics about anything written anymore, all graphics libs work exactly the same, all web technologies work exactly the same, the information I need now is not what things are and how to do them, rather only understanding the architecture of the solution and the levels of flexibility and capabilities it has, most of the time I find that kind of information in the API reference. Still, things as complex as Ogre3D or UnrealEngine3 do things in their own way, most of the time it’s different compared to the common way of doing things. So even if I can see class lists and hierarchy, sometimes I would still not be able to figure out how to access the services provided by a particular feature, I sometimes resort to drastic solutions for this, like reading the engine code.</p>
<p>Back to the issue of forgetting what I learn, you may have noticed I concentrated specifically on software development.. but I also forgot other things/skills like painting, piano, and French, to name a few. How to solve this? Why would I learn a new language/skill if I know I’ll start forgetting it once I stop practicing it?</p>
<p>And here lies the rub, I’m afraid to abandon skills and forget them completely, so I give them time taking away time from important life goals.</p>
Experiment: Sixth Day2011-08-07T00:00:00+00:00https://zenithsal.com/space/2011/08/07/experiment-sixth-day
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Today was, am… not work day, I didn’t even look at the timetable.. shame on me. I’ll write a post-mortem tomorrow detailing my next step.</p>
<p>I spent the day researching the american constellation space program that Obama terminated (I blame Microsoft) which involved going back to the moon by 2030 using our new technology. It’s embarrassing that human space equipment in operation now are mostly 50s and 60s technology, very outdated. Alas, it has been canceled even though it entered the final stages of development.</p>
<p>The idea is developing a new kind of carrier rocket (Ares), and a space ship (Orion). Both are multi-stage.</p>
<p><a href="https://en.wikipedia.org/wiki/Ares_I-X">Ares</a> is a 5 stage space vehicle, the first 4 stages are propellant booster stages, the 5th stage is something called mass simulator, which I’m guessing is used to simulate the actual payload, the space ship, at testing stage.</p>
<p>As for fuel, the first stage uses solid rocket fuel, which is derived from what space shuttles used, while the upper stage uses liquid hydrogen and oxygen.</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/ares-launch-platform.jpg" alt="Ares Launch Platform" /></p>
<p>Now this is kinda of a dumb rocket, its task is to lift the space ship to escape velocity into space, self-disassemble and fall into the ocean. The biggest difference in operation compared to the old <a href="https://en.wikipedia.org/wiki/Space_Shuttle">Space Shuttle</a> is that this one has a smart emergency system allowing aborting the mission in case of catastrophic failure in mid air and returning the carried spacecraft and astronauts safely to earth. This video is showing the latest test of Ares I-X, and the emergency system at work, the count down before launch is amazing!:</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/vQvl0pY8GkM" title="YouTube video player" frameborder="0" allow="accelerometer; encrypted-media; gyroscope" allowfullscreen=""></iframe>
<p>The more complex part of this project is the <a href="https://en.wikipedia.org/wiki/Orion_(spacecraft)">Orion spacecraft</a>. This would perhaps be one of the most advanced spacecrafts built specifically for crew exploration. There are certainly more ambitious designs out there, like the good old <a href="https://en.wikipedia.org/wiki/Project_Orion_(nuclear_propulsion)">Project Orion</a> (different Orion) for example, which uses crazy mini-nuclear explosions for propulsion leaving a trail of deadly radioactive fallout if it operated near the magnetosphere of earth. But they are mostly on paper. While the new Orion was mostly ready for production when the plug was pulled on the constellation program. Its first test flight was supposed to be in 2013.</p>
<p>Orion is known as the <a href="https://en.wikipedia.org/wiki/Crew_Exploration_Vehicle">Crew Exploration Vehicle (CEV)</a> which includes much better life support systems and more advanced computers compared to all other previous crafts.</p>
<p>You can find much more information about Orion if you are curious, <a href="https://www.youtube.com/watch?v=XcPtQYalkcs">take a look at this video from NASA about what it’s about.</a></p>
<p>To get an idea how the whole mission was supposed to be carried through, <a href="https://www.youtube.com/watch?v=Kvalg9kBA9Y">here is an animated demonstration.</a></p>
<p>Through this almost research, I stumbled upon Nazi UFOs conspiracy theory, you see the Nazis somehow managed to establish contact with aliens from a galaxy far far away, and during the contact they managed to get information about super-advanced technology that we don’t know shit about apparently, then they made <a href="http://discaircraft.greyfalcon.us/HAUNEBU.htm">a bunch of flying saucers with it!</a> when they realized they can’t hold anymore and they are losing, they just took their flying saucers and flew to the dark side of the moon, where they now exist, developing advanced deadly technology and planning to one day take over the world. ROFLMAO.. wanna see how this would look like? a Finnish studio is working on a comedy movie about it, <a href="https://www.youtube.com/watch?v=DeAfoiN5SDw">here is one of their trailers. enjoy!</a></p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/moon-nazis.jpg" alt="Moon Nazis" title="Damn Nazis I knew Wolfenstein was preparing us for something" /></p>
<p>Ok, it’s a completely crazy idea that makes my head buzz with internal Darth Vader theme music, but let me tell something to you.. It makes for a HELL-ova game idea!</p>
<p>HUMANITY? I AM DISAPPOINT, WHY U NO GO SPACE? :(</p>
Experiment: Fifth Day2011-08-06T00:00:00+00:00https://zenithsal.com/life/2011/08/06/experiment-fifth-day
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Today started with <a href="https://www.ted.com/talks/matt_cutts_try_something_new_for_30_days">a beautiful TED talk</a> about trying something new for 30 days, I was pumped with excitement! :D</p>
<p>I’m a bit out of energy today for some unknown reason, I don’t remember the specific details of what I did during the first 8 hours! but it involved playing guitar from written musical notes for the first time, I got carried away with the practice and spent nearly 3 hours plucking the strings, my fingers hurt a little and I didn’t feel them by the end of the practice but I could have carried on for 3 more hours. Maybe it’s that TED speech?</p>
<p>Also I watched the first episode from season 1 of <a href="https://en.wikipedia.org/wiki/Sliders">Sliders</a> after recommending it to a friend. Sliders is a sci-fi TV series I loved back in the 90s about some guys who travel between infinite parallel dimension earths, during the first episode the parallel earth they go to has US under Soviet control, turned into a communist nation and they eventually get involved with underground resistance/revolution by imperialists (as the comrades like to say).</p>
<p>The coding problem I had to tackle today was about pausing sound effects in First Defense. Flash wasn’t designed to be a game platform, it’s instead a 2D animation and multimedia platform that we mutilate to make it run games, so it lacks a lot of features necessary for games. I discovered it especially sucks when it comes to playing sounds. There are a ton of problems regarding animation, synchronization, and compression when dealing with sounds in Flash.</p>
<p>Have you ever seen a sound API that doesn’t provide pause/resume functionality? and where you can’t possibly know when sounds get garbage collected during the game? This is outrageous, <a href="https://www.youtube.com/watch?v=QMBZDwf9dok">I’m mad as hell and I’m not gonna take this anymore…</a></p>
<p>Hacking sleeves up, I started looking for dodgy solutions, if only I had weak pointers/references so I keep an eye on Sounds without intervening with garbage collection … wait, Dictionary uses that internally! quick ask Google, hey bro, “weak reference using dictionary as3” plz? and google answers: “About 32,500 results (0.28 seconds)”.. love this guy ^_^ problem solved, even though implementation is still a bit buggy.</p>
<p>Next challenge: pausing Flint particles, the creator of <a href="https://github.com/richardlord/Flint">Flint</a> had the common sense to include a pause/resume mechanism, so it should be easy.</p>
<p>I had to go to university today, about time to ask about graduation procedures. I go ask, they say “not now come back on the 13th”.. But I shaved and wore clothes today! shame on you university :’(</p>
<p>Visiting university after graduation is a surreal experience, it’s like visiting the past or travelling back in time. I felt completely weirded out for some reason, but wait.. I always feel weirded out in university.</p>
<p>While I was looking for an Action Script 3 sound system library today, <a href="http://web.archive.org/web/20170421121146/http://www.adrianparr.com/?p=83">I found this wonderful list</a>. Check out those hot.. augmented reality libraries, imagine using those card like print-outs to play an RPG, where each card represents a magic attack or something, and you can then show those cards to your webcam and the magic will be carried out! Then you get to combine two cards or something to create more powerful attacks (AR libs can read more than one card), then you can use a card that will turn into a sword on screen which you can then move to hack-n-slash everyone. It’s gonna be epic, it’s gonna have brown-HDR and eye popping bloom, and it’s gonna be an MMORPG.
Funding? call 1-800-IWANTFERRARI now</p>
Experiment: Fourth Day2011-08-05T00:00:00+00:00https://zenithsal.com/life/2011/08/05/experiment-fourth-day
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Huh!? but where is the third day?</p>
<p>lol, I don’t know it just got lost somewhere, I considered it my day off or something. Which means today is work day! however, not much coding took place.. the reason is that I wanted to update Flash, and that process had fallout like FlashDevelop acting weird (turns out I must update it too) among other issues like my C: running out of juice, windows 7 somehow managed to suck nearly 50GB alone. I blame Microsoft.. again.</p>
<p>Today I set out on a witch-hunt to address Runtime Shared Library issues (RSL in short) specifically TLFText which I now hate, it has been causing us problems constantly with streaming,.. ultimately my efforts failed. And I reverted to just merging the RSL components with the SWF for now. The weird thing is that it seems the object that represents RSL preloading events (namely RSLEvent) exists in two libraries mx.events.RSLEvent and fl.events.RSLEvent, why?</p>
<p>Guitar practice is continuing at a good pace, my finger tips are better at taking the pressure now but quick cord changes are still bloody impossible and my left arm tires quickly. I haven’t yet “felt” the guitar if that makes any sense, I’m practicing though, may be one day it’ll happen. :)</p>
<p>Today’s musician is Darko, an Egyptian music composer who is a friend of Islam (multi-talented developer working with me on FirstDefense), Darko’s music is wonderful! to me it feels like Ambient with a touch of sci-fi, some tracks are piano/jazz flavored, others are more electronic. I’m sure there is a name for his music style, but who said I’m a music nerd? :D</p>
<p>Here, listen and enjoy: <a href="https://soundcloud.com/progressivedarko">Darko</a></p>
<p>I’m considering participating in the next <a href="https://ldjam.com/">Ludum Dare</a>, which is a dual-game making competition/jam held every 4 months. The competition imposes interesting rules:</p>
<blockquote>
<p>You must work alone (solo)
All game code and content must be created within 48 hours. Base-code and libraries are allowed on the condition that you announce them before the competition starts and share them with all other competitors.
Games must be based on the theme, which is announced before the competition starts.
All libraries, middleware, content creation, and development tools are allowed.
Source code must be included. (yay! closed source devs will hate it :D)</p>
</blockquote>
<p>Next competition is exactly in 14 days, 20 hours, 37 minutes, 52 seconds (and 233ms), which happens to be 19th of August, and lasts till 22nd of August.</p>
<p>My solution of choice is as usual, PyGame. Did I say I love Python? =)
(even though I admit I’m liking Flash as a rapid development solution)</p>
Experiment: Second Day2011-08-03T00:00:00+00:00https://zenithsal.com/life/2011/08/03/experiment-second-day
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>A mysteriously crashed Windows 7 which meant the Alarm software didn’t sound the alarm, AND the mobile battery is dead… meant I didn’t wake-up, and when I finally did, it was 3PM and I started cursing Microsoft for how long I slept (for once it wasn’t completely their fault, only partially, but they still get cursed. My rules).</p>
<p>Things went downhill from there, the whole day was backwards timetable wise, I started by spending 2 hours researching an idea of a music-based abstract game I’m planning for sometime now, a producer/music composer by the nickname hektikbeatz contacted me expressing his interest in collaborating in such a project if it ever became reality, take an eavesdrop here: <a href="https://hektikmusic.newgrounds.com/audio">Hektik Music</a></p>
<p>I did try to contact local Egyptian bands about a month ago (most of them here play metal) and explain my idea, but couldn’t get any pulse back, they either are too scared to try something new or just not interested, don’t know, but seems like the idea could live online even though I really prefer real world face-to-face work. That way I could storm their homes and pull them from their feet out of their beds into a cafe and “WORK NAW!” while pointing and showing a serious facial expression.</p>
<p>Going back to timetable, afterwards, I went out to get food because it was almost sunset and I didn’t have any eatable substances in my fridge. This means I took a rest, then went out, exactly the opposite of todays timetable.</p>
<p>Why stop? I just kept going backwards, into 3 hours of work on FirstDefense, then 2 hour of Guitar Learning instead of 3D modeling, because when I started Blender after nearly 8 months of not touching a modeling package, I went blank and panicked..</p>
<p>Followed that by 3 more hours of work on FirstDefense, which ended 30 minutes ago.</p>
<p>I should be studying psychology for 3 hours… though because it’s 4am, I may end up sleeping to fix what Microsoft did to my sleep (bad bad Microsoft). But I’ll try reading a bit, thinking of mining: My Voice Will Go With You -The Teaching Tales Of Milton Erickson by Sidney Rosen, Milton Erickson rocks =)</p>
Experiment: First Day2011-08-01T00:00:00+00:00https://zenithsal.com/life/2011/08/01/experiment-first-day
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>Things went surprisingly well! mostly… ehm… er.. I didn’t exactly stick to schedule, here’s how it went:</p>
<p>Waking up like a soldier, I was shaved, showered, worked-out, and started working within 15 minutes of bailing out of bed. Work and creative endeavors were so successful and precise to the minute (and my fingers are killing me after trying a few guitar chords), but I slacked in the AI study part, the two reasons I blame are: finding a russian band willing to compose awesome post-rock instrumental music pieces for games for the shear fun of it, and they are looking for a developer to participate.. ding ding ding proximity alert :D</p>
<p>Here, take an eavesdrop: <a href="https://soundcloud.com/iwfyls">IWFYLS</a></p>
<p>Second reason is Khawater Season 7, the only reality TV show that may one day change the world for the better, at least our world.. and the only thing on tv that makes me wip-out that old dusty forgotten tv and its abandoned friend the sat receiver and tinker with them until they start. But the show is so short :( how I wish it lasts an hour or something. And the advertisements…. it seems to have gone from bad to worse to the point it makes tv completely unwatchable for me, well back to no tv, much better life.</p>
<p>I really liked how mandebt analyzed the tv situation today here <a href="http://manvsdebt.com/ditch-the-television/">http://manvsdebt.com/ditch-the-television/</a></p>
<p>After admitting I’m an anti-tv activist, and inviting you kindly to join the resistance, I conveniently distracted you so you won’t ask me what happened to the rest of the time schedule.</p>
<p>Note to self: gotta write something anti-tv soon</p>
Student Life and Time Experimenting2011-07-31T00:00:00+00:00https://zenithsal.com/life/2011/07/31/student-life-and-time
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>I’ve been living as a student for more than 20 years, 8 of them in University… I spent about 4 years jumping around majors, universities, and countries. This tends to embed loads of bad habits specific to students, like the habit of depending on university to control my sleep times, or the homeless-like life of eating what you can find when and wherever you may find it (my favorite hehehe).</p>
<p>About a month ago, I finished my degree, no more student status.. everything suddenly stopped, and I found myself in this twilight zone of “<em>OMG what the hell is happening??</em>”</p>
<p>I mean sure I can trick myself into believing it’s only a summer vacation (which instantly means it’s time to get crazy and have fun anyway possible) and later this year it’s all gonna be just a dream and I’ll wakeup finding myself back in university and troubled with Midterms and Finals and whatnot just like the not-so-old days.</p>
<p>In fact, I could trick myself into believing that much easier than trying to accept the facts which seems too sci-fi for me.. (the subconscious goes like: HUH? Me? no more study or exams? naaah… you’re wrong somewhere)</p>
<p>But I know it’s a fact…… maybe?</p>
<p>This is like a defacto struggle that all tough-majored students must face and conquer, here’s how it looked like from noticing my friends who graduated before me:</p>
<blockquote>
<p>Clenching to the student life, trying to keep everything as it was, seeking continuity and not liking to go into the unknown world of “your time is actually yours now kiddo!”
Things go out of control, in a chaotic way, sleeping, eating, life in general (I think that is where I am)
Somehow surviving all that without a terminal disease, and then just accepting the new state, but not before a long tiring battle with looking-for-a-job and creating-a-new-lifestyle.</p>
</blockquote>
<p>I wish I can afford the time it takes to battle with that and accept it, but since I’m trying to finish my first commercial game which I put a lot of work into already and the hard part is over… I can’t afford to abandon it until my life gets back into order.</p>
<p>Being essentially an engineer (only essentially though), I’ve always been in favor of tables, data, schedules, and detailed numeric specific stuff in general (also known as Engineers Syndrome or E.S. -don’t search for it I totally made it up-). So I sat down a few days and devised a timetable-plan that I’m gonna try as an experiment…</p>
<p>But why did I go loud here all of a sudden? hell.. I admit it, I like writing and I usually do it in text-files which you can find scattered everywhere addressable by memory on my computers, mostly they go in crap-i-forgot-i-wrote-that land. This particular plan I want to archive the details here, so it doesn’t face that destiny and frankly because putting it somewhere people can actually see should hopefully lessen the chances of an eventual epic fail.</p>
<p>Here’s is the plan, I am to follow the following timetable while writing daily follow-up logs here that can later be used to devise a new enhanced follow-up timetable, it is iterative design in practice :D (and too much following)</p>
<p>The experiment will go for a week starting from tomorrow: Monday, August 1, 2011 and should end at next Monday with an epic fail or a mild success (epic win is not to be expected)</p>
<p>Timetable:</p>
<p><img src="https://zenithsal.com/assets/photos/tumblr/timetable-1.jpg" alt="Timetable" /></p>
<p>You can see I mixed activities in an interesting way.. I did that trying to satisfy both the need to work and the need to be creative.</p>
<p>This is a psychological/kinda-biological principle, the right half of the brain is engaged when you play in a creative way or do something non-linear, unexpected or artsy. While the left half of the brain likes reality, logic, linearity, and predictability (aka boring), both halves should be engaged equally during the day in order to achieve balance.
And the third part is rest, which allows the integration of what you learned and experienced during the day :)</p>
<p><a href="http://web.archive.org/web/20190116154120/http://web-us.com/brain/lrbrain.html">More Information: Left Vs. Right</a></p>
<p>Ouch, took me about an hour and a half to write this post, got to learn to cut down that time…</p>
Running Over Limits2011-04-02T00:00:00+00:00https://zenithsal.com/gamedev/2011/04/02/running-over-limits
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>I may have mentioned I’m developing my first flash game which will be released on Kongregate (or similar game portals), since this is the first one I wanted something small and simple that would take about a month to develop and polish including actually learning Flash and ActionScript…</p>
<p>When I started working, I took the simplest candidate idea I had, and under the principle of K.I.S.S. (Keep It Stupidly Simple) I overran all my limits.</p>
<p>Started with something small and simple, but I didn’t like the way it looked and played, so I thought I’ll try to give its look’n’feel a makeover. I restarted coding from scratch (and that turned out to be a very good idea since my initial noob code was horrible), and I redesigned how the game looks, but I went too far with the design, and mind you I’m no artist…</p>
<p>A few days later I realized how much artistic trouble I got myself into, I sent an S.O.S. to my friends looking for a brave Photoshopist, and no one stepped forward! (now if this was a movie, 300 brave men would step forward, fully clothed hopefully)</p>
<p>Here is how the old design looked:</p>
<p><img src="https://zenithsal.com/assets/screenshots/firstdefense/first-defense-test-1.jpg" alt="First Defense test" /></p>
<p>And here is the new one:</p>
<p><img src="https://zenithsal.com/assets/screenshots/firstdefense/first-defense-test-2.jpg" alt="First Defense new look" /></p>
<p>The new water is animated using a perlin noise + displacement filter, very bad for performance and violently impacts the fps even on my 3 core desktop..! tried to optimize using 3 different methods and still came out with nothing.</p>
<p>So yeah, I’m in trouble.. but I’ll try the only thing I have: my best</p>
Hello Kongregate2011-03-22T00:00:00+00:00https://zenithsal.com/gamedev/2011/03/22/hello-kongregate
<p><strong>This post is migrated here from my 2011 blog</strong></p>
<p>So here I was wondering today what steps are needed to upload a game to say.. Kongregate? and what can I change later? No better way to know than to actually upload a test game.. appropriately I have First Defense test lying around which served it’s purpose as concept grounds.. and.. done! here: <a href="http://www.kongregate.com/games/ZenithSal/first-defense-test">First Defense Test</a></p>
<p>This doesn’t look anywhere near the actual First Defense I’m working on now, but the basic gameplay mechanic involving directing and firing a cannon is the basis on which both stand.</p>
<p>Today, I got two highlights about ActionScript 3:</p>
<ol>
<li>
<p>Flash performance isn’t great, the only thing that could be slower is perhap Pygame/Python.. It’s better to plan to remedy this early so the product is playable on performance limited devices, like netbooks for example.</p>
</li>
<li>
<p>Flash wasn’t made for games, thus there are things that are trivial to do when using other solutions but could waste serious time and effort in Flash. An example of one of those things is how to pause the game and show a pause menu?</p>
</li>
</ol>
<p>I’ll finish this post with a link to a small and useful ActionScript3 library, its task is to implement and run finite state machines, here:</p>
<p><a href="https://github.com/cassiozen/AS3-State-Machine">https://github.com/cassiozen/AS3-State-Machine</a></p>
<p>Happy Coding!</p>