{"id":590,"date":"2011-09-28T19:00:00","date_gmt":"2011-09-28T18:00:00","guid":{"rendered":"http:\/\/shadowcovenant.com\/blog\/2011\/09\/28\/porting-issues\/"},"modified":"2011-09-28T19:00:00","modified_gmt":"2011-09-28T18:00:00","slug":"porting-issues","status":"publish","type":"post","link":"http:\/\/shadowcovenant.com\/blog\/2011\/09\/28\/porting-issues\/","title":{"rendered":"Porting issues&hellip;"},"content":{"rendered":"<p align=\"justify\">Since my artist is still out of commission (and probably will be for another month), I\u2019ve been doing mainly technical things\u2026<\/p>\n<p align=\"justify\">Since I was feeling lazy and didn\u2019t want to add the tutorial code yet (since that\u2019s GUI work, and I hate GUI work), I\u2019ve decided to start porting \u201cCell.ection\u201d (if I haven\u2019t mentioned it yet, that\u2019s the current name for the game, although we\u2019re still arguing between \u201cCell.ection\u201d, \u201cCell.Action\u201d, \u201cCellection\u201d, with different types of writing styles) to personal computers (Windows, Mac, Linux are the targets).<\/p>\n<p align=\"justify\">Decided to start with the easy one: Windows, and I partially succeeded\u2026<\/p>\n<p align=\"justify\"><a href=\"http:\/\/shadowcovenant.com\/blog\/wp-content\/uploads\/2011\/09\/Amoeba_PC.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"Amoeba_PC\" border=\"0\" alt=\"Amoeba_PC\" src=\"http:\/\/shadowcovenant.com\/blog\/wp-content\/uploads\/2011\/09\/Amoeba_PC_thumb.jpg\" width=\"521\" height=\"426\" \/><\/a><\/p>\n<p align=\"justify\">Found several problems:<\/p>\n<ul>\n<li>\n<div align=\"justify\">A small bug: I deleted an object from itself (\u201cdelete this\u201d), but I set the animation of that object to false afterwards\u2026 curiously enough, this didn\u2019t raise an exception, but it crashed (or more precisely, Visual Studio raised an exception because it detected memory that should have been free altered) because of memory corruption\u2026 This behavior didn\u2019t happen on the mobile version because apparently Marmalade doesn\u2019t use the same trick to track this kind of problems.       <br \/>On allocation (and on debug mode), VS initializes memory to zero, and when a de-allocation occurs, it sets that space to a familiar pattern (like all bytes set to 0xAE or something like that). When an allocation occurs, the system verifies that all the bytes are set to 0xAE, if not someone messed with that memory address after it was released and raises an exception. It\u2019s a neat trick\u2026 In this case, messing with the memory like I was doing wasn\u2019t a serious issue (hence no big issue in the mobile), since I deleted the object and set a boolean value to false, so I couldn\u2019t corrupt any new objects in the process, but it could mean something serious. Ah, obviously enough, the heap is all initialized with that mask (or else the first allocation would raise an exception).<\/div>\n<\/li>\n<li>\n<div align=\"justify\">If you look at the screenshot above, the GUI is all compressed\u2026 That was a trick to get it to render at all\u2026 I didn\u2019t remember, but the D3D API doesn\u2019t allow for negative values on the viewport settings, and that was what I was using to simplify my multi-resolution, aspect-ratio agnostic system\u2026 So I\u2019ll have to change the way this works (probably by shifting the viewport to be all positive, and offsetting the objects there to reach the same visual result).<\/div>\n<\/li>\n<li>\n<div align=\"justify\">The fonts look terrible, due to the larger screen size\u2026 they probably look terrible on the mobile as well, but it doesn\u2019t show because the screens are smaller. Need to work something out on this, probably change my bitmap font generator so that it does some multisampling on the fonts, or maybe integrate OpenType to build the fonts in real time from TrueType fonts, adjusting to the resolution.<\/div>\n<\/li>\n<li>\n<div align=\"justify\">No cursor\u2026 In mobiles, we don\u2019t need\/want a cursor, but in a mouse based system, it\u2019s kind of necessary\u2026 Not only that, but some feedback on the buttons when the mouse is over them is also a bit necessary\u2026 This implies having some \u201cifdef\/endif\u201d blocks in the code, which is kind of ugly\u2026 Of course I could do this data driven, but sounds a bit like overkill for something like this.<\/div>\n<\/li>\n<li>\n<div align=\"justify\">File directory structure\u2026 Marmalade assumes that all files in a certain \u201cdata\u201d directory will be packed into the package for mobiles\u2026 Problem is that if I use the same paths on the mobile and PC version, I need to have some DLLs on that directory (FMod, for example), which sucks big time\u2026 Probably need to think a bit better on the directory structure, specially to see if I can sort out some kind of override system so that I can have different assets for different platforms (more resolution on the fonts, for example), while keeping the common part together\u2026<\/div>\n<\/li>\n<\/ul>\n<p align=\"justify\">&#160;<\/p>\n<p align=\"justify\">This is one of the reasons why this project is so interesting from a learning perspective\u2026 Although the code part of it was ported without needing many changes, just create a new VS project and dump the files there, there are still lots of small issues associated with multi-platform deployments that must be addressed (and now is a good time, since I can still change the way SurgeED works to do a better job at this multi-platform asset management).<\/p>\n<p align=\"justify\">I\u2019ve also been working on a second port, this time from PC to mobile\u2026 An old (unreleased) casual game of mine:<\/p>\n<p align=\"justify\"><a href=\"http:\/\/shadowcovenant.com\/blog\/wp-content\/uploads\/2011\/09\/MainScreen_2011.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"MainScreen_2011\" border=\"0\" alt=\"MainScreen_2011\" src=\"http:\/\/shadowcovenant.com\/blog\/wp-content\/uploads\/2011\/09\/MainScreen_2011_thumb.jpg\" width=\"587\" height=\"475\" \/><\/a><\/p>\n<p align=\"justify\">The game won\u2019t work on smartphones, but it\u2019s a good match for tablets\u2026 Currently, I\u2019m just trying to get the old code compiled with the latest version of Spellbook, but even that\u2019s been proving hard, specially because of the font, since I changed it a year and a half ago (so that includes the concept of character metrics). Problem is that the <u>hand-worked<\/u> fonts of Something Fishy were done with the old system and while they worked well with that, they miss information necessary to work nicely with current Spellbook\u2026 <\/p>\n<p align=\"justify\">Need to fix that, either by generating the missing information, reverting that component to an old state (if I can find an old version of Spellbook pre-change), or *shiver* adding by hand the information\u2026<\/p>\n<p align=\"justify\">Finally, also been thinking a lot on the new Image Bank system for Spellbook\u2026 I need a way to make it \u201cmulti-layer\u201d, so I can have normal maps with the images aswell (some nifty 2d effects and for use with decals)\u2026 To do so, I want to add an Image Bank editor\/generator into SurgeEd, but I need to think if an Image Bank is a component or a resource (probably both)\u2026 I already have a Font Generator in the SurgeEd, but I don\u2019t like the way that turned out, so I\u2018m thinking to handle any resource editing as a separate component of the editor, with its own specific subsystems, but I haven\u2019t made up my mind yet\u2026<\/p>\n<p align=\"justify\">So stay tuned for more developments!<\/p>\n<div id=\"tweetbutton590\" class=\"tw_button\" style=\"\"><a href=\"http:\/\/twitter.com\/share?url=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2011%2F09%2F28%2Fporting-issues%2F&amp;text=Porting%20issues%26hellip%3B&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2011%2F09%2F28%2Fporting-issues%2F\" class=\"twitter-share-button\"  style=\"width:55px;height:22px;background:transparent url('http:\/\/shadowcovenant.com\/blog\/wp-content\/plugins\/wp-tweet-button\/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;\">Tweet<\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>Since my artist is still out of commission (and probably will be for another month), I\u2019ve been doing mainly technical things\u2026 Since I was feeling lazy and didn\u2019t want to add the tutorial code yet (since that\u2019s GUI work, and I hate GUI work), I\u2019ve decided to start porting \u201cCell.ection\u201d (if I haven\u2019t mentioned it [&hellip;]<\/p>\n<div id=\"tweetbutton590\" class=\"tw_button\" style=\"\"><a href=\"http:\/\/twitter.com\/share?url=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2011%2F09%2F28%2Fporting-issues%2F&amp;text=Porting%20issues%26hellip%3B&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2011%2F09%2F28%2Fporting-issues%2F\" class=\"twitter-share-button\"  style=\"width:55px;height:22px;background:transparent url('http:\/\/shadowcovenant.com\/blog\/wp-content\/plugins\/wp-tweet-button\/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;\">Tweet<\/a><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,6],"tags":[],"class_list":["post-590","post","type-post","status-publish","format-standard","hentry","category-development","category-games"],"_links":{"self":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/posts\/590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/comments?post=590"}],"version-history":[{"count":0,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/posts\/590\/revisions"}],"wp:attachment":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/media?parent=590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/categories?post=590"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/tags?post=590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}