Showing posts with label Map Invoker. Show all posts
Showing posts with label Map Invoker. Show all posts

Saturday, February 4, 2012

Creating C# objects mapped to CC3 objects

When Simon and I discussed how to fully integrate the city creator, code named “Map Invoker”, the idea of it working like a Wizard surfaced. 

With a wizard like interface, each layer of objects (Waterways, Roads, Walls, etc.) would each be generated by a different page on the wizard.  A “generate” button would draw the objects directly in CC3.  If the results were not what the user wanted, the user could press the “generate” button again and the old objects would be removed and the new ones drawn.  Once the user liked the output, the “next” button would take the user to the next wizard page.

Now this sounded like a great design to me.  But …. I had some technical issues to overcome and some design work to make life a little easier.

The main technical issue was that the built-in dialog system was not made to ever run custom code and call XP functions while the dialog was still visible.  This was solved by using C# to write the Dialog code and communicating with CC3 via a simple callback class and a delegate.  I will go into this solution in depth in a later post.  Right now I want to go over the design work I did to make life easier passing data back and forth between C++ & C#.

Here is the diagram of my classes thus far.  They are simple value classes, with no behavior.  In a previous experiment, I created a REAL object (data & behavior) but because of the fact that a real class crosses native and managed code, it worked great in a all C++/cli environment, but I could not use it in C#.  So I decided to split data and behavior into two separate dlls.  The cc3objects.dll, a C# set of value classes and cc3actions.dll, the C++/cli dll that implements the behavior.

diagram

Now, what this does is let me create an entire object, or set of objects that can be directly converted to native CC3 objects.  So, I actually build my objects in C# then pass them to my C++/cli XP dll.  Plus, once I get done with this project everyone will be able to use these dlls.

Monday, October 25, 2010

Code name: Map Invoker

As Simon mentioned in previous post here, I am working on an application, which I am developing under the code name "Map Invoker".  It will generate random towns, from small little hamlets to large walled cities.  I've been concentrating on the algorithm side and am truely quite a ways towards a "feature complete" logic set.

So Simon was correct in stating that "He’s gone beyond proof of concept".  Soon I will be turning from generation to the interface so that all the parameters that I've included in the algorithms are exposed to the user so that the user can create an incredable range of different towns.

Once the paramter inputs are down and tested, then we will be looking into adding all the "garnish" that makes programs like this come alive.  So if you have any ideas, practical or "pie in the sky", I'd love to here them.  Either post your idea or email me at: SAUNDERL (at) HOTMAIL (dot) COM.