CadEditor. Support levels with mixed screens

in #utopian-io6 years ago

CadEditor
https://github.com/spiiin/CadEditor

CadEditor is the universal level editor for NES/SMD/SNES games, I describe project on steemit here.

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.
cad_mimp1.png
cad_mimp2.png

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 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 describes this initial stage.
(And, briefly, next 25 commits 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), so only one game need to override it - Final Fantasy Tactics Advance reimplement it for loading additional layer (commit)

  • 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, 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):
cad_editor_ffta.png

Really, I have the more functional editor for this game but want to reimplement it as CadEditor plugin in future.

My article 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, commit)

  • After that, I need to check all dynamic script to change the naming convention in it too.

(commit)

  • 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)
Article 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).
Other games with mixed screens will be rewritten too.

Other minor updates

  • Article about using CadEditor for editing game Flintstones: The Rescue Dino And Hoppy (in Russian) (commit)
  • Article with the the the list of every function, that can be defined in config (in Russian) (commit)
  • Update config for Kyatto Ninja Teyandee (also known as Ninja Cats) - added big pictures of objects (commit)
    cad_ninja_cats_objects.png
  • Changed annoying unhandled exception to message box with error text, if config has syntax error (commit)
Sort:  

I gave you a positive vote in your publication! Please, give me a next vote! "Your publication has a lot of value, I'm also creating quality content, if you like you can visit me"

Thank you for your contribution. Some of the comments description are great but some of them are like "some fixes" or "some cleaning", wouldn't it be better to have nice description for those commits too.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

I tried to write descriptive commit messages for review, but some commits are about refactoring/renaming related to other commits, so there is no much text about it :) Thanks for the review, I'll try to continue improving quality of my code and working process.

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by spiiin from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Hey @pinkwonder
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

YOU JUST GOT UPVOTED

Congratulations,
you just received a 22.50% upvote from @steemhq - Community Bot!

Wanna join and receive free upvotes yourself?
Vote for steemhq.witness on Steemit or directly on SteemConnect and join the Community Witness.

This service was brought to you by SteemHQ.com

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64534.17
ETH 3150.15
USDT 1.00
SBD 4.01