realbasic-nug
[Top] [All Lists]

Re: Array of Canvases vs Subdivided Canvas

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Array of Canvases vs Subdivided Canvas
From: Joe Strout <joe@inspiringapps.com>
Date: Thu, 30 Jul 2009 08:21:15 -0600
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <20090730051100.261215645@mail.lisauskas.net>
Organization: Inspiring Applications, Inc.
References: <20090730051100.261215645@mail.lisauskas.net>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
User-agent: Thunderbird 2.0.0.22 (Macintosh/20090605)
timm@lisauskas.net wrote:

I thought an array of Canvases might work better, but what kind of
issues might I run into?  For example, while I imagine a 20 x 20 grid
(400 Canvas objects) would be no problem for any modern computer to
handle, what about something on the order of 100 x 100?  1000 x 1000?

Sounds unpleasant to me. If you just have one of those in the IDE and then create the rest via cloning, it would be slightly less unpleasant. But in my experience, a single canvas for a game like this is far easier.

An array of Canvases would also more easily allow for oddly- shaped grid
maps, I believe.  Instead of a simple square 20 x 20 I could have
designs such as a plus sign, square with a hole in the middle, and so
on.

Yes, but what if you decide that instead of square cells, you want hexagonal ones? Or some other odd shape (like countries in Risk)? Canvases do not get along well when they have to overlap, and then you're going to be in a world of grief.

So I approach these apps with a single big canvas in which I do all my drawing, and then elements can overlap however they need to, and I have complete control over what gets drawn and when.

This doesn't mean it's any less OOPy -- you can still have a "BoardCell" class that represents each place a player can move or interact with or whatever, but now you get to define that however you want; it doesn't have to be rectangular and non-overlapping.

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>