[Vm-dev] Re: [Pharo-dev] developing games in Pharo
eliot.miranda at gmail.com
Sun May 11 15:21:38 UTC 2014
mornin'. Thanks for such a helpful, in-depth answer! You ask about support for ARM... answer below.
On May 11, 2014, at 3:09 AM, Hilaire Fernandes <hilaire.fernandes at gmail.com> wrote:
> As several people mentioned it, I may have a few tips to share regarding
> developing educative applications with Pharo (you can read Squeak as
> well, but you may have a better support with Pharo if you want to target
> touch devices as well, I don't want to write the Squeakers are helpless
> -- not at all -- but it seems to me there are more experiences to bring
> Pharo applications on touch devices from A to Z -- from the developer to
> the consumer I mean).
> You are a Smalltalker so you definitely know the related benefits to
> develop with Pharo, so no need to spend words on that. You also know
> your application will be portable to the three workstation operating
> systems, very easily as the VM are routinely compiled for these hosts.
> To get an idea about how could look your end user application, I suggest
> you take a look at Dr.Geo - http://drgeo.eu for workstation and touch
> devices ; then also iStoa for Linux -
> https://launchpad.net/istoa/+download. These are packaged for end user.
> For Windows the installer could be improved with installed entry in the
> system menu.
>> 1) I know I have to build a suitable executable but I have never done
>> this. I have only written Smalltalk code that I then
>> use. So how do I build such an image and how big is it (assume code
>> for game is small (say 3000 lines of code)).
> To build the end user application, you will have to do it in two steps:
> 1. Prepare your image: install your source code and related source code
> package, set the state of the image, shrink your image and save it. You
> will use Metacello. I use smalltalk script for that.
> 2. Build your application package: you will use a pre set application
> hierarchy with the VM, icons, execution script if needed, etc and
> install your image, the necessary media and translation if any. I use
> bash script to do so.
> For inspiration you can have a look at Dr. Geo subversion repo or
> iStoa launchpad repo. The later one may be easier to follow as I gain
> some experience from Dr. Geo work.
> Once you setup this, building your application is easy. It is just a
> matter to update your ConfigurationOf. and executing your bash script.
>> 2) How do I get the virtual image on the customer's machine. Keep in
>> mind the customer is someone somewhere
>> on the Internet who probably knows little about how to install
>> Smalltalk or anything else. I am assuming here that
>> installing the game and installing the VM are two different tasks.
>> Is there a way to make this a single task?
> No installing the game and VM will be done at the same time.
> You ship your application in a zip archive or auto-installable
> executable with VM, image, and related media, documentation and
> translation files.
>> 3) So far I am assuming the target machine is Linux/Windows/Mac on a
>> But can Smalltalk be run on any of the IPad/Notebook/etc out there?
>> These machines represent a larger game market I believe.
> Yes it is possible. Look at DrGeo on AppStore and GooglePlay.
> Sadly we do not have JIT support for these devices.
> Is it just a mater to support the ARM instruction set or much more
> complicated? I would be please to know.
On iPhone Apple expressly forbid JITs other than their own so until that changes the fastest VM on iPhone will be the Stack VM.
On Android JITs are allowed. Tim Rowledge is currently working on the Cog ARM back end which was started by Lars Wassermann, and is making good progress, working in the VM simulator. He is targeting the Raspberry Pi. I don't know whether he'll have time to port to Android, but I'm sure someone can. I don't want to talk for Tim but I expect he'll easily be finished this year.
On a related tack, Doug McPherson has recently implemented the ARM support for Cog's FFI module, so there is now FFI support! And the Pharo team have taken on a person to work on AsmJIT for ARM. So at least on Android the Squeak/Pharo support will be good (although I expect more work is needed to provide good touch support).
Hilaire, perhaps you can tell me whether touch support is OK or whether work needs to be done in the VM?
> Any way for touch devices, you still have the two aspects of Smalltalk
> to consider:
> 1. The VM: it will be the interpreted VM, or COG without JIT support.
Cog without JIT support is called the Stack VM, (since it optimizes message sending by mapping contexts to stack frames). Soon (some time this year) we should have a Spur Stack VM which may be -35% to -40% faster.
> Esteban and Dmitry were really helpful and collaboration was great to
> let me concentrate on the image level considerations below.
> 2. Your image.
> For point 2, you will have extra work, better to take it into account
> since the beginning of your project if you target touch device:
> a) no support for multiple touch, at least as far as I know. I read
> there and there people talking or doing things, but no real stuff.
> Anyway it is definitely not a show stopper: you can be ok with tap and
> dragging. But you need to consider it.
> b) support for the virtual keyboard, Esteban and Dmitry added hook to
> show or hide the touch device keyboard (see drgeo code with
> showVirtualkeyboard). In your GUI design, you need to be careful your
> text zone is not hidden by the virtual keyboard. Again it is resolvable.
> c) the numerous screen resolutions of the touch devices. For DrGeo and
> iStoa I took very different directions. Probably the most interesting
> for you will be the one I took for iStoa. The application window is a
> full screen morph with scaled bitmap. My bitmap are scaled for a Nexus5
> screen resolution (~2500x1600), then graphics and font are downscaled
> according to the used screen device. I suggest you take a look at the
> Linux iStoa application and resize the window to see what is happening.
> Using Athens is definitely not an option now for 2 reasons: it is not
> supported yet by touch devices; as long as it is not used in Pharo
> itself, if you put in perspective delivering to end user you have to
> consider it as unstable.
> d) native look and feel: it was really a big concern -- the bigger in
> fact -- for DrGeo. For iStoa it is nearly irrelevant, but there are
> still some widgets around. Again games does use native widget, so it may
> be ok. For DrGeo I need to subclass a Pharo theme to remove window
> decorations, force dialog to be positioned on the top and centered and
> other details I forgot about. It looks pretty ok for me, but not for
> touch device users.
> I tried to share the experience and work on this point but without
>> 4) Assuming I can arrange for my computer game (if I write it) to be
>> installed are there memory/cpu usage issues
>> that I need to worry about (the game itself will use a minimal of
>> memory/cpu except for graphics which also
>> is pretty reasonable). I am thinking here of IPads etc. For
>> Desktops/Laptops there should be no problem.
>> Download time and subsequent storage space is also a concern;
>> remember the device is probably used for
>> lots of other things so the amount of space allocated for games may
>> be small compared to the space on the
> If your code and medias game are small, the image size will be a
> problem, not something that will prevent your application to work
> perfectly, but more a feeling of wasted resources.
> With Pharo1.4, I can shrink DrGeo image below 10MB, including DrGeo
> code. With Pharo3, I can't get below 16MB with (smaller) istoa code.
> It is really a deception, the new developer tools were not developed as
> loadable code. I guess it was too difficult to be done, although it was
> a promise (informal?) of the Pharo project when it start up.
> Again it is not a show stopper.
> Good work on your project, I will be happy to read about its progresses.
>> 5) Sorry for the redundancy if these questions have been asked before
>> (which I am sure they have).
>> Thanks for any feedback; I am sure others are interested in this
>> question too.
>> Ralph Boland
>  https://gforge.inria.fr/scm/?group_id=1308
>  https://itunes.apple.com/us/app/dr.-geometry/id559858173?mt=8
>  https://play.google.com/store/search?q=drgeo
>  http://forum.world.st/iOS-polymorph-theme-anyone-tt3557696.html
> Dr. Geo http://drgeo.eu
More information about the Vm-dev