Ioachim Goodbye and thanks for all the fish

Some of you are probably wondering where I went. I’m still alive, I think, but december was busy on the real world.
I did advance a little on Maped (just here on my local copy), fixing the tile import system, to be able to import images as maps (even multilayer ones), and preventing tile duplicates.
On Aftershave, I just did a lot of thinking again. As I said earlier I was getting nowhere, so as a new year resolution, I’m going to complete Aftershave as it was originally intender, two and a half years ago, as a small (four dungeon and almost no story) Zelda clone.

And also! I completely failed trying to M something. This is as far as I got (two working menu screens)

About the title: I’ll be gone for January doing an intership on a hydroelectric power plant far from home, and with no computer near me. I’ll resume work (this time for real) on Feb.

Seeya, guys.

Ioachim More Maped goodness

I’ll be out all January doing an internship, and probably won’t have access to a computer, so I shall work hard during December and February. As this time I’m really getting into Maped, this is an official calling to all the Verge community: please ask for features, report bugs and give ideas of future development. So, people, any ideas?

Brush your teeth after every meal

Did I heard someone saying “brushes”?

Alas, behold! A simple brush system is now implemented.

Maped Prime: A little brush screenshot

Well, to be sincere, not fully implemented, you can’t undo it. But the idea is there. Variable size, square and round brushes (any other shape, a horsey maybe?)

The battle of the codes

So, this two week (three counting the previous update) of fighting against maped3 had been weird. I don’t know if it grew over the time from a nice little program to a mess of epic proportions (no offense to anyone who worked on it, it did it’s work nicely).

A big problem that has been standing against me is passing data around. This was the messiest part of the original, in my opinion. Sometimes the data is passed around in a big class, sometimes as parameters between classes, sometimes, the fields of the called class are updates, sometimes it uses globals, sometimes it passes data around and uses globals instead and sometimes the passed data are the globals.

A pretty dirty example is the current method for implementing undo and redo, the MapEventInfo class sent by the mapviewer contains a SetTile method that adds a set tile operation to the map OperationManager.

So I decided that a good idea (and to prepare for MDI)  was to make classes that contain the information needed for operating: MapContext, contains all the data necesary to edit maps (Map, selected layer, selected tiles for painting, the map OperationManager), EditorContext, the common application data… I should add TilesetContext and EntityContext, at least, and make a proper editor for those.

Preparing the way to the future

I was reading last week’s update by Overkill, and started to think about which could be the best way of implementing multiple zone, obstruction and entity layers. The idea that came to my mind was “layer groups”. There is two kind of layers: graphic and logical. The entity layer is both of this, and the zone and obstruction layers don’t have much sense without an entity layer. This “logical groups” should exist anywhere in the layer list. And there should be named retrace hooks, also.

I liked the idea of waypoints (I imagine a pin in the map :3) also, they could be very useful for some things.

This pressed the panic button on an issue that has been bothering me: backwards compatibility. A simple way of knowing supported features for a format, would be to have a feature flags enum, as a property on each format encoder… But this poses a problem: what to do if the map you are trying to save doesn’t support a feature? for some things if fairly simple (like alpha blending, or waypoints, as they could be made into zones or entities), but for others, like the multiple logical layers thingy, is could be messy. Any opinions?

Ioachim Let’s plug it in

This week has been very demanding from a real life point, so the update is short.

I continued working with the plugins in MapedPrime

Now the file mananging (both map and tileset) uses plugins. For now, just Verge3, I need to finish fixing Verge2 file loading and connecting the codec plugin system, so the program uses it.

The internal representation for the file formats are horribly mangled and hacky (there are some nasty hacks in-model to support Verge2 loading), so I’ve been cleaning them a bit. More work should go to the codec and less to the model.

 And I added a basic plugin window. For now it lists the internal plugins. There it is:

Maped Prime alpha version: Plugin window

Maped Prime alpha version: Plugin window

The little problem now is that Mono 2.0 has Windows.Forms (or System.Drawing, I don’t know) completely destroyed, at least in Windows on my computer. This week I’ll test it in the oficial Mono-Suse LiveCD, to see if it works.

Ioachim Gruugruuu (dorf)

Five weeks overdue… If it wasn’t for Grue’s constant nagging, I probably wouldn’t be here now.

Just now I noticed that I did enough work to post all this time, but didn’t bother to.

It’s late, so I’ll make it fast and boring

What’s up, doc?

- Now with nice and working splash screen (the logo at the top of this page) and main menu

Aftershave r66: Main menu

Aftershave r66: Main menu

-Rewritten the font system, now uses BMFont files, now is easier to use and a lot more powerful.

- Implemented the base for a debug console. For now, just a text writer, this is a screenshot with some data pulled out of nowhere

Aftershave r66: Console mock

Aftershave r66: Console mock

- Added joystick support

- There are a couple of transition effects… But they should be implemented in a better way, for now the are copied inside the states that use them.

On other news

I resumed the work on MapedPrime after a long recess.

  • Started reordering code, separating roles. My first objective is to allow multiple document editing
  • Removed (I hope that for the last time) the dependance on Zlib.net (I wrote a wrapper for using the real Zlib)
  • Reimplemented the flood fill (I have to test it and merge it back into the trunk)

The future plans are:

  • x86/x64/PowerPC Linux/Unix/MacOSX compatibility (the main reason of Prime)
  • Multiple map editing
  • Plugin based codecs
  • Intellingent image importing (like psd2map)
  • Complete UI overhaul

So, comments, ideas, anything is welcome. And, probably this week I’m back in #sancho to waste my time

Ioachim A long standing problem

Just a little idea sharing. For a little Verge-related experiment I’ve been doing (and losing due to crashes) this last couple of days, I decided I needed to implement a state machine validating system.
Well… Tada!! Somehow ready, in C# (I just need to add a delegate to do something when entering the state, but that’s a kinda special case.

And with C# 3.0 lambda expressions, this should be a to use. So, this should also work quite easily in Python, now that I think of it.

    //A nice state machine generic validator in C#
     public class State<T>
    {
        protected LinkedList<KeyValuePair<Predicate<T>, State<T>>> transitions { get; set; }
 
        public State()
        {
            this.transitions = new LinkedList<KeyValuePair<Predicate<T>, State<T>>>();
        }
 
        protected virtual State<T> GetTransition(T t)
        {
            foreach (KeyValuePair<Predicate<T>, State<T>> trans in transitions)
            {
                if (trans.Key(t))
                    return trans.Value;
            }
 
            return null;
 
        }
 
        public virtual void AddTransition(Predicate<T> condition, State<T> state)
        {
            transitions.AddLast(new KeyValuePair<Predicate<T>, State<T>>(condition, state));
        }
 
        public bool Process(IEnumerator<T> it)
        {
            State<T> current = this;
            while (it.MoveNext())
            {
                current = current.GetTransition(it.Current);
                if (current is FinalState<T>)
                    return true;                
            }
 
            return false;
        }
    }
 
    public sealed class FinalState<T> : State<T>
    {
        public FinalState()
        {
            this.transitions = null;
        }
 
        public override void AddTransition(Predicate<T> cond, State<T> s)
        {
            throw new NotSupportedException("A final state cannot have transitions");
        }
 
        protected override State<T> GetTransition(T t)
        {
            throw new NotSupportedException("A final state cannot have transitions");
        }
 
    }