Sonic and Sega Retro Message Board: Captain PlaneEd - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Captain PlaneEd He's our hero | v1.0.1

#1 User is offline Clownacy 

Posted 01 April 2016 - 09:15 AM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 696
  • Joined: 06-July 13
  • Gender:Not Telling
Greetings. I am here today to address a matter of utmost importance. For decades, the Ed family has enjoyed a glorious reign, ushered into being by our founder, SonED, whose brilliance radiated down onto the groveling masses, bringing us into our golden age. SonED's magnificence remained unsullied, as its great legacy was honoured by its successor, SonED2. When the time came for SonED2 to entrust the crown to SonMapEd, the legatee pursued its dreams of travelling to exotic lands, extending the Ed family's reach. In time, no name would be more known, and more feared, than SonMapEd's. Indeed, it was as if SonED's majesty was lost to the world. Alas, SonMapEd met an unfortunate end before its time, and corners of the world remained unenlightened by the Ed family's righteous glow. It was then that PlaneEd headed the Ed name, at a pitifully young age. PlaneEd looked up to its successor, and its heart was set on fully-realising the late master's dream. Fate, however, would not be so kind. The tragic death of the heir's sibling, SpecialEd, who was closer to the young heir than anyone else, devastated it, and sent its life in a downwards spiral. Deaf to the divine will of SonED, and driven by sorrow, PlaneEd forever tarnished the Ed family name, allowing the unclean to crawl from the filthy corners of the world, and clamber to positions of power. Vermin like SonLVL, Flex, SoniPlane, these lowest of the low took what was rightfully ours, and PlaneEd turned a blind eye to it all.

But no longer.

Today, the glorious Ed family makes its ret-
*cough* ...okay, I'll stop.

Posted Image

What is this?
This is a fancy-pantsy improved version of the original PlaneEd v1.2, featuring a port to SDL2, a bugfix here and there, and a disgusting amount of Windows-ification. Hey, the original PlaneEd only seemed to work on Windows, anyway, so nothing of value was really lost.

Well, what does any of that mean?
First up, the port from SDL1 to SDL2, along with opening the project up to SDL2's feature pool, also allows the resizing of the window, without me having to implement some kind of software upscaler. This means you can actually see what you're doing. This also lets me use SDL_ShowSimpleMessageBox, which I use to display error messages, instead of immediately quitting and hoping people read the stdout/stderr files.

The bugfixes I've made are rather minor. First up, using the original PlaneEd, try opening the Sonic and Miles animated background.txt file in the PlaneEd Projects folder of the S2 Git disasm. You'll notice the gaps in between the repeating 'SONIC's are an add shade of blue/purple, while, in Captain PlaneEd, it's the same colour as what you'd see in the actual game. This is because PlaneEd stores the palette data in memory as BGR, but one section of code reads it as RGB. I accidentally fixed this when I converted the palette data to RGB while it's being loaded to memory, rather than during tile generation (which, might I add, SDL2 is very picky about). An odd bugfix in the original PlaneEd caused a crash if you tried to copy and paste anything from the S1 Git disasm's Title Screen.txt project. Removing this hackish bugfix eliminated that problem, but because the bug it was meant to prevent wasn't documented, I have no idea what side-effects that might have.

Finally, there's the mess that is the Windows-ification. No longer do you have to drag-and-drop files onto the EXE to get it work, or start it with the command prompt. Now, you can simply double click on the program, and be presented with a blank window with a Windows-style menubar, from which you select File, Open, and navigate to your projects in a much more natural way. Be aware, not everything has a Windows button for it yet. Heck, the only things the menubar does at the moment is Open, Save, Close, and Exit. You still have to get used to the Function Keys to do anything practical. There's also a View option, which allows you to select a background colour for the window, so you can see your tiles better, in the event that they happen to blend in with the default background.

I also replaced the stripped down KENS library with the full-fledged KENSC library, allowing access to Comper(?), Moduled Kosinski(??), and Saxman(???), for all your oddball needs. The mappings can also be in whatever compression you want (except Kid Chameleon), and not just uncompressed and Enigma. Because, you know, people do that.

This thing should be completely backwards-compatible with regular PlaneEd projects, as much as I would love to introduce a header, so any old file cannot be accidentally loaded...

PlaneEd sucks, why would you do this?
I wanted to learn C++. I've also had a pretty rough time with the SoniPlane editor in the past, so I figured, why not make my own ('own' being in huge quotation marks). I needed something to do for April Fools' anyway.

Links
Download
GitHub source repo
(This thing should be LGPLv2.1, but PlaneEd's original source never made it too clear)

Credits
From the original PlaneEd:
  • qiuu: for writing the original program
  • The KENS library authors: for making KENS available
  • Damian Grove: for the documentation and code of the Kid Chameleon compression format
  • Puto: for consulting on license issues and trying to run it under Mac OS (which sadly failed)
  • the #boom crew: for beta-testing - any bug you encounter is their fault :P

Captain PlaneEd:
  • flamewing: KENSC library
  • Clownacy: working on the code, while people would rather just complain about it =P

This post has been edited by Clownacy: 04 April 2016 - 12:41 PM

#2 User is offline qiuu 

Posted 02 April 2016 - 04:01 AM

  • Posts: 140
  • Joined: 05-February 08
  • Gender:Not Telling
  • Project:Blue Ball & Blocks
  • Wiki edits:13
I'm surprised someone's actually willing to go through my horribly structured old code. :)/> Especially considering that SoniPlane and RetroGraphics Toolkit are also open source (then again, I've never looked at their source so maybe they are just as bad? :P) Considering you went through the trouble of porting it to SDL2 and adding a toolbar, I wonder if a complete re-write wouldn't have been less work. Either way, I appreciate your effort! And as for the licence, LGPL should be fine (I don't want to impose any unnecessary restrictions).

I'm not a big fan of the Windowsification as I support platform compatibility (and I'm using Linux nowadays which I've switched to two years ago). The reason I initially only released a Windows build of PlaneEd was that that was all I had at the time, but I don't see any reason why it shouldn't build on Linux. I certainly agree that adding these menus adds to user friendliness though. My workflow at the time was that I just had a batch file for each mapping file that I ran to edit the mappings, which is much faster, and I didn't know how to add a tool bar without entirely programming it myself. Nowadays I'd probably use Qt for that.

I tested Captain PlaneEd in Wine, here are some notes:
  • It runs quite sluggishly while the original PlaneEd runs smoothly for me (in Wine). That might be due to SDL2 using hardware acceleration for its bitmaps unlike SDL, which might not be supported all that well in Wine.
  • When I open a project file via commandline parameter, its paths (pointing to mapping files etc) are taken relative to where Captain PlaneEd is run from (working directory), while I open it with File -> Open (why's there no hotkey anyway :P) it's relative to the location of the project file it seems.
  • Being able to zoom in by resizing the window is nice. Though does SDL2 have no other scaling filter than pixel repetition? It looks awfully ugly for non-integer zoom levels.


So while I'll probably stick to the old PlaneEd for the few occasions I have to use it, for Windows users that don't use the commandline this should make the program a lot easier to get into.

#3 User is offline Clownacy 

Posted 02 April 2016 - 06:06 AM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 696
  • Joined: 06-July 13
  • Gender:Not Telling
It's been a long time since I looked at the SDL2 code, but I'm sure it can be improved. The SDL2 port was the first thing I did to the tool, but I gave up on it halfway through because the SDL_CreateSurfaceFrom was failing when it was used on tilesData. I'll never understand why SDL2 limited the ARGB mask combinations. One thing to improve would be making sure the screen's Texture is set to Updated Frequently, which could be why things are sluggish. It was all one big hack to begin with, and I haven't touched it since.

I am hoping to bring back platform-independance at some point: I already have a branch with all the Windows stuff stripped out, and I've been looking into Qt. I've kept the source code arranged in a way that detangling the Windows stuff is easy. My reason for assuming PlaneEd was Windows-only to begin with was because the credits say that Puto couldn't get it to run on Mac OS.

I'll look into the other issues you noted. Truth be told, I have no idea why the relative path issue is a thing, since the code for reading those hasn't changed, but there might be some weird background thing I haven't noticed. A hotkey for opening and saving should be possible, I just never looked it up. Upscaling/downscaling might be controllable with an 'SDL hint'. Again, it's not something I looked into.

About licensing, I'm still new to it all, but, with your permission, could I attach the LGPL 'boiler plate' notice to the top of each source file? And would you be willing to license it to LGPLv2.1+, for better compatibility? I know I'm probably getting ahead of myself, but it's my first time working with licenses this much, and I want to be thorough. I've already gone through the headache of trying to figure out if the LGPLv3 KENSC could go with the LGPLv2.1 PlaneEd.
This post has been edited by Clownacy: 02 April 2016 - 06:46 AM

#4 User is offline qiuu 

Posted 02 April 2016 - 04:06 PM

  • Posts: 140
  • Joined: 05-February 08
  • Gender:Not Telling
  • Project:Blue Ball & Blocks
  • Wiki edits:13
So it's a hack on top of a hackjob? :P

Sure, it's fine if you prepend the LGPL note to the source files. You can also relicence it to whichever LGPL version suits you best, at least as far as I'm concerned.

As for the path issue, I didn't test it that thoroughly, and it might also be an artefact of using Wine.

#5 User is offline Clownacy 

Posted 04 April 2016 - 12:41 PM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 696
  • Joined: 06-July 13
  • Gender:Not Telling
I've addressed the working directory issue in v1.0.1. I've also tried improving the SDL2 performance, though there may still be more work to be done, since the current way doesn't perfectly imitate how the SDL1 code worked. For every SDL event, the image has to be reconstructed (SDL_Surface -> SDL_Texture generation), so some form of dirty drawing might need looking into.
This post has been edited by Clownacy: 05 April 2016 - 10:47 AM

#6 User is offline Clownacy 

Posted 09 April 2016 - 09:54 AM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 696
  • Joined: 06-July 13
  • Gender:Not Telling
I set up a Linux Mint installation, and the lag seems to be a Wine thing. A native WinAPI-less build isn't laggy at all.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users