20 Jun 2015 @ 12:07 AM 

More babbling about BASeBlock. It’s actually rather sad in a way because I would actually prefer to work on my work projects than on my own, simply because there is so much code involved in the changes I want to make to BASeBlock.

My biggest mistake when originally writing BASeBlock was in using the built-in .NET Serialization capabilities. The biggest problem with doing so is that the data stream is not very accessible, data errors are difficult to localize, and it is basically a huge nightmare- not to mention that there is no guarantee of data being portable from one build to the next. This was actually why I created my XML Serialization library a few months ago, “Elementizer”. The aim of Elementizer is to provide XML save/load functionality and have it implementable in a very similar fashion to ISerializable. This is in contrast to the existing XML Serialization solutions I found which tend to rely on saving and restoring public properties, and I do not want to change my object heirarchy and how values are exposed simply so they can be saved/loaded by a XML library. Right now my task is quite monumental- I need to go through and add support for my IXmlPersistable interface to every serializable class in the project. I’m trying to do it peacemeal and do a bit of testing as I go (so I don’t have to just press F5 later and hope it all works!) and while I’ve only got a rather basic amount working it works alright- I’m able to save and load a few block types to and from XML. The real question is going to be what it looks like with an entire LevelSet, which naturally requires quite a lot of other classes to support the feature. The biggest issue was adding support for some less-than-standard data types to Elementizer, such as Bitmaps and certain data types like DateTime and TimeSpans, which themselves implement ISerializable but for obvious reasons can’t implement IXmlPersistable. My solution consisted of using Elementizer’s ability to add deserializers and serializers for specific data types and I just slapped those into the Standard Helper.

It’s a daunting task but it is very sad seeing something that I used to take so much pride it be sort of abandoned in an unfinished state. And I think it is the Serialization that really keeps me from getting motivated- if I can fix that to use XML, I might be more inclined to fix other issues with the program, much like how I started to fix the GameState implementation. And, it will serve as a great example for Elementizer, since the serialization that BASeBlock needs is quite complicated- it needs to save an EditorSet which has lists of sounds and images that are added on and optional music, as well as a LevelSet which has sets of Levels which in addition to their own properties such as music and themes also have a set of various blocks and block types as well as Balls that the level starts with- so I won’t be able to really test saving very well until later.

The one great advantage of the ISerializable Interface implementation is how I was able to utilize it for the Copy-Paste feature of the Level Editor. I actually think the level editor is probably my favourite part of the program, actually.

Posted By: BC_Programming
Last Edit: 20 Jun 2015 @ 12:07 AM

EmailPermalinkComments (0)
Tags

 Last 50 Posts
 Back
Change Theme...
  • Users » 43711
  • Posts/Pages » 364
  • Comments » 106
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

PP



    No Child Pages.

Windows optimization tips



    No Child Pages.

Software Picks



    No Child Pages.

BC’s Todo List



    No Child Pages.