{"id":679,"date":"2016-08-20T21:20:09","date_gmt":"2016-08-20T21:20:09","guid":{"rendered":"https:\/\/astrofra.com\/wordpress\/?p=679"},"modified":"2016-08-20T21:20:09","modified_gmt":"2016-08-20T21:20:09","slug":"lua-remake-of-an-amiga-cracktro","status":"publish","type":"post","link":"https:\/\/astrofra.com\/wordpress\/index.php\/2016\/08\/20\/lua-remake-of-an-amiga-cracktro\/","title":{"rendered":"Lua remake of an Amiga cracktro"},"content":{"rendered":"<p>Recently, I wanted to test the <a href=\"https:\/\/www.harfang3d.com\/doc\/0.9.8\/Plus.html\" rel=\"nofollow\">Plus wrapper<\/a> of <a href=\"https:\/\/www.harfang3d.com\/\" target=\"_blank\">Harfang<\/a> on a simple project, and I found that I could try to remake an ancient <a href=\"https:\/\/en.wikipedia.org\/wiki\/Amiga\" rel=\"nofollow\">Amiga <\/a>cracktro I used to enjoy back in the days.<\/p>\n<p>[youtube]https:\/\/www.youtube.com\/watch?v=NJjQM982S6s[\/youtube]<\/p>\n<p><strong>Starfield!<\/strong><br \/>\nThe starfield is a simple list of 3D points on which a vector is applied each frame, transformed from 3D to 2D and displayed using 2D sprites. The 3D to 2D projection works the usual way :<br \/>\n<code><br \/>\nx2d = (a.x * zoom) \/ a.z<br \/>\ny2d = (a.y * zoom) \/ a.z<br \/>\n<\/code><\/p>\n<p>There&#8217;s room for an optimization, as the whole list of sprites could be drawn as a unique batch. If more performance was needed, for several thousands of stars for example, DrawSpriteAuto() would really work faster.<\/p>\n<p><strong>Music!<\/strong><br \/>\nThe venerable ProTracker module, available on the Exotica archives, was converted to the XM format and replayed easily in Harfang, using the following instruction :<\/p>\n<p style=\"padding-left: 30px;\"><code>al:Stream(\"assets\/unit5.xm\")<\/code><\/p>\n<p><strong>Let&#8217;s Scroll!<\/strong><br \/>\nThe scroll text, finally, was made easy to render thanks to the <em>Plus<\/em> wrapper, by blitting each glyph to the screen. The original font was grabbed from the original cracktro using a memory snapshot from the WinUAE emulator.<\/p>\n<p>Each glyph is then drawn, using :<\/p>\n<p style=\"padding-left: 30px;\"><code>Blit2D()<\/code><\/p>\n<p>This remake is not 100% accurate as the scope of this project was more focused on using the <em>Plus<\/em> wrapper than being in competition with the most excellent <a href=\"http:\/\/www.flashtro.com\/index.php?e=page&amp;id=54\" rel=\"nofollow\">Flashtro<\/a> project.<\/p>\n<p>Here is the <strong>Win64<\/strong> release :<br \/>\n<a class=\"onebox\" href=\"http:\/\/fra.planet-d.net\/prods\/Unit-A-Interceptor-Win64.zip\" target=\"_blank\" rel=\"nofollow\">http:\/\/fra.planet-d.net\/prods\/Unit-A-Interceptor-Win64.zip<\/a><\/p>\n<p>Here is the source code on <strong>Github<\/strong> :<br \/>\n<a class=\"onebox\" href=\"https:\/\/github.com\/astrofra\/harfang-lua-experiments\/tree\/master\/unit-a-interceptor-remake\/src\" target=\"_blank\" rel=\"nofollow\">https:\/\/github.com\/astrofra\/harfang-lua-experiments\/tree\/master\/unit-a-interceptor-remake\/src<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I wanted to test the Plus wrapper of Harfang on a simple project, and I found that I could try to remake an ancient Amiga cracktro I used to enjoy back in the days. [youtube]https:\/\/www.youtube.com\/watch?v=NJjQM982S6s[\/youtube] Starfield! The starfield is a simple list of 3D points on which a vector is applied each frame, transformed &hellip; <a href=\"https:\/\/astrofra.com\/wordpress\/index.php\/2016\/08\/20\/lua-remake-of-an-amiga-cracktro\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Lua remake of an Amiga cracktro<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[],"class_list":["post-679","post","type-post","status-publish","format-standard","hentry","category-demoscene","category-prog"],"_links":{"self":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/679"}],"collection":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=679"}],"version-history":[{"count":1,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/679\/revisions"}],"predecessor-version":[{"id":680,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/679\/revisions\/680"}],"wp:attachment":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}