CadEditor. Support levels with mixed screens
utopian-io·@pinkwonder·
0.000 HBDCadEditor. Support levels with mixed screens
**CadEditor** [https://github.com/spiiin/CadEditor](https://github.com/spiiin/CadEditor) CadEditor is the universal level editor for NES/SMD/SNES games, I describe project on steemit [here](https://busy.org/@pinkwonder/cadeditor-universal-level-editor-for-nes-smd-snes-games#comments). ## What feature(s) did you add? The main feature, that I added with last commits is *support games, that has levels with screens of different sizes at one level*.   All previous NES games added to CadEditor has screens with same sizes (8x8, 8x7, 8x6 big blocks, or 16x15, 16x14 small blocks are popular sizes because are useful with screen resolution, but all games used only ONE size for all screens at level). But after users begin to add new games, they found that some games mix screens with different sizes at one level! For example, game on screenshot (***Monsters in My Pocket***) mix screens with size 8x8 to show the upper part of the level, and size 8x6 to show the lower part, so if the level editor wants to render full level, it must support mixed screens. The user with nickname **lancuster** added more than 100 NES games to CadEditor, and the only way to describe games with mixed screens was to split it to separate config files. But with this feature, I can optimize configs and merge related to one level screens together. Other examples of games with mixed screens: - ***Jackie Chan's Action Kung Fu*** - ***Bad Dudes*** - ***Bucky O'Hare*** - ***Tiny Toon Adventures 2*** And others. [Here](https://spiiin.github.io/CadEditor/cadeditor-supported-games.html) I made the table describing level formats for all supported games (in Russian, but it is filled with numbers and formulas more than text). All games with mixed screens can be describing correctly (not divided by many configs) for the CadEditor now. Also, with this feature, there is possible to describe games with screens at the different locations in ROM file in one config. It was possible before with hack, but now I remove this hack from config system (I'll describe it in next section), so now there is one good way to describe different screen types in one config. ## How did you implement it/them? At first, I need to say, that there is hard to make the universal editor because it was started while I have information about only a few games, but later I collect more and more information. Thanks to users, who help to discover new formats, and not only added games were useful, but if some game is impossible to add, information about it can be useful too, because of knowledge, how levels in it are stored. So, adding new features may break basic editor data structures, and this feature was one of them. For example, I store information about screens with simple **int[][]** array (it was enough to describe >50 games!). Now I must change it **Screen[]** record, where every screen can store an array of int, width, and height of this array (And some later I added the possibility to describe several layers at every screen). This [commit ](https://github.com/spiiin/CadEditor/commit/350012e2aa98b92b76c33f489db0c8fb777d2f39)describes this initial stage. (And, briefly, next 25 [commits](https://github.com/spiiin/CadEditor/commits/master) are next steps to adding full support, I describe main of them below). Next, I need to solve several tasks for changing code working with this structure: - I need a way to describe Screens of level in the config file (so users can specify games with mixed screens). I already have a way to set different addresses of screens in configs. I need the only way to load/save screens in any way chosen by users. So I added parameters **getSaveScreensFunction/getLoadScreensFunction**, so users can describe any way to save/load screens. And more - I just created universal default implementation of this functions ([commit](https://github.com/spiiin/CadEditor/commit/309ea41707730cc00441941d230fd9ee33cd094b)), so only one game need to override it - ***Final Fantasy Tactics Advance*** reimplement it for loading additional layer ([commit](https://github.com/spiiin/CadEditor/commit/046eaedf98cb1e0536a3d153c1f1a226f39ed741)) - I need a way to read it from config file from CadEditor. I need to merge old hacked method to work with different screen type (that define level type entity with only one screen per level) with new universal method (allow any count of screens of any sizes). I need to remove level type entity at all and clean it from CadEditor code and GUI, and from configs. Also, I need to remove wrong entity BlockLayer, that describe layers in the wrong way (as screens array of only one type for whole layer). Now, the opposite is true - Screen is the core structure, and inside it, there are one or more layers can be defined (every screen can have any number of different layers and size). It was the hardest part of refactoring (one of [commits](https://github.com/spiiin/CadEditor/commit/f19a357fb3fcb949c4a4f017823ca484bd255434), related to it). It's not fully implemented yet, but GUI already supported work with two layers and there is one game, that shows this feature (***Final Fantasy Tactics Advance***):  Really, I have the more functional editor for this game but want to reimplement it as CadEditor plugin in future. My [article](https://spiiin.github.io/CadEditor/cadeditor-architecture.html) about **Screen** structure and other concepts of universal level format template based on the level formats of about 200 games (in Russian) - I need to work with new screens from GUI. It was not very hard, but led to refactoring and removing much dead code ([commit](https://github.com/spiiin/CadEditor/commit/05355416ea0e63ae5e88ad7f79a9d82f3dacc42c), [commit](https://github.com/spiiin/CadEditor/commit/9162dc04465bd6d6b84a3c847a23e9cca0102b25)) - After that, I need to check all dynamic script to change the naming convention in it too. ([commit](https://github.com/spiiin/CadEditor/commit/aee00f76d4e2115f562a3287fdb834a6672465a7)) - Also, I made a draft of documentation with the list of all functions, that can be redefined in configs and utility for checking config's content without CadEditor itself. ([commit](https://github.com/spiiin/CadEditor/commit/08eba49f64d94c1f044b5b6534b0f2b2a4e22585)) [Article](https://spiiin.github.io/CadEditor/configs-functions.html) in Russian. Of course, this is no real documentation, but it's the first step to it. - And finally, I rewrote configs for game ***Monster in my Pocket*** for using the new feature, and after merged, I described all levels only with 18 configs (versus 56 in the old version). ([commit](https://github.com/spiiin/CadEditor/commit/0e2952dc9e580b5ac63cf77d4e09bcbb58b5dda5)). Other games with mixed screens will be rewritten too. ## Other minor updates - [Article](https://spiiin.github.io/CadEditor/cadeditor-using-flintstones.html) about using CadEditor for editing game ***Flintstones: The Rescue Dino And Hoppy*** (in Russian) ([commit](https://github.com/spiiin/CadEditor/commit/c082ac3947a7594faea01507a3fc308daafd25a6)) - [Article](https://spiiin.github.io/CadEditor/configs-functions.html) with the the the list of every function, that can be defined in config (in Russian) ([commit](https://github.com/spiiin/CadEditor/commit/8d05059b965cbc8de8b2b3e66a8b9523103c72a6)) - Update config for ***Kyatto Ninja Teyandee*** (also known as ***Ninja Cats***) - added big pictures of objects ([commit](https://github.com/spiiin/CadEditor/commit/747126670c7718eb70aea16e43c5e28958a2578a))  - Changed annoying unhandled exception to message box with error text, if config has syntax error ([commit](https://github.com/spiiin/CadEditor/commit/34b17249e4f1e702a28c36ebcb05443246267659))
👍 pinkwonder, anthony2000gr, andrei8, varikoz, vvalueup, steemitstats, sbi6, yuxi, dick.sledge, marketstack, lionindayard, properfraction, jjay, reazuliqbal, mhossain, tanzil2020, boomtube, bdcommunity2, gamerbd, miniature-tiger, alexzicky, livingtoday, amosbastian, thinkingmind, andrejcibik, achiron, minnowsupport, utopian-io, developspanish, shadowmyst, ajayyy, steemhq, dustinaux, lopusazuli, nice-steemer,