Observation is a passive science, experimentation an active science – Claude Bernard (1813-1878, French scientist)
I started the Recursive Tree experiment thinking I’d be on a straight-ish course through a set of milestones but have learned something unexpected. Once it was on a touch device I instinctively expected it to be tactile. This discovery has reinforced my previous hunch that regular use of the target platform when doing cross-platform development is an absolute must.
Because of this, instead of the original plan for the next part of the experiment, I’m doing Pinch Zoom first. Following the development model I’m hoping to use throughout I’ve implemented as much of the heavy lifting parts of code within the Windows Desktop build first. I started adding zoom to the mouse-wheel and once ready will add the gesture based manipulation of those same parameters to the iOS build.
Here are some screenshots of it in action
A zoom of the lower right-hand side branch.
A deeper zoom of the lower right-hand side branch.
Bonus: A zoom of the lower right-hand side branch with an extra tenth layer of iteration added.
I’ve done the first part of recreating the scene from the Demo I linked previously.
Here’s a screenshot of the original scene taken from the entry for the demo on demozoo.org.
A screenshot of it running on my iPhone. Due to the thin lines & high-resolution it looks better when you click it!.
Finally, a rough side by side edit, with iOS on the left, and a scaled up Amiga screenshot on the right.
OK it’s not a perfect 1 to 1 copy, but it’s close. It would take some trial and error with the scaling and angle parameters. Also, as I’m pre-populating the list of vertices it doesn’t animate like the original. I could achieve that by looping and drawing only parts of the pre-populated list.
One of the things to investigate is 2D libraries to draw lines of varying thickness to replace my use of DrawUserPrimitives which doesn’t support line thickness.
This is the point at which I’ll diverge from the original (including removing the blue lines..).
I’ve also hit a few things with Free Provisioning which are of note.
Free Provisioning on an iOS device runs out after 1 week. The impact of this is as follows:
- Any existing copied app won’t run after that time. On some devices it shows the MonoGame startup screen (or whatever you’ve replaced it with) then just exits. On some devices you get an actual error “My App” Is No Longer Available.
- If you (make the mistake of) deleting all previous apps before running a new one you have to re-trust the Publisher in Device Management again to run new apps on it. Running/Debugging will hang until you’ve done this. The symptom is Xamarin Studio will copy to the device then fail to connect debugger. If you run the copied app manually the error shown leads you to this.
I was debugging a problem I’ve had for a while. Under Windows the running process wouldn’t actually stop once I’d hit ESC even though the Window closed.. After searching I found that it should be fixed, but I was still using MonoGame v3.5.1. I updated to v3.6 which solved it. After upgrading I discovered that the program window now doesn’t auto-centre. They’ve already fixed it for their next build.
Here’s the quick workaround I knocked up to see me through until that comes out.
protected override void Initialize()
// Temporary hack to reposition window as auto-centre/center is broken in MonoGame 3.6
Point WindowSize = new Point(this.Window.ClientBounds.Size.X / 2, this.Window.ClientBounds.Size.Y / 2);
Point ScreenSize = new Point(graphics.GraphicsDevice.DisplayMode.Width / 2, graphics.GraphicsDevice.DisplayMode.Height / 2);
this.Window.Position = new Point(ScreenSize.X - WindowSize.X, ScreenSize.Y - WindowSize.Y);
The first project is a series of experiments based around a simple graphical program. This will allow me to try out some things like managing different screen sizes and how to share the code between projects for each platform.
I’ll be recreating one of the scenes from this Demo (one of my favourites).
I already have a simple class I wrote previously that draws lines in MonoGame using vertex arrays. Once I’ve got the recreation of the original scene up and running on multiple platforms I’ll be trying out 2D library alternatives to replace my rudimentary line code and will add some modern (shader based) twists to the original scene.