Last active
April 6, 2024 14:07
-
-
Save raysan5/fdefbe1b8184e0fa80676156bb86964f to your computer and use it in GitHub Desktop.
Revisions
-
raysan5 revised this gist
Nov 29, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -190,7 +190,7 @@ In the case the code was ported to C++, then it would be possible to compile tho <br> ## Conclusions Porting those old games has been an interesting exercise, I reviewed some old code and some decisions I took long time ago and I saw how my mindset has changed in all those years. When I started coding games, I thought I would write more "complex" code as more I learned but it has been the other way round! **As more I learn I write simpler code with better engineered structures**. -
raysan5 revised this gist
Nov 29, 2021 . 1 changed file with 11 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -188,7 +188,9 @@ The current code of `FLIPS` and `DART that TARGET` is quite simple and quite sma In the case the code was ported to C++, then it would be possible to compile those games to `WebAssembly` and **run them on web**. Very tempting! 😜 <br> ## Conclusions, Porting those old games has been an interesting exercise, I reviewed some old code and some decisions I took long time ago and I saw how my mindset has changed in all those years. When I started coding games, I thought I would write more "complex" code as more I learned but it has been the other way round! **As more I learn I write simpler code with better engineered structures**. @@ -198,16 +200,17 @@ Finally, after almost 10 years since those games were first published, I've been #### _Links to the published games_ <div style="display:inline-block;width:900px;"> <a href="https://play.google.com/store/apps/details?id=com.emegeme.dart" target="_blank"><img align="left" style="float:left;" src="https://user-images.githubusercontent.com/5766837/143846273-a3f2431b-68c5-4940-a5b3-272525943fd2.png" alt="DART that TARGET - Android" width="173px"></a> <a href="https://play.google.com/store/apps/details?id=com.emegeme.flips" target="_blank"><img align="left" style="float:left;" src="https://user-images.githubusercontent.com/5766837/143846341-6e003294-b848-463f-b17a-2d74053cca50.png" alt="FLIPS - Android" width="173px"></a> <a href="https://raysan5.itch.io/dart-that-target" target="_blank"><img align="left" style="float:left;" src="https://user-images.githubusercontent.com/5766837/143846752-5ad039b3-291d-48b7-ad2e-e7cabefa9379.png" alt="DART that TARGET - Desktop" width="173px"></a> <a href="https://raysan5.itch.io/flips" target="_blank"><img align="left" style="float:left;" src="https://user-images.githubusercontent.com/5766837/143847076-76a219b0-818f-4aa9-97ea-2201e3af35c1.png" alt="FLIPS - Desktop" width="173px"></a> </div> <br><br><br><br><br><br><br><br> _This article is licensed as [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/), which is one of the licenses in the [Creative Commons](https://creativecommons.org/) family._ -
raysan5 revised this gist
Nov 29, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -206,7 +206,7 @@ Finally, after almost 10 years since those games were first published, I've been <a href="https://raysan5.itch.io/flips" target="_blank"><img align="left" style="float:left;margin:25px;" src="https://user-images.githubusercontent.com/5766837/143847076-76a219b0-818f-4aa9-97ea-2201e3af35c1.png" alt="FLIPS - Desktop" width="173px"></a> _This article is licensed as [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/), which is one of the licenses in the [Creative Commons](https://creativecommons.org/) family._ -
raysan5 revised this gist
Nov 29, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -196,7 +196,7 @@ It was also very refreshing to change for a couple of weeks from libraries and t Finally, after almost 10 years since those games were first published, I've been able to give them a second life; some more people in the world will be able to play them and enjoy them. It just feels good. 😄 #### _Links to the published games_ <a href="https://play.google.com/store/apps/details?id=com.emegeme.dart" target="_blank"><img align="left" style="float:left;margin:25px;" src="https://user-images.githubusercontent.com/5766837/143846273-a3f2431b-68c5-4940-a5b3-272525943fd2.png" alt="DART that TARGET - Android" width="173px"></a> -
raysan5 revised this gist
Nov 29, 2021 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -198,5 +198,16 @@ Finally, after almost 10 years since those games were first published, I've been ### _Links to the published games_ <a href="https://play.google.com/store/apps/details?id=com.emegeme.dart" target="_blank"><img align="left" style="float:left;margin:25px;" src="https://user-images.githubusercontent.com/5766837/143846273-a3f2431b-68c5-4940-a5b3-272525943fd2.png" alt="DART that TARGET - Android" width="173px"></a> <a href="https://play.google.com/store/apps/details?id=com.emegeme.flips" target="_blank"><img align="left" style="float:left;margin:25px;" src="https://user-images.githubusercontent.com/5766837/143846341-6e003294-b848-463f-b17a-2d74053cca50.png" alt="FLIPS - Android" width="173px"></a> <a href="https://raysan5.itch.io/dart-that-target" target="_blank"><img align="left" style="float:left;margin:25px;" src="https://user-images.githubusercontent.com/5766837/143846752-5ad039b3-291d-48b7-ad2e-e7cabefa9379.png" alt="DART that TARGET - Desktop" width="173px"></a> <a href="https://raysan5.itch.io/flips" target="_blank"><img align="left" style="float:left;margin:25px;" src="https://user-images.githubusercontent.com/5766837/143847076-76a219b0-818f-4aa9-97ea-2201e3af35c1.png" alt="FLIPS - Desktop" width="173px"></a> -
raysan5 revised this gist
Nov 29, 2021 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -196,3 +196,7 @@ It was also very refreshing to change for a couple of weeks from libraries and t Finally, after almost 10 years since those games were first published, I've been able to give them a second life; some more people in the world will be able to play them and enjoy them. It just feels good. 😄 ### _Links to the published games_ <a href="https://play.google.com/store/apps/details?id=com.emegeme.dart" target="_blank"><img align="left" src="https://user-images.githubusercontent.com/5766837/143844504-711dd95c-8113-42c9-8f18-3f75fb359f9e.png" alt="DART that TARGET - Android" width="173px"></a> -
raysan5 revised this gist
Nov 28, 2021 . 1 changed file with 0 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,3 @@  # Game Porting Adventures -
raysan5 revised this gist
Nov 28, 2021 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,14 @@ <meta name="twitter:card" content="summary" /> <meta name="twitter:image" content="https://user-images.githubusercontent.com/5766837/142780107-2ad191f9-12ee-433a-8ecb-139d62f566cd.png" /> <meta name="twitter:site" content="@raysan5" /> <meta name="twitter:creator" content="@raysan5" /> <meta property="og:description" content="Game porting adventures | Article by ramon Santamaria (@raysan5)" /> <meta property="og:site_name" content="emegeme" /> <meta property="og:title" content="Game porting adventures" /> <meta property="og:type" content="article" /> <meta property="og:url" content="https://gist.github.com/raysan5/fdefbe1b8184e0fa80676156bb86964f" /> <meta property="og:image" content="https://user-images.githubusercontent.com/5766837/142780107-2ad191f9-12ee-433a-8ecb-139d62f566cd.png" />  # Game Porting Adventures -
raysan5 revised this gist
Nov 28, 2021 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -184,9 +184,7 @@ If the game was ported to `raylib-cs` and considering that `raylib` C/C++ can be <img align="left" src="https://user-images.githubusercontent.com/5766837/143787264-97762e9d-915a-47a2-bdef-a3c7caadece9.png" alt="WebAssembly Logo" width="220px"> The current code of `FLIPS` and `DART that TARGET` is quite simple and quite small, it's contained in about **6000 lines of code**. A complete port to C++ and `raylib` wouldn't be that complicated. Most of the C# classes map directly to C++ classes and the **code structure is very simple**. Actually, the only inheritance used is for the different screens from a base `GameScreen` to simplify `ScreenManager` management code and for the flipping panel cards used as menus in game. In the case the code was ported to C++, then it would be possible to compile those games to `WebAssembly` and **run them on web**. Very tempting! 😜 -
raysan5 revised this gist
Nov 28, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -192,9 +192,9 @@ In the case the code was ported to C++, then it would be possible to compile tho ## Conclusions Porting those old games has been an interesting exercise, I reviewed some old code and some decisions I took long time ago and I saw how my mindset has changed in all those years. When I started coding games, I thought I would write more "complex" code as more I learned but it has been the other way round! **As more I learn I write simpler code with better engineered structures**. It was also very refreshing to change for a couple of weeks from libraries and tools development in C to games development again. I had almost forgotten how fun it is to make games! It was also very nice to learn about (and actually do) all the publishing work for several different platforms, I like the feeling of a game release! Finally, after almost 10 years since those games were first published, I've been able to give them a second life; some more people in the world will be able to play them and enjoy them. It just feels good. 😄 -
raysan5 revised this gist
Nov 28, 2021 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -182,7 +182,7 @@ If the game was ported to `raylib-cs` and considering that `raylib` C/C++ can be ### Path 3: Porting to `C/C++` <img align="left" src="https://user-images.githubusercontent.com/5766837/143787264-97762e9d-915a-47a2-bdef-a3c7caadece9.png" alt="WebAssembly Logo" width="220px"> The current code of `FLIPS` and `DART that TARGET` is quite simple and quite small, it's contained in about **6000 lines of code**. A complete port to C++ and `raylib` wouldn't be that complicated. @@ -192,7 +192,9 @@ In the case the code was ported to C++, then it would be possible to compile tho ## Conclusions Porting those old games has been an interesting exercise, I reviewed some old code and some decisions I took long time ago and I saw how my mindset has changed in all those years. When I started coding games, I thought I would write more "complex" code as more I learned but it has been the other way round! As more I learn I write simpler code with better engineered structures. It was also very refreshing to change for a couple of weeks from libraries and tools development in C to games development again. I had almost forgotten how fun is making games. It was also very nice to learn about (and actually do) all the publishing work for several different platforms, I like the feeling of a game release! Finally, after almost 10 years since those games were first published, I've been able to give them a second life; some more people in the world will be able to play and enjoy them. It just feels good. -
raysan5 revised this gist
Nov 28, 2021 . 1 changed file with 25 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -125,12 +125,16 @@ The base porting process took me **about one week**, to get both games running o - _Start writing this article._ - _Additional code cleaning and tweaks._  > _Tools I used on the porting process. From left to right: [Visual Studio 2019 Community Edition](https://visualstudio.microsoft.com/downloads/), [Notepad++](https://notepad-plus-plus.org/downloads/), [Beyond Compare](https://www.scootersoftware.com/download.php), [Agent Ransack](https://www.mythicsoft.com/agentransack/download/), [Paint.NET](https://www.getpaint.net/download.html) and [rTexViewer](https://raylibtech.itch.io/rtexviewer)._ Both games were submitted to `GooglePlay Store` by the end of **Day 10 (24.Nov.2021)**, it took me some time to figure out how all the publishing process worked: I had to generate an `.aab` bundle (instead of `.apk`), I had to sign the apps and I had to fill all the required submission data. About desktop platforms (Windows, Linux, macOS), I decided to do some additional tweaks to the games to display a custom point cursor and they were ready to publish on [itch.io](https://raysan5.itch.io/) by **Day 14 (28.Nov.2021)**. So, I was able to port my old XNA/PSM games to MonoGame and publish them on `Android`, `Windows`, `Linux` and `macOS` **in just 14 days!**. **What an adventure!** 😄 ## PART 3: The Future At this point, the code for `FLIPS` and `DART that TARGET` has been reviewed and cleaned. It was an old code and I was not an expert when I wrote it but after the review, I feel it became more portable, maintainable and easy to adapt to other frameworks and platforms. Here some numbers: @@ -140,24 +144,28 @@ At this point, the code for `FLIPS` and `DART that TARGET` has been reviewed and > _`DART that TARGET` MonoGame source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Note that after some cleaning, code was reduced in about **2000 lines**; code complexity was also reduced._ `FLIPS` code structure compared to `DART that TARGET` is more simple, with just a few classes and a few systems to control all the processes, also, the different pieces are more decoupled. When I wrote `FLIPS` I decided to simplify code and avoid some patterns used on `DART that TARGET`, now I think it was a good decision because it really simplified the porting process.  > _`FLIPS` MonoGame source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Code was reduced in almost **6000 lines** from PSM version with **+700 points** reduction in code complexity!._ It's interesting to see that code complexity lowered in both ports; I think that's a key factor for maintenance, sustainability and code longevity. It also simplifies porting this game to other platforms or even other programming languages in the future. I think the code in those games could be further improved and simplified, probably many OOP approaches are not needed for these games but I could be a bit biased, actually, for the last 8 years I've been coding mostly in C, trying to create very simple and maintainable code. Now, looking into the future, I considered **3 paths to further explore**: ### Path 1: Porting to `raylib-cs` <img align="right" src="https://user-images.githubusercontent.com/5766837/143786871-d0853f1a-47b7-42cf-88c5-3bdac71fc0c1.png" alt="raylib-cs" width="200px"> [`raylib-cs`](https://github.com/ChrisDill/Raylib-cs) is a C# binding of raylib. Considering that `raylib` is highly inspired by `XNA`, the C# version of the library maps very well to `MonoGame`, both libraries provide mostly the same functionality. The approach to this port would be similar to what I did for PSVita PSM with `XNA2PSM`, I could design an intermediate library to map `XNA/MonoGame` to `raylib`. Beside the port of my games, another interesting use cse of this mapping library could be allowing other `MonoGame` simple games to use `raylib` seamlessly. Here there is a draft analysis of the classes required for this mapping:  @@ -168,15 +176,19 @@ The approach to this port would be similar to what I did for PSVita PSM with `XN <img align="right" src="https://user-images.githubusercontent.com/5766837/143506542-48ebb2e9-0d6a-4ca2-ab6b-2a25104c9f7a.png" alt="WebAssembly Logo" width="220px"> I've been investigating the possibility of porting a `MonoGame` C# game to [`WebAssembly`](https://en.wikipedia.org/wiki/WebAssembly). Unfortunately, it seems it's not possible just yet. It's possible to compile C# to `Wasm` but all the graphics backend is not supported (or I couldn't find any documentation explaining how to do that). Hopefully, that will be possible in a future, similar to what [`emscripten`](https://emscripten.org/) does with C/C++. If the game was ported to `raylib-cs` and considering that `raylib` C/C++ can be compiled to `Wasm` with `emscripten` (and the `WebGL` Javascript layer is generated on the process) maybe `raylib-cs` could consume those libraries and allow the C# engine code to run on web... I don't know, it would require further investigation. ### Path 3: Porting to `C/C++` <img align="left" src="https://user-images.githubusercontent.com/5766837/143787264-97762e9d-915a-47a2-bdef-a3c7caadece9.png" alt="WebAssembly Logo" width="200px"> The current code of `FLIPS` and `DART that TARGET` is quite simple and quite small, it's contained in about **6000 lines of code**. A complete port to C++ and `raylib` wouldn't be that complicated. Most of the C# classes map directly to C++ classes and the **code structure is very simple**. Actually, the only inheritance used is for the different screens from a base `GameScreen` to simplify `ScreenManager` management code. In the case the code was ported to C++, then it would be possible to compile those games to `WebAssembly` and **run them on web**. Very tempting! 😜 ## Conclusions -
raysan5 revised this gist
Nov 28, 2021 . 1 changed file with 36 additions and 34 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Game Porting Adventures This article details my adventures and disadventures while porting my **+9 years old XNA games**, originally developed for Windows Phone, to multiple other frameworks (SharpDX, PSM, MonoGame...), for PSVita, Android and Desktop (Windows, Linux, macOS) platforms. The article is divided in 3 parts: @@ -12,9 +12,9 @@ The article is divided in 3 parts: ## PART 1: The Past At the beginning of **2012** I decided to create [`emegeme`](https://www.emegeme.com/) and start developing games by my own. I got some experience with [XNA framework](https://en.wikipedia.org/wiki/Microsoft_XNA) so I decided to develop games for the new **Windows Phone platform** that was recently launched and it was supported by the framework. First game I developed was `DART that TARGET`, a darts arcade game. It took me about **3 months** of full-time work to **create all the graphics and write all the code**, it was released by **April 2012**. Sales were terrible.  @@ -25,7 +25,7 @@ First game I developed was `DART that TARGET`, a darts arcade game. It took me a > _`DART that TARGET` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > A really motivational tool to evaluate my productivity._ Despite `DART that TARGET` did not work as expected, I decided to develop a second game, `FLIPS`, a memory cards game. `FLIPS` development took me about **4 months** and it was released at the beginning of **September 2012**. This time I put a lot of effort on localization (**9 languages supported!**), a decision that delayed the release a bit but added more value to the game.  @@ -36,39 +36,40 @@ Despite `DART that TARGET` did not work as expected, I decided to develop a seco > _`FLIPS` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > It does not reflect the amount od work it took me to create all the art!_ Again, sales were terrible but thanks to that game I got a job offer to teach some videogames development lessons at a [private educational institution](https://www.cevbarcelona.com/), only for a couple of weeks... that turn into a **6 years full-time job**. During that time, I started a new project called [raylib](https://www.raylib.com/) but [that's another story](https://gist.github.com/raysan5/04a2daf02aa2a6e79010331f77bf983f). By the **end of 2014**, I decided to give `emegeme` another try and, with the help of some of my students, we started working on games development again. By that time `raylib` was already a thing and some of the development efforts were put on it, actually, some of those efforts were the origin of `raygui` and several raylib features. Beside raylib, two videogames project were started, one was `Koala Seasons`, a raylib game for Android that was never released on that platform but it was [open-sourced](https://github.com/raysan5/raylib-games/tree/master/koala_seasons) and [released for web](https://www.raylib.com/games/koala_seasons.html) later on. Second videogame project was a port of `FLIPS` to other platforms. XNA was discontinued by Microsoft and [MonoGame](https://www.monogame.net/) seemed to be the best alternative but it had many dependencies and the custom content processor tool was not ready yet, so, I decided to use [`SharpDX`](https://github.com/sharpdx/SharpDX), a lightweight alternative for Windows desktop platform; actually, MonoGame was using `SharpDX` internally at that moment. `FLIPS` port from `XNA` to `SharpDX` started on **November 2014** and it was done in parallel with another two big game changes: a redesign from **portrait to landscape mode** (to better accomodate on Windows desktop) and a **code split for Engine and Game**, the engine was called `geme`. The plan was to use that engine for future projects... never happened.  > _`geme` game engine logo and structure. It was a very simple 2D engine with just a bunch of classes._ By the **end of 2014** `FLIPS` was already running on Windows desktop, it was nice, it allowed the project to live a bit longer than on a Windows-Phone-only platform but from a business point of view, Windows desktop was not the best platform for that kind of game (or that was what I thought at that moment). I decided to **port the game again** to a new platform: `PSVita`, using [`PlayStation Mobile`](https://en.wikipedia.org/wiki/PlayStation_Mobile) (PSM). `PlayStation Mobile` had been around for some time and it was intended for independent developers, the most interesting feature was that **it supported C# to code games** (using Mono), so, it seemed a really nice fit for `FLIPS`. **PSM API** was similar in some aspects to `XNA` but it required more work than `SharpDX` to port. So, this time the port approach was a bit different, instead of replacing all `XNA` functionality by `PSM` equivalents, I decided to create an auxiliar library to map `XNA` to `PSM`, that library was called `XNA2PSM`. While making those ports I realized that, usually, porting a game between platforms requires reviewing some common elements. I thing most SDKs provide this kind of base elements: - `Graphics Device Manager`: Functions for Graphic Device initialization, GPU data loading and drawing. - `Content Manager`: Functions to manage loading/unloading assets data. - `Inputs Manager`: Functions to read and manage inputs, usually Keyboard, Mouse, Gamepad and Touch. - `Storage Manager`: Functions to access some persistent storage system to save and load game state data. - _System-specific features_: For example networking, ads, trophies, system-level error messages, etc.  > _`FLIPS` PSM source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Interesting to note the increment in code complexity compared to XNA._ Porting `FLIPS` to `PSM` took longer than expected but it was finally released on **June 2015**, after **5 months** of development. Just note that the project was developed along other projects and I was also working full-time as a teacher at that moment. https://user-images.githubusercontent.com/5766837/142927464-6652553f-c321-4b46-940b-1be60c18087d.mp4 @@ -78,42 +79,43 @@ Unfortunately, Sony announced that the **PSM store was closing by 15 July 2015** ## PART 2: The Present More than **9 years** have passed since I released `DART that TARGET` and it's been more than **6 years** since the last `FLIPS` port for PSVita PSM. During this time, I've released [multiple `raylib` versions](https://github.com/raysan5/raylib/releases), [several libraries](https://github.com/raysan5) and [even a set of small tools for videogames development](https://raylibtech.itch.io/) but I hadn't touched those games again... until now. Recently I published [`raylib 4.0`](https://github.com/raysan5/raylib/releases/tag/4.0.0) and I decided to take a small break from C coding and try something different. **I decided to port and publish `FLIPS` and `DART that TARGET` again.** I choosed [`MonoGame`](https://www.monogame.net/) for the ports, this framework has improved a lot in the last years and it supports multiple platform seamlessly, so, I get down to the job and started porting those games again.  > _`FLIPS` ported to MonoGame (Android and Desktop platforms). This is the title screen where you can select the cards memory game to play or check your veggies-cards collection. There are 64 hand-drawn cards to collect!_ The base porting process took me **about one week**, to get both games running on **Android and Desktop (OpenGL) platforms**. Here are the details of the tasks done along this week: ### Day 1. 15.Nov.2021 <img align="right" src="https://user-images.githubusercontent.com/5766837/142999229-bc46d9cd-8d5c-4ab1-b07d-72677db672ba.png" alt="FLIPS GitHub Structure" width="240px"> - `FLIPS`: **Define a proper project structure**: My goal was to share as much code as possible between platforms so I decided to setup a solution with two projects (`FLIPS.Android` and `FLIPS.Desktop`) and link the source code from a common directory. I included the Content raw data with every project to be compiled by an MSBuild task on project compilation, same approach as the one proposed by `MonoGame` project templates. ### Day 2. 16.Nov.2021 - `FLIPS`: **Manual Content compilation**: I decided to move the Content raw data to a directory outside of the projects and just keep the compilation config file (`Content.mgcb`) inside every project, then, I tried to configure the output directories for the compiled content for every platform. Unfortunately, it didn't work, the MSBuild MonoGame task ignored my configurations and I couldn't get it working, so, I took another approach: Compile manually the assets for the desired platform and just add them to the separate projects, it allowed me to remove the custom MSBuild task and simplify the process. - `FLIPS`: **Remove PSVita specific code**: I removed the `XNA2PSM` library but there were still some `#defines` around the code for system-specific `PSVITA` code. I reviewed that code to get a running build (at least on Desktop platforms). ### Day 3. 17.Nov.2021 - `FLIPS`: **Code and formatting review**: I reviewed most of the code, I did some cleaning and I also reviewed code formatting. At that time I was not so concerned about clean code and naming conventions as I am today. ### Day 4. 18.Nov.2021 - `FLIPS`: **Review screen and input scaling**: The original XNA game was designed for a fixed resolution of 480x800, the PSM port was redesigned for a fixed 960x544. It was required a review to support multiple resolutions. I just rendered the game to a texture and then scaled it properly to the display resolution where the game is running. It also required inputs scaling to accomodate to the original resolution. - `FLIPS`: **Storage manager redesign**: PSM implementation was specific for PSVita, it just accessed a byte array file and modified required bytes. I like that simple and low-level approach so, I decided to keep it that way. I reimplemented the class to work that way but using the `System.IO.IsolatedStorage`; I got some problems with paths that took me longer than expected but I finally got it working on all platforms. - `FLIPS`: **Removed Ads manager and other systems**: I just decided to remove ads, social networks sharing and trial version for the game. I decided to keep it as a "premium" game experience, like in the 90s.  > _`FLIPS` ported to MonoGame (Android and Desktop platforms). This is a pairs level completed, depending on your behaviour (time, flips) you can get between 1 and 4 stars, if you get the 4 stars you unlock a new card from the collection!_ ### Day 5. 19.Nov.2021 - `DART`: **Complete project review**: It was more than **9 years** since last time I touched that code, project structure was unnecessarily complex, it had been greatly simplified for `FLIPS` but never back-ported, so, I decided to do a full review of the code. I removed the unneded classes, I replaced some classes and I did some code formatting and reorganization. ### Day 6. 20.Nov.2021 - `FLIPS`: **Setup Google Play for publishing**: I accessed my old developer account on Google Play and I start setting up the project for the release, filling all required information. @@ -123,22 +125,22 @@ Here are the details of the tasks done along this porting week: - _Start writing this article._ - _Additional code cleaning and tweaks._ Both games were submitted to `GooglePlay Store` by the end of **Day 10 (24.Nov.2021)**, it took me some time to figure out how all the publishing process worked: I had to generate an `.aab` bundle (instead of `.apk`), I had to sign the apps and I had to fill all the required submission data. So, **I've been able to port my old XNA/PSM games to MonoGame and publish them on Android in just 10 days!**. What an adventure! :D  > _Tools I used on the porting process. From left to right: [Visual Studio 2019 Community Edition](https://visualstudio.microsoft.com/downloads/), [Notepad++](https://notepad-plus-plus.org/downloads/), [Beyond Compare](https://www.scootersoftware.com/download.php), [Agent Ransack](https://www.mythicsoft.com/agentransack/download/), [Paint.NET](https://www.getpaint.net/download.html) and [rTexViewer](https://raylibtech.itch.io/rtexviewer)._ ## PART 3: The Future At this point, the code for `FLIPS` and `DART that TARGET` has been reviewed and cleaned. It was an old code and I was not an expert when I wrote it but after the review, I feel it became more portable, maintainable and easy to adapt to other frameworks and platforms. Here some numbers:  > _`DART that TARGET` MonoGame source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Note that after some cleaning, code was reduced in about **2000 lines**; code complexity was also reduced._ `DART that TARGET` original code structure was over-engineered for my taste and it took me some work to review. For example, it used an stack system for the game screens, actually, all panels are game screens that overlay other screens, with several levels of inheritance. Probably that structure is fine for a mid-size or bigger game but I think it was not required on this game. On `FLIPS` code was greatly simplified, `ScreenManager` just manages `CurrenScreen` and `nextScreen`, all the objects required for every screens are managed internally by every screen, a simpler approach. I should note that I've been coding mostly in C for the last 8 years, trying to create very simple and maintainable code, that's probably the reason I see many OOP approaches unneeded at this point. -
raysan5 revised this gist
Nov 25, 2021 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -131,7 +131,7 @@ Both games have been submitted to `GooglePlay Store` at the end of **Day 10 (24. ## PART 3: The Future The code for `FLIPS` and `DART that TARGET`has been reviewed and cleaned. It was an old code and I was not an expert when I wrote it but after the review I feel it became more portable and easy to adapt for other frameworks and platforms. Here some numbers:  @@ -178,6 +178,7 @@ If the code was ported to C++, it would be possible to compile those games to `W ## Conclusions After almost 10 years since my first games were published, I've been able to give them a second life. Some more people in the world will be able to play and enjoy them. The code has been reviewed and simplified, increasing maintainability and sustainability, it also makes it easier to port the games to other frameworks or platforms in the future. It was nice to review that old code again and see how much I learned in the last 10 years. -
raysan5 revised this gist
Nov 25, 2021 . 1 changed file with 14 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -131,18 +131,18 @@ Both games have been submitted to `GooglePlay Store` at the end of **Day 10 (24. ## PART 3: The Future With this port I gave my games a second life, now some more people in the world will be able to enjoy them and also, the games could be ported again in the future more easily. I know that, despite I put a lot of care into details, they are not amazing games, they are just some small games I created to learn and enjoy some years ago. It was nice to review that old code again and see how much I learned in the last 10 years.  > _`DART that TARGET` MonoGame source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Note that after some cleaning, code was reduced in about **2000 lines**; code complexity was also reduced._ `DART that TARGET` code structure was over-engineered for my taste and it took me some work to review. It used an stack system for the game screens, actually, all panels are game screens that overlay other screens, with several levels of inheritance. Probably that structure is fine for a mid-size or bigger game but I think it was not required on this game. On `FLIPS` code was greatly simplified, `ScreenManager` just manages `CurrenScreen` and `nextScreen`, all the objects required for every screens are managed internally by every screen, a simpler approach. I should note that I've been coding mostly in C for the last 8 years, trying to create very simple and maintainable code, that's probably the reason I see many OOP approaches unneeded at this point. I think the code in those games could be further optimized and simplified but it's really interesting to note the reduction in code complexity, that's a key factor for maintenance, sustainability and code longevity. `FLIPS` code structure is quite simple with just a few classes and a few systems to control all the processes, also, the different pieces are quite decoupled. It greatly simplifies porting this game to other platforms or even other programming languages in the future.  @@ -164,13 +164,20 @@ The approach to this port would be similar to what I did for PSVita PSM with `XN ### Path 2: Porting to `WebAssembly` <img align="right" src="https://user-images.githubusercontent.com/5766837/143506542-48ebb2e9-0d6a-4ca2-ab6b-2a25104c9f7a.png" alt="WebAssembly Logo" width="220px"> I've also been investigating if it was possible to port a `MonoGame` C# game to `WebAssembly`. Unfortunately, it seems it's not possible yet. Note that it's possible to compile C# to `Wasm` but all the graphics backend is not supported (or I couldn't find any documentation explaining how to do that). Hopefully that will be possible in a future, similar to what `emscripten` does with C/C++. Still, if the game was ported to `raylib-cs` that uses `raylib` and considering that `raylib` can be compiled to `Wasm` with `emscripten` and the `WebGL` Javascript layer is generated on the process, maybe `raylib-cs` could consume those libraries... I don't know, it will require further investigation. ### Path 3: Porting to `C/C++` The current code of `FLIPS` and `DART that TARGET` is quite simple and contained in about **6000 loc**. A complete port to C++ shouldn't be that complex using `raylib` as a backend. If the code was ported to C++, it would be possible to compile those games to `WebAssembly` and run them on a webpage. ## Conclusions After almost 10 years since my first games were published, I've been able to port and publish them again for current platforms. my games to my own technology (or very close to it). -
raysan5 revised this gist
Nov 25, 2021 . 1 changed file with 34 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -80,9 +80,9 @@ Unfortunately, Sony announced that the **PSM store was closing by 15 July 2015** More than **9 years** have passed since I released `DART that TARGET` and it's been more than **6 years** since the last `FLIPS` port for PSVita PSM. During this time, I've released [multiple `raylib` versions](https://github.com/raysan5/raylib/releases), [several code libraries](https://github.com/raysan5) and [even a set small tools for videogames development](https://raylibtech.itch.io/) but I hadn't touched those games again... until now. Recently I published [`raylib 4.0`](https://github.com/raysan5/raylib/releases/tag/4.0.0) and last week I decided to take a small break of C coding and try something different. **I decided to port and publish `FLIPS` and `DART that TARGET` again.** I decided to use [`MonoGame`](https://www.monogame.net/) for the ports, this framework has improved a lot in the last years and now it supports multiple platform seamlessly, so, I get down to the job and started porting those games again. The process took me about a week to get both games running on Android and Desktop (OpenGL) platforms.  @@ -131,21 +131,46 @@ Both games have been submitted to `GooglePlay Store` at the end of **Day 10 (24. ## PART 3: The Future So, what's next? Should I, maybe, port those games to consoles? I don't think so. With those ports I gave those games a second life, now some more people in the world will be able to enjoy them. Despite I put a lot of care into details, they are not amazing games, they are just some small games I created to learn about game develop and game publishing by myself. It was nice to review that old code again and to see how much I learned in the last 10 years.  > _`DART that TARGET` MonoGame source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Note that after some cleaning, code was reduced in about **2000 lines**; code complexity was also reduced._ `DART that TARGET` code structure was over-engineered for my taste and it took me some work to review. It used an stack system for the game screens, actually, all panels are game screens that overlay other screens, with several levels of inheritance. Probably that structure is fine for a mid-size or bigger game but I think it was not required on this game. On `FLIPS` code was greatly simplified, `ScreenManager` just manages `CurrenScreen` and `nextScreen`, all the screens required objects are contained and managed internally by every screen, a simpler approach. I should note that I've been coding mostly in C for the last 8 years, trying to create very simple and manageable code, that's probably the reason I see many OOP approaches unneeded at this point. Despite I think the code in those games could be further optimized and simplified, I think it's really interesting to note the reduction in code complexity, that's a key factor for maintenance, sustainability and code longevity. `FLIPS` code structure is quite simple with just a few classes and a few systems to control all the processes, also, the different pieces are quite decoupled. It greatly simplifies porting this game to other platforms or even other programming languages in the future.  > _`FLIPS` MonoGame source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Code was reduced in almost **6000 lines** from PSM version with **+700 points** reduction in code complexity!._ I considered several possible improvements or paths to explore for the future: ### Path 1: Porting to `raylib-cs` [`raylib-cs`](https://github.com/ChrisDill/Raylib-cs) is a C# binding of raylib. Considering that `raylib` is highly inspired by `XNA`, the C# version of the library maps very well to `MonoGame`, both libraries provide mostly the same functionality. The approach to this port would be similar to what I did for PSVita PSM with `XNA2PSM`, I'd design an intermediate library to map `XNA/MonoGame` to `raylib`. The interesting use of this mapping library would be allowing other `MonoGame` simple games to use `raylib` seamlessly. I analyzed the classes required on this mapping:  > Mapping of `MonoGame` classes to equivalent data structures or functionality provided by `raylib`. > NOTE: Those are the classes I would require for my simple games, other more advance `MonoGame` games could require additional classes but probably raylib also provided most of them. ### Path 2: Porting to `WebAssembly` I've also been investigating if it was possible to port a `MonoGame` C# game to `WebAssembly`. Unfortunately, it seems at this moment is not possible yet. It's possible to compile C# to Wasm but all the graphics backend is not supported yet (or I couldn't find any documentation explaining how to do that). Hopefully that will be possible in a future. Still, if the game was ported to `raylib-cs` that uses `raylib` and considering that raylib can be compiled to `Wasm` with `emscripten` and the `WebGL` Javascript layer is generated on the process, maybe `raylib-cs` could consume those libraries... no idea. ### Path 3: Porting to `C/C++` ## Conclusions So, after almost 10 years since my first game was published, I was able to port my games to my own technology (or very close to it). -
raysan5 revised this gist
Nov 24, 2021 . 1 changed file with 12 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -123,23 +123,29 @@ Here are the details of the tasks done along this porting week: - _Start writing this article._ - _Additional code cleaning and tweaks._ Both games have been submitted to `GooglePlay Store` at the end of **Day 10 (24.Nov.2021)**, it took me some time to figure out how all the publishing process worked. I had to generate an `.aab` bundle (instead of `.apk`), I had to sign the apps and I had to fill all the required submission data. So, **I've been able to port my old XNA/PSM games to MonoGame and publish them on Android in just 10 days**. What an adventure! :D  > _Tools used to port the games. From left to right: [Visual Studio 2019 Community Edition](https://visualstudio.microsoft.com/downloads/), [Notepad++](https://notepad-plus-plus.org/downloads/), [Beyond Compare](https://www.scootersoftware.com/download.php), [Agent Ransack](https://www.mythicsoft.com/agentransack/download/), [Paint.NET](https://www.getpaint.net/download.html) and [rTexViewer](https://raylibtech.itch.io/rtexviewer)._ ## PART 3: The Future So, what's next? Should I, maybe, port those games to consoles? I don't think so. With this last port and review I gave those games a second life, now some more people in the world will be able to enjoy them. They are not amazing games, despite I put a lot of care into details, they were just some small games to learn to develop and publish games by myself. It was nice to review that old code again and to see how much I learned in the last 10 years. `DART that TARGET` code structure was over-engineered for my taste and it took me a loot of work to review. It used an stack system for GameScreens, actually all panels are GameScreens that overlay other base screen, with a several levels of inheritance. On `FLIPS` code was greatly simplified, `ScreenManager` just manages `CurrenScreen` and `nextScreen`, all the screens required objects are contained and managed by every screen, a simpler approach.   Interesting to note the reduction in the lines of code. In the future I could consider porting those games to [`raylib-cs`](https://github.com/ChrisDill/Raylib-cs), a C# binding of raylib. The approach would be similar to what I did for PSVita PSM with `XNA2PSM`, an intermediate library to map `XNA/MonoGame` to `raylib` shouldn't be a big endeavour. Another interesting path to explore would be porting the games to WebAssembly... So, after almost 10 years since my first game was published, I was able to port my games to my own technology (or very close to it). -
raysan5 revised this gist
Nov 24, 2021 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -129,6 +129,10 @@ Here are the details of the tasks done along this porting week: ## PART 3: The Future   raylib-cs raylib clean code -
raysan5 revised this gist
Nov 24, 2021 . 1 changed file with 18 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,13 @@ # Game Porting Adventures This article details my adventures and disadventures while porting my +9 years old XNA games, originally developed for Windows Phone, to multiple other frameworks (SharpDX, PSM, MonoGame...) for PSVita, Android and Desktop platforms. The article is divided in 3 parts: - [PART 1: The Past](#part-1-the-past) - My porting adventures during the last 9 years. - [PART 2: The Present](#part-2-the-present) - My porting adventures during the last few days. - [PART 3: The Future](#part-3-the-future) - My porting adventure plans for the future. ## PART 1: The Past @@ -113,12 +119,21 @@ Here are the details of the tasks done along this porting week: - `FLIPS`: **Setup Google Play for publishing**: I accessed my old developer account on Google Play and I start setting up the project for the release, filling all required information. - `DART`: **Redesigned `InputManager`**: I decided to review game inputs, old implementation was using the gestures system only and I added support for Touch and Mouse, to allow playing the game on Desktop platforms. I also reviewed some other classes and I did some code cleaning. ### Day 7. 21.Nov.2021 - _Start writing this article._ - _Additional code cleaning and tweaks._  > _Tools used to port the games. From left to right: [Visual Studio 2019 Community Edition](https://visualstudio.microsoft.com/downloads/), [Notepad++](https://notepad-plus-plus.org/downloads/), [Beyond Compare](https://www.scootersoftware.com/download.php), [Agent Ransack](https://www.mythicsoft.com/agentransack/download/), [Paint.NET](https://www.getpaint.net/download.html) and [rTexViewer](https://raylibtech.itch.io/rtexviewer)._ ## PART 3: The Future raylib-cs raylib clean code webassembly I decided to take a last step on the development and do a final port of those games, I decided to port them to [`raylib-cs`](https://github.com/ChrisDill/Raylib-cs). Similar to what I did for PSVita PSM with `XNA2PSM` I decided to create an intermediate library to map `XNA/MonoGame` to `raylib` and I created **`Monotoray`**. -
raysan5 revised this gist
Nov 23, 2021 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ First game I developed was `DART that TARGET`, a darts arcade game. It took me a  > _`DART that TARGET` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > A really motivational tool to evaluate my productivity._ Despite `DART that TARGET` did not work as expected, I decided to develop a second game, `FLIPS`, a memory cards game. `FLIPS` development took me about **4 months** and it was released at the beginning of September. I put a lot of effort on localization (**9 languages supported**), it delayed the release a bit. @@ -78,6 +78,10 @@ Recently I published [`raylib 4.0`](https://github.com/raysan5/raylib/releases/t This time I choose [`MonoGame`](https://www.monogame.net/) for the ports, this framework has improved a lot in the last years and now it supports multiple platform seamlessly, so, I get down to the job and started porting those games again. The process took me about a week to get both games running on Android and Desktop (OpenGL) platforms.  > _`FLIPS` ported to MonoGame (Android and Desktop platforms). This is the title screen where you can select the cards memory game to play or check your veggies-cards collection. There are 64 hand-drawn cards to collect!_ Here are the details of the tasks done along this porting week: ### Day 1. 15.Nov.2021 @@ -96,7 +100,11 @@ Here are the details of the tasks done along this porting week: ### Day 4. 18.Nov.2021 - `FLIPS`: **Review screen and input scaling**: The original XNA game was designed for a fixed resolution of 480x800, the PSM port was redesigned for a fixed 960x544. It was required to review that to support multiple resolutions. I just rendered the game to a Texture and then scaled it properly to the full display where the game is running. It also required inputs scaling to accomodate to the original resolution. - `FLIPS`: **Storage manager redesign**: PSM implementation was specific for PSVita, it just accessed a byte array file and modified required bytes. I like that simple and low-level approach so I decided to keep it that way. I reimplemented the class to work that way but using the `System.IO.IsolatedStorage`; I got some problems with paths that took me longer than expected but I finally got it working on all platforms. - `FLIPS`: **Removed Ads manager**: I just decided to remove ads, social networks sharing and trial version for the game. I decided to keep it as a premium simple game.  > _`FLIPS` ported to MonoGame (Android and Desktop platforms). This is a pairs level completed, depending on your behaviour (time, flips) you can get between 1 and 4 stars, if you get the 4 stars you unlock a new card from the collection!_ ### Day 5. 19.Nov.2021 - `DART`: **Complete project review**: It was more than 9 years since last time I touched that code, project structure was unnecessarily comple, it had been greatly simplified for `FLIPS` but never back-ported, so, I decided to do a full review of the code. I removed the unneded classes, I replaced some classes and I did some code formatting and reorganization. @@ -105,6 +113,7 @@ Here are the details of the tasks done along this porting week: - `FLIPS`: **Setup Google Play for publishing**: I accessed my old developer account on Google Play and I start setting up the project for the release, filling all required information. - `DART`: **Redesigned `InputManager`**: I decided to review game inputs, old implementation was using the gestures system only and I added support for Touch and Mouse, to allow playing the game on Desktop platforms. I also reviewed some other classes and I did some code cleaning. ### Day 7. 22.Nov.2021 - _Start writing this article._ -
raysan5 revised this gist
Nov 23, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ First game I developed was `DART that TARGET`, a darts arcade game. It took me a  > _`DART that TARGET` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). A really motivational tool to evaluate my productivity._ Despite `DART that TARGET` did not work as expected, I decided to develop a second game, `FLIPS`, a memory cards game. `FLIPS` development took me about **4 months** and it was released at the beginning of September. I put a lot of effort on localization (**9 languages supported**), it delayed the release a bit. -
raysan5 revised this gist
Nov 23, 2021 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,8 +27,8 @@ Despite `DART that TARGET` did not work as expected, I decided to develop a seco  > _`FLIPS` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > It does not reflect the amount od work it took me to create all the art!_ Again, sales were terrible but thanks to that game I got a job offer to teach some videogames development lessons at a [private educational institution](https://www.cevbarcelona.com/), only for a couple of weeks... that turn into a **6 years full-time job**!. During that time, I started a new project called [raylib](https://www.raylib.com/) but [that's another story](https://gist.github.com/raysan5/04a2daf02aa2a6e79010331f77bf983f). @@ -57,9 +57,10 @@ I'm not an expert on games porting but during those ports I realized that, usual - `Storage Manager`: Functions to access some persistent storage system to save and load game info. - _System-specific features_: For example networking, ads, trophies, system-level error messages, etc.  > _`FLIPS` PSM source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > Interesting to note the increment in code complexity compared to XNA._ Porting `FLIPS` to `PSM` took longer than expected but it was finally released on **June 2015**, after **5 months** of development and working on it as a second job, also working full-time as a teacher. -
raysan5 revised this gist
Nov 23, 2021 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -105,8 +105,12 @@ Here are the details of the tasks done along this porting week: - `DART`: **Redesigned `InputManager`**: I decided to review game inputs, old implementation was using the gestures system only and I added support for Touch and Mouse, to allow playing the game on Desktop platforms. I also reviewed some other classes and I did some code cleaning. ### Day 7. 22.Nov.2021 - _Start writing this article._ ## PART 3: The Future I decided to take a last step on the development and do a final port of those games, I decided to port them to [`raylib-cs`](https://github.com/ChrisDill/Raylib-cs). Similar to what I did for PSVita PSM with `XNA2PSM` I decided to create an intermediate library to map `XNA/MonoGame` to `raylib` and I created **`Monotoray`**. So, after almost 10 years since my first game was published, I was able to port my games to my own technology (or very close to it). -
raysan5 revised this gist
Nov 23, 2021 . 1 changed file with 12 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ Despite `DART that TARGET` did not work as expected, I decided to develop a seco  > _`FLIPS` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc)._ > _It does not reflect the amount od work it took me to create all the art!_ Again, sales were terrible but thanks to that game I got a job offer to teach some videogames development lessons at a [private educational institution](https://www.cevbarcelona.com/), only for a couple of weeks... that turn into a **6 years full-time job**!. During that time, I started a new project called [raylib](https://www.raylib.com/) but [that's another story](https://gist.github.com/raysan5/04a2daf02aa2a6e79010331f77bf983f). @@ -57,21 +57,25 @@ I'm not an expert on games porting but during those ports I realized that, usual - `Storage Manager`: Functions to access some persistent storage system to save and load game info. - _System-specific features_: For example networking, ads, trophies, system-level error messages, etc. [image]() > _`FLIPS` PSM source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc)._ > _Interesting to note the increment in code complexity compared to XNA._ Porting `FLIPS` to `PSM` took longer than expected but it was finally released on **June 2015**, after **5 months** of development and working on it as a second job, also working full-time as a teacher. https://user-images.githubusercontent.com/5766837/142927464-6652553f-c321-4b46-940b-1be60c18087d.mp4 > _`FLIPS` for PSVita (PSM) promotional trailer. Published one month before the platform closing. 😔_ Unfortunately, Sony announced that the **PSM store was closing by 15 July 2015**, so, `FLIPS` was on the market for about **1 month** until it dissapeared forever. All the technologies I had used to make games to that moment had end up disappearing (`XNA`/`SharpDX`/`PSM`) so I decided to focus my efforts on my own technology: [`raylib`](https://www.raylib.com/). ## PART 2: The Present More than **9 years** have passed since I released `DART that TARGET` and it's been more than **6 years** since the last `FLIPS` port for PSVita PSM. During this time, I've released [multiple `raylib` versions](https://github.com/raysan5/raylib/releases), [several code libraries](https://github.com/raysan5) and [even a set small tools for videogames development](https://raylibtech.itch.io/) but I hadn't touched those games again... until now. Recently I published [`raylib 4.0`](https://github.com/raysan5/raylib/releases/tag/4.0.0) and last week I decided to take a small break and try something different. **I decided to port and publish `FLIPS` and `DART that TARGET` again.** This time I choose [`MonoGame`](https://www.monogame.net/) for the ports, this framework has improved a lot in the last years and now it supports multiple platform seamlessly, so, I get down to the job and started porting those games again. The process took me about a week to get both games running on Android and Desktop (OpenGL) platforms. Here are the details of the tasks done along this porting week: @@ -97,16 +101,11 @@ Here are the details of the tasks done along this porting week: - `DART`: **Complete project review**: It was more than 9 years since last time I touched that code, project structure was unnecessarily comple, it had been greatly simplified for `FLIPS` but never back-ported, so, I decided to do a full review of the code. I removed the unneded classes, I replaced some classes and I did some code formatting and reorganization. ### Day 6. 20.Nov.2021 - `FLIPS`: **Setup Google Play for publishing**: I accessed my old developer account on Google Play and I start setting up the project for the release, filling all required information. - `DART`: **Redesigned `InputManager`**: I decided to review game inputs, old implementation was using the gestures system only and I added support for Touch and Mouse, to allow playing the game on Desktop platforms. I also reviewed some other classes and I did some code cleaning. ### Day 7. 22.Nov.2021 - Start writting this article. ## PART 3: The Future -
raysan5 revised this gist
Nov 23, 2021 . 1 changed file with 20 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Game Porting Adventures This article details my adventures and disadventures while porting my +9 years old XNA games (originally for Windows Phone) to multiple other frameworks (PSVita, Android and Desktop platforms). ## PART 1: The Past @@ -63,36 +63,42 @@ https://user-images.githubusercontent.com/5766837/142927464-6652553f-c321-4b46-9 > _`FLIPS` for PSVita (PSM) promotional trailer. Published one month before the platform closing. 😔_ Unfortunately, Sony announced that the **PSM store was closing by 15 July 2015**, so, `FLIPS` was on the market for about **1 month** until it dissapeared forever. All the technologies I had used to make games to that moment had end up disappearing (`XNA`/`SharpDX`/`PSM`) so I decided to focus my efforts on my own technology: `raylib`. ## PART 2: The Present Nine years have passed since I released `DART that TARGET`, and it's been more than 6 years since the release of `FLIPS` port for PSVita PSM. In the last years I've released [multiple `raylib` versions](https://github.com/raysan5/raylib/releases) but also [several libraries](https://github.com/raysan5) and [a set small tools for videogames development](https://raylibtech.itch.io/). [`raylib 4.0`](https://github.com/raysan5/raylib/releases/tag/4.0.0) has been recently published after 8 years working on the project, that's a long time, and last week I decided to take a small break and try something different. I decided to port and publish `FLIPS` and `DART that TARGET` again. I choose [`MonoGame`](https://www.monogame.net/) to port them, this framework has improved a lot in the last years and now it supports multiple platform seamlessly, so, I get down to the job and started porting those games again. The process took me about a week to get both games ported and running on Android and Desktop (OpenGL) platforms. Here are the details of the tasks done along this porting week: ### Day 1. 15.Nov.2021 <img align="right" src="https://user-images.githubusercontent.com/5766837/142999229-bc46d9cd-8d5c-4ab1-b07d-72677db672ba.png" alt="FLIPS GitHub Structure" width="240px"> - `FLIPS`: **Define a proper project structure**: My goal was to share as much code as possible between platforms so I decided to setup a solution with two projects (`FLIPS.Android` and `FLIPS.Desktop`) and link the source code from a common directory. I included the Content raw data with every project to be compiled by an MSBuild task on project compilation, same approach as the one proposed by `MonoGame` project templates. ### Day 2. 16.Nov.2021 - `FLIPS`: **Manual Content compilation**: I decided to move the Content raw data to a common directory outside of the projects and just keep the compilation config file (`Content.mgcb`) inside every project; I also tried to configure the output directories for the compiled data. Unfortunately, it didn't work, the MSBuild MonoGame task ignored my configurations and I couldn't get it working so I took another approach: Compile manually the assets for the desired platform and just properly add the compiled assets to the projects, it allowed me to remove the custom MSBuild task from the projects. - `FLIPS`: **Remove PSVita specific code**: I removed the `XNA2PSM` library but there were still some #defines around the code for system-specific PSVITA code. I reviewed that code to get a running build (at least on Desktop platform). ### Day 3. 17.Nov.2021 - `FLIPS`: **Code and formatting review**: I reviewed most of the code, I did some cleaning and I also I reviewed code formatting. At that time I was not so concerned about clean code and naming conventions as I am today. ### Day 4. 18.Nov.2021 - `FLIPS`: **Review screen and input scaling**: The original XNA game was designed for a fixed resolution of 480x800, the PSM port was redesigned for a fixed 960x544. It was required to review that to support multiple resolutions. I just rendered the game to a Texture and then scaled it properly to the full display where the game is running. It also required inputs scaling to accomodate to the original resolution. - `FLIPS`: **Storage manager redesign**: PSM implementation was specific for PSVita, it just accessed a byte array file and modified required bytes. I like that simple and low-level approach so I decided to keep it that way. I reimplemented the class to work that way but using the `System.IO.IsolatedStorage`; I got some problems with paths that took me longer than expected but I finally got it working on all platforms. - `FLIPS`: **Removed Ads manager**: I just decided to remove ads, social networks sharing and trial version for the game. I decided to keep it as a premium simple game. ### Day 5. 19.Nov.2021 - `DART`: **Complete project review**: It was more than 9 years since last time I touched that code, project structure was unnecessarily comple, it had been greatly simplified for `FLIPS` but never back-ported, so, I decided to do a full review of the code. I removed the unneded classes, I replaced some classes and I did some code formatting and reorganization. ### Day 6. 20.Nov.2021 - `FLIPS`: **Setup Google Play for publishing**: - `DART`: **Redesigned `InputManager`**: More review and redesign, new InputManager ### Day 7. 21.Nov.2021 - `FLIPS`: Simplified touch input usage, more code review -
raysan5 revised this gist
Nov 22, 2021 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,19 +57,19 @@ I'm not an expert on games porting but during those ports I realized that, usual - `Storage Manager`: Functions to access some persistent storage system to save and load game info. - _System-specific features_: For example networking, ads, trophies, system-level error messages, etc. Porting `FLIPS` to `PSM` took longer than expected but it was finally released on **June 2015**, after **5 months** of development and working on it as a second job, also working full-time as a teacher. https://user-images.githubusercontent.com/5766837/142927464-6652553f-c321-4b46-940b-1be60c18087d.mp4 > _`FLIPS` for PSVita (PSM) promotional trailer. Published one month before the platform closing. 😔_ Unfortunately, Sony announced that the **PSM store was closing by 15 July 2015**, so, `FLIPS` was on the market for about 1 month until it dissapeared forever. At that moment I stopped `XNA/SharpDX/PSM` development and I focused on `raylib`, all the technologies used to make my games had end up disappearing (`XNA`/`SharpDX`/`PSM`) so I decided to focus on `raylib` and minimize as much as possible any external dependency. ## PART 2: The Present A couple of weeks ago I released `raylib 4.0`, it's been 8 years working on this project, mostly coding in C and last week I decided to take a small raylib break and try something different. I decided to port and publish `FLIPS` and `DART that TARGET` again. It was more than 6 years since last `FLIPS` release and more than 9 years since `DART that TARGET` release. I had not touched those projects in that time; `emegeme` was mostly abbandonned and all my efforts on those years were put on `raylib` and `raylib technologies`, where I developed several tools using `raylib` and `raygui`. I decided to port them to latest MonoGame, this framework has improved a lot and now it supports multiple platform seamlessly. -
raysan5 revised this gist
Nov 22, 2021 . 1 changed file with 37 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@  # Game Porting Adventures This article details my adventures and disadventures while porting my +9 years old XNA games (originally for Windows Phone) to MonoGame framework (Android and Desktop platforms). ## PART 1: The Past At the beginning of **2012** I decided to create [`emegeme`](https://www.emegeme.com/) and start developing games. I got some experience with XNA framework so I decided to develop games for the new **Windows Phone platform** that was recently published and it was supported by the framework. @@ -65,11 +65,43 @@ https://user-images.githubusercontent.com/5766837/142927464-6652553f-c321-4b46-9 > _`FLIPS` for PSVita (PSM) promotional trailer. Published one month before the platform closing. 😔_ ## PART 2: The Present It was more than 6 years since `FLIPS` last release and more than 9 years since last `DART that TARGET` release. I had not touched those projects in that time; `emegeme` was mostly abandoned and all my efforts on those years were put on `raylib` and `raylib technologies`, where I developed several tools using `raylib` and `raygui`. A couple of weeks ago I released `raylib 4.0`, it's been 8 years working on that project, mostly coding in C and last week I decided to take a raylib small break and try something different. I decided to review and publish `FLIPS` and `DART that TARGET` again. I decided to port them to latest MonoGame, this framework has improved a lot and now it supports multiple platform seamlessly. ### Day 1. 15.Nov.2021 - `FLIPS`: Project setup on GitHub, project organization, port to MonoGame. ### Day 2. 16.Nov.2021 - `FLIPS`: Removed PSVita specific code. Manual content compilation. ### Day 3. 17.Nov.2021 - `FLIPS`: Code review. Comments and formatting review ### Day 4. 18.Nov.2021 - `FLIPS`: Review screen and input scaling. removed Ads manager. Redesigned Storage manager. - `DART`: Initial port to MonoGame, create GitHub project (same as FLIPS) ### Day 5. 19.Nov.2021 - `FLIPS`: Storage manager on Android, project configuration - `DART`: Simplified and reviewed all project: Remove unneded classes, support screen scaling. ### Day 6. 20.Nov.2021 - `FLIPS`: Formatting review. Setup GooglePlay project. - `DART`: More review and redesign, new InputManager ### Day 7. 21.Nov.2021 - `FLIPS`: Simplified touch input usage, more code review - `DART`: Reviewed GameScreen and ScreenManager, code cleaning ### Day 8. 22.Nov.2021 - Start writting this article. - `DART`: Reviewed TitleScreen ## PART 3: The Future `Monotoray` -
raysan5 revised this gist
Nov 22, 2021 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,7 +61,10 @@ Porting `FLIPS` to `PSM` took longer than expected, about **5 months** and it wa Unfortunately, Sony announced that the **PSM store was closing by 15 July 2015**, so, `FLIPS` was on the market for about 1 month until it dissapeared forever. At that moment I stopped `XNA/SharpDX/PSM` development and I focused on `raylib`. https://user-images.githubusercontent.com/5766837/142927464-6652553f-c321-4b46-940b-1be60c18087d.mp4 > _`FLIPS` for PSVita (PSM) promotional trailer. Published one month before the platform closing. 😔_ ### Part 2: A new hope -
raysan5 revised this gist
Nov 22, 2021 . 1 changed file with 36 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,45 +2,64 @@ ## Game Porting Adventures This article details my adventures and disadventures while porting my +9 years old XNA games (originally for Windows Phone) to MonoGame framework (Android and Desktop platforms). ### Part 1: Making Games At the beginning of **2012** I decided to create [`emegeme`](https://www.emegeme.com/) and start developing games. I got some experience with XNA framework so I decided to develop games for the new **Windows Phone platform** that was recently published and it was supported by the framework. First game I developed was `DART that TARGET`, a darts arcade game. It took me about **3 months** of work to **create all the graphics and write all the code**, it was released by **April 2012**. Sales were terrible.  > _`DART that TARGET` XNA game screenshots. I really put a lot of care in details, you can touch the neons for some sparks!._  > _`DART that TARGET` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). > A really motivational tool to evaluate my productivity._ Despite `DART that TARGET` did not work as expected, I decided to develop a second game, `FLIPS`, a memory cards game. `FLIPS` development took me about **4 months** and it was released at the beginning of September. I put a lot of effort on localization (**9 languages supported**), it delayed the release a bit.  > _`FLIPS` XNA game screenshots. Again, I put a lot of care in details. I draw the 64 veggies cards available by hand!._  > _`FLIPS` XNA source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc)._ > _It does not reflect the amount od work it ook me to create all the art!_ Again, sales were terrible but thanks to that game I got a job offer to teach some videogames development lessons at a [private educational institution](https://www.cevbarcelona.com/), only for a couple of weeks... that turn into a **6 years full-time job**!. During that time, I started a new project called [raylib](https://www.raylib.com/) but [that's another story](https://gist.github.com/raysan5/04a2daf02aa2a6e79010331f77bf983f). By the **end of 2014**, I decided to give `emegeme` another try and, with the help of some of my students, we started working on games development again. By that time `raylib` was already a thing and some of the development efforts were put on it, actually, some of those efforts were the origin of `raygui` and several raylib features. Beside raylib, two videogames project were started, one was `Koala Seasons`, a raylib game for Android that was never released on that platform but [open-sourced](https://github.com/raysan5/raylib-games/tree/master/koala_seasons) and [released for web](https://www.raylib.com/games/koala_seasons.html) later on. Second videogame project was a port of `FLIPS` to other platforms. XNA was discontinued by Microsoft and MonoGame seemed to be the best alternative but it has many dependencies and the custom content processor tool was not ready yet, so, I decided to use [`SharpDX`](https://github.com/sharpdx/SharpDX), a lightweight alternative to support Windows desktop platform; actually, MonoGame was using `SharpDX` internally at that moment. `FLIPS` port from `XNA` to `SharpDX` started on **November 2014** and it was done in parallel with another two big game changes: a redesign from **portrait to landscape mode** (to better accomodate on Windows desktop) and a **code split for Engine and Game**, the engine was called `geme`. The plan was using that engine for future projects... never happened.  > _`geme` game engine logo and structure. It was a very simple engine with just a bunch of classes, intended for 2D games._ By the end of 2014 `FLIPS` was already running on Windows desktop, it was nice, it allowed the project to live a bit longer than on a Windows-Phone-only platform but from a business point of view, Windows desktop was not the best platform for that kind of game (or that was what I thought at that moment). I decided to **port the game again** to a new platform: `PSVita`, using [`PlayStation Mobile`](https://en.wikipedia.org/wiki/PlayStation_Mobile) (PSM). `PlayStation Mobile` platform had been around for some time and it was intended for independent developers, the most interesting feature was that **it supported C# to code games** (using Mono), so, it seemed a really nice fit for `FLIPS`. **PSM API** was similar in some aspects to `XNA` but it required more work than `SharpDX` to port so, this time the port approach was a bit different, instead of replacing all `XNA` functionality by `PSM` equivalents, I decided to create an auxiliar library to map `XNA` to `PSM`, that library was called `XNA2PSM`. I'm not an expert on games porting but during those ports I realized that, usually, porting a game between platforms requires reviewing some common elements. I thing most SDKs provide this kind of base elements: - `Graphics Device Manager`: Functions for Graphic Device initialization and drawing on it. - `Content Manager`: Functions to manage loading/unloading assets data. - `Inputs Manager`: Functions to read and manage inputs, usually Keyboard, Mouse, Gamepad and Touch inputs. - `Storage Manager`: Functions to access some persistent storage system to save and load game info. - _System-specific features_: For example networking, ads, trophies, system-level error messages, etc. Porting `FLIPS` to `PSM` took longer than expected, about **5 months** and it was finally released on **June 2015**. Worth noting that I was working full-time as a teacher while developing those projects. Unfortunately, Sony announced that the **PSM store was closing by 15 July 2015**, so, `FLIPS` was on the market for about 1 month until it dissapeared forever. At that moment I stopped `XNA/SharpDX/PSM` development and I focused on `raylib`. [FLIPS on PSVita Video](https://www.youtube.com/watch?v=___goqWDGC8) -
raysan5 revised this gist
Nov 22, 2021 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,12 +8,18 @@ This article details my adventures and disadventures while porting my +9 years o At the beginning of 2012 I decided to create `emegeme` and start developing games. I got some experience with XNA so I decided to develop games for the new Windows Phone platform that was recently supported by the framework. First game I developed was `DART that TARGET`, a darts arcade game. It took me about 3 months of work to **create all the graphics and write the code**, it was released by April 2012. Sales were terrible.   > _Source code development cost estimation analyzed with [scc 3.0.0](https://github.com/boyter/scc). A really motivational tool to evaluate my productivity._ Despite `DART that TARGET` did not work as expected, I decided to develop a second game, `FLIPS`, a memory cards game. `FLIPS` development took me about 4 months and it was released at the beginning of September. I put a lot of effort on localization (9 languages supported), what delayed the release a bit.  Again, sales were terrible but thanks to that game I got a job offer to teach some videogames development lessons at a private educational institution, only for a couple of weeks... that turn into a 6 years full-time job. During that time, I started a new project called raylib but [that's another story](https://gist.github.com/raysan5/04a2daf02aa2a6e79010331f77bf983f). By the end of 2014, I decided to give `emegeme` another try and, with the help of some of my students, we started working on games development again. By that time `raylib` started to be a thing and some of the development efforts were put on it, actually, some of those efforts were the origin of `raygui` and several raylib features.
NewerOlder