A book

Monkey Archive Forums/Monkey Discussion/A book

Tri|Ga|De(Posted 2011) [#1]
Is any of you super codes thinking of making a book about Monkey programming.
I know I would by one to get me started.

traderhman(Posted 2011) [#2]
I really got a lot out for Foppy's Monkey Pixel tutorial in the Tutorial section. Would have taken me a lot longer to get comfortable without it.

Also, I believe the gentleman who wrote the fantomEngine framework in the App Forums is writing a book. The last post on his webpage:


mentions the book: (Monkey Game Development Beginners Guide)

I have no other information though.

FlameDuck(Posted 2011) [#3]
I doubt Monkey has the critical mass necessary to get any serious authors interested in writing a book about it. A better way to proceed in my opinion, would be to find a book on a similar language (like Java or Python) and then apply what you learned there to Monkey.

Warpy(Posted 2011) [#4]
I think somebody is writing a book.

MikeHart(Posted 2011) [#5]
Yes I do, for PacktPub.

AdamRedwoods(Posted 2011) [#6]
I'm reading a book about a monkey.

Cartman(Posted 2011) [#7]
I wrote a game programming book once for Sam's publishing and never made enough to justify the months I put into it. I would have made more working at McDonalds. Flameduck is right it won't sell enough copies. Whoever is going to do it has to just be willing to give up their time without expecting much monetary compensation.

MikeHart(Posted 2011) [#8]

did Sam's payed an advance?

I agree, I don't see that much of a market for the book also. It isn't for experienced coders anyway, as it teaches more to create certain games than going deeply into the language. It's a code by example type of book. The format they gave me for the book is very limiting, so I could not add everything I would like to have added. But hey, if I am bored I can still write about these things on my website. Somehow writing a book for such a publisher feels like writing a game for a game publisher. Deadlines, deadlines, feature cutoff. I feel for these guys who went through it.

Writing tools/books/tutorials for any of BRL's products is not financially rewarding imo. The market is to limited. They are great tools but not marketed for the masses. You better create something for TGC, Unity or GG. There you have better chances to make money.

Anyway, maybe PacktPub targets more non Monkey people who are interested in the language. This way, the book could give a nice introduction.
Also they pay a nice advance, which I can keep even if the book doesn't sell at all. I am fine with it.

The main reason I went for it when they asked for an author of twitter, was to prove myself that I can finish such a beast.

Cartman(Posted 2011) [#9]
Yeah. They gave me a 5K advance and it never made enough to go above that threshold, so that's all I made on it. I got really good terms as well but there just wasn't enough interest in the book. And this was with DirectX 9 so the audience was much bigger than Monkey.

If you want to write a book, do it because it makes a good talking point on your resume and it's one of those goals you set for yourself. That's why I did it and i don't regret it.

If I was to do it over in this market I would probably do it as a paid PDF and cut out the publishers. However even with that you have to deal with piracy, so you still won't make money on the deal.

MikeHart(Posted 2011) [#10]
5K? Good deal. Mine is 3.

AdamRedwoods(Posted 2011) [#11]
I wonder if you could do better making paid video tutorials ala Linda's vs. books these days. I know in the 3D modeling/rendering world they make videos and sell the dvds.

luggage(Posted 2011) [#12]
It's also pretty easy to self publish to the Amazon Kindle store.

Tri|Ga|De(Posted 2011) [#13]
Hi Mike

I just ordered your book today. Paper and PDF.

MikeHart(Posted 2011) [#14]
Hi TriGaDE,

thanks. I am absolutely no idea how the raw version is. I didn't even got informed that it is available when they put it online. Hopefully you like it. I am still on the first draft and there the 9th chapter. Mark and Simon are reviewing it but so far I head nothing from the publisher about changes or errors.

If you have any problems with it, just let me know. Here or at

mike (a t) whiteskygames ( d o t) com

Because of the rules I got from the publisher (content, setup, amount), I will most likely will have additions to it posted next year on my website.

Again, thanks for your support!
Michael Hartlef

samowitsch(Posted 2011) [#15]
Hi Mike

I have ordered your book too (in the RAW version). I can't wait for the last chapters AND the example source files on the PacktPub website ;o)

MikeHart(Posted 2011) [#16]
To the one who send me the message about being an editor etc.! Somehow I lost your message in my phone :-/

I hope that the book gets edited by PacktPub and that I get the chance to make corrections before the final draft. I am on the first draft, the book gets reviewed but os far I got no comments from PacktPub on the content.

About if fantomEngine and Diddy work together.... I didn't test that. They might, I don't know. As long as I amion the first draft stage of the book, I don't want to look at Diddy so I don't get sidetracked. Heard that it is a damn good module and has quite some follows. So thumbs up to them.

Tri|Ga|De(Posted 2011) [#17]
There is some mistake in the code for the first Pong game (Pongo), it does nor work on my machine as described.

I have not got to the second game yet.

MikeHart(Posted 2011) [#18]

can you send me your code so I can compare it to the code (which runs with V48 without a prob here). Sadly I got no raw version of the book from my publisher and cannot compare it to the draft I sent in.

Please send it to mike ( a t) whiteskygames (d ot) com

Chapter #2 was a little problematic submitting wise. I have one version with over 50 pages and one with around 25 pages. Don't know which one they have used.


MikeHart(Posted 2011) [#19]
Hi C.K.,

you got mail! :-)

As I am not sure how the support for RAW books from PacktPub is (I guess no support), you can use my forum too for questions abotu the book.


I will soon add a section for fantomEngine there too.

c.k.(Posted 2011) [#20]
I've tried registering at the forum, but apparently it doesn't like my gmail.com domain?! Dunno. Just tried registering again and it looks like it's not going to work again.

MikeHart(Posted 2011) [#21]
Hi C.k., try again. I had gmail adresses banned because I got flooded with trash from there. You can sign up now.

c.k.(Posted 2011) [#22]
OK, it worked! You can ban gmail registrations again. :)

MikeHart(Posted 2011) [#23]
I won't. Then you won't be able to log in. But I am doing a spam check on every IP for some weeks now.

Tri|Ga|De(Posted 2011) [#24]
I have not heard nothing from PacktPub since I downloaded the Raw version.

So Mike I was wondering if you have any news on the Book?

MikeHart(Posted 2011) [#25]
My news are: I might finish the 1st draft of chapter #10 tonight. Chapter #10 includes implementing Ads (IOS/Android) from MobFox and using InMobi as the backfill option there. Tonight I will finish store submitting to the Android market. If page count allows, I will add IOS app store too.

After I submitted chapter #10, I have around 4 days for each chapter where i make corrections and act on the reviewer comments.
I saw that Amazon lists the book to be possibly released by end of January. My guess will be more like February.

Tri|Ga|De(Posted 2011) [#26]

Thanks for your update.

MikeHart(Posted 2011) [#27]
I added now the steps to get a signed apk file. Loading the file up into the market is self explaining.
Let's see now how it is with IOS.

MikeHart(Posted 2011) [#28]
Done! Finish!!! I feel great! 10 chapters since beginning of June. It just feels great!!!

Tri|Ga|De(Posted 2011) [#29]
PacktPub could unfortunately not tell me when we would get a new raw version.

But nice to see the book is getting along.

Tri|Ga|De(Posted 2012) [#30]
So are you getting there?

MikeHart(Posted 2012) [#31]
I am there, but this wannabe publisher is not. They have more important projects to finish they said and so delaying everything. They also managed to destroy the content of chaper #4.

Rewrites(corrections) of 5 chapters are done. On thursday I will deliver the rewrite of chapter #7. Surposingly they wanna publish in April, who knows if that happens. I am pretty mad about them. That was my first and last experience with a publisher. Never will do that again.

Tri|Ga|De(Posted 2012) [#32]
I'm sorry to hear that.
Maybe we can influence them by sending e-mails asking why it takes so long?

MikeHart(Posted 2012) [#33]
I don't think so, the time plan they have now makes sence. They simple started the 2nd draft phase to late. Also they seem to have some weird converting issues. I am writing on Open Office on OSX. They seem to use some kind of WinWord on MSWindows. And that screws up a lot of the formating and content. Well, that is their problem not mine. I just have to wait to get my money, which frankly hurts a lot.

Soap(Posted 2012) [#34]
Did you sign an exclusive contract with them?

MikeHart(Posted 2012) [#35]
Yes, they have searched an author for this book and have given a pretty strict frame about it. What should be in it, how to setup each chapter. For an example, in chapter #2 I wanted to write much more about the language itself, about Monk and stuff like that. I got it back because it had to many pages and a lot of stuff got cut out.

Tri|Ga|De(Posted 2012) [#36]
So Michael any news on this book?

MikeHart(Posted 2012) [#37]
I heard yesterday that the publisher still wants to release it in April. My job was done quite a while ago. I am sorry that you have to wait. But this is out of my control.

Gary Leeds(Posted 2012) [#38]
PacktPub seem to be a waste of time. If you review the info on your book (or any RAW book) it states quiet clearly that it is available to view as part of the PacktLib subscription (which allows you to download one book from their library per month as well as view all their books online). Surprise surprise, they don't list RAW books in the PacktLib. I told them about this 6 months ago and they said it was a mistake on the website and they would correct it, it is still there.

I bought the RAW version expecting it to be updated and it seems it is them holding things up. I don't want to start working through the book when things can and will have been changed and I certainly don't want to waste ink and paper printing the RAW copy so I can read anywhere.

I think everyone that has bought the RAW version should get in touch with PacktPub and ask them when the update is happening. It was due for Jan, then moved to Feb, then March and now April. What's the betting in a weeks time that date will move to May? If enough of us complain and dare I say ask for a refund (as long as that doesn't cause an issue for Michael) they have to do something about it don't they?


Neuro(Posted 2012) [#39]
I was told by them that the book is due to be released in the last week of April.

MikeHart(Posted 2012) [#40]
Hi Gary,

another person who bought the raw version wrote to me and quoted a reply from Packtpub to him. According to this reply, they want to have the book published at the end of April.

I had asked PacktPub why the Raw version never included the 3 last chapters. They told me that it was never intended that these chapters were available to the raw buyers.

Like you, I have asked them why it took that long. At the beginning of the writing process, the release date was set in December 2011. My writing schedule said that I should have been done writing in October 2011.

Because of all kinds of circumstances, I was done by mid December. According to PacktPub, these 4-6 weeks delay have caused a delay of 16 weeks in the publishing process. This is what they have told me 2 weeks ago. LOL! Hard to believe, but that is what they told me. Looks like that they had no buffer what so ever in the plan.

There were also technical problems. I wrote the book in Open Office on OSX. They work on Windows in Word. The reviewers used a software I don't know. The file conversion inbetween (Me->PacktPub->Reviewer->PacktPub->Me) screwed up the chapters more than once. I was so mad sometimes, I just wanted to throw the towel. So i told them several times what I think of them. In not such nice words. ;-) Writing this book was one hell of an experience, I can tell you.

Now I seriously hope that people will like what I wrote. The comments from the reviewers were good. So I have hope for it.

Anyway, if you have not gotten access to the code of the book already, then please write to Packtpub. So far everyone who did, told me that they got the code then.

I hope you will enjoy the book when it is there. And please let me know here or at

support ( a t) whiteskygame ( do t ) com

how you like it. And if you have questions, feel free to ask them too.


MikeHart(Posted 2012) [#41]
And Gary, please don't depend your decision about asking for refund on if that would have a negative inpact on/for me.

You will have your reasons for it and everyone has to respect that. I do!

Gary Leeds(Posted 2012) [#42]

Thanks for the reply. Firstly I want to say that my suggestion of a refund was mearly to try to get them to get their act together and in no way a reflection of the content. From what I have read so far everything seems thorough and informative and way better than what I could ever do.

I hope that once they finally get it published that you get back at least what your time cost you and a bit more


MikeHart(Posted 2012) [#43]
Thanks Gary for the nice words. :-)

MikeHart(Posted 2012) [#44]
Ok guys, it is officially published.


c.k.(Posted 2012) [#45]
Wooo hooo! Now to do some reading.

dave.h(Posted 2012) [#46]
cheapest place ive found for it is



it looks very usefull indeed

samowitsch(Posted 2012) [#47]
Great news! Just downloaded the final version!

Tri|Ga|De(Posted 2012) [#48]
Great, now I just have to wait for them to send it.


Where did you download the full version. I could not find it under my orderinformation?

Jimbo(Posted 2012) [#49]
I don't like the publishers much. I'm a writer as well as a programmer, and I know about publishers.

The price they quote for the e-book version on their site does NOT have VAT included. So when it says 15.99 you find (in the UK) another 20% added on. If you try to get a free chapter sample you mysteriously either vanish into web nowhere-land or you land on a page that wants to charge you 8.99. All of this is very bad practice. Prices should be shown including VAT, and free should be... err.. free.

I went to Amazon UK, where it's 15.65 including VAT - and it arrived on my Kindle 30 seconds later. I will report back, and hope to post a wonderful review on the Amazon site when I've had a chance to read it, which will probably be in airports and on aeroplanes this week.

Best of luck with it!

MikeHart(Posted 2012) [#50]
Thanks Jimbo,

I am curious about what you will have to say.

dave.h(Posted 2012) [#51]
yippee my books just been delivered but i cant read it till 18.30 cos im still at work.Im looking forward to reading this tonight.(i bet the butler did it)

MikeHart(Posted 2012) [#52]
Great news Dave. Please give me your honest oppinion about it.

dave.h(Posted 2012) [#53]
hi just had a bout an hours read of if and im very happy with it.I wouldve liked to have seen more on the windows phone side and how to publish that as i struggled with that initially but i think your android and ios side is well covered.That was one of the main reasons i decided to buy it because i thought i would struggle with xcode and the publishing side.Im not a programmer by profession but was glad to see that by looking at your examples i seem to be on the right track.They start off at a level of difficulty that i think is about right.In fact i wish something like this had come out earlier because quite a few of your example programs entail most of the concepts i have struggled to teach myself.I would recommend this book especially to newbies.I will keep this book in my fortress of solitude and read it daily.If a book makes it there im happy with it.My biggest problem with the book is the rubbish picture on the front.Surely they could have got a picture of a monkey on it.

MikeHart(Posted 2012) [#54]
Thanks Dave, makes me happy that you like it.

About the cover, I should have asked around for someone to do one. But I had no time to do one myself and simply forgot to ask around about it. Why the hell they didn't took a monkey is beyond me.

JonnyBritish(Posted 2012) [#55]
I will be pre-ordering the book and helping get the word out. After all someone can take your book, learn monkey and get an app to the Windows Phone 7 app store!

Great - cant wait to see it

JonnyBritish(Posted 2012) [#56]
Just tweeted the book

MikeHart(Posted 2012) [#57]
Hi Johnny,

like Dave mentioned. The book doesn't include specific informations on how to get an app on Window Phone.

But thanks to mention it.


MikeHart(Posted 2012) [#58]
If you want to tweet/post about the book, please use this link:


It helps PacktPub to keep track from where it comes.


Paul - Taiphoz(Posted 2012) [#59]
Considering getting this, how many pages does it go for, and how advanced does it get ?

MikeHart(Posted 2012) [#60]
The book is around 400 pages with index and appendix. It is a game dev beginner's guide. It concentrates on creating the 8 sample games in a step by step by step fashion. The book doesn't explain everything in great deep, but shows more a practical approach.

What I saw about your game, I would say that you are already very advanced and the book might be to simple for you.

But if you want to get to know fantomEngine more, then it shows quite a bit of it, as I used it in 6 of these 8 games. This has helped me keeping the page count down for each game big time.

The last chapter is about integrating ads for Android and IOS. Here I show integrating MobFox and InMobi as a backfill.

The games that are covered are:

* Pongo - A Pong clone in pure Monkey code, no use of 3rd party modules
* Rocket Commander - A Missile Command clone using a class oriented approach for each object

The next games all use the fantomEngine:

*Comet Crusher - An Asteriod Clone
*Chain Reaction
*Balls Out - Simple game where you control a ball via the accelerometer
*At the docks - A Sokoban clone
*Air Dogs 1942 - WW2 dog fighting
*Treasure Chest - A Match3 type of game

matt(Posted 2012) [#61]
I've just caught up on this thread and I just wanted to say congrats!

MikeHart(Posted 2012) [#62]
Thanks Matt.

Paul - Taiphoz(Posted 2012) [#63]
Hay Michael , yeah its those later chapters on publishing stuff to the markets that caught my attention. might check it out at some point.

looks good.

Snader(Posted 2012) [#64]
Great work Michael, just bought it on Amazon!

MikeHart(Posted 2012) [#65]
Thanks, let me know your opinion once you have studied it.

JonnyBritish(Posted 2012) [#66]
My copy turned up today - had a quick skim through and like the format and will start reading tonight. Also highlighted on my companies internal retro gaming forum as a way of saying hey like playing games, try this new way to create your own.

Never thought I would ever tell anyone...oh I code in Monkey :-)

Snader(Posted 2012) [#67]
Hi Michael,

Great book (I have the Kindle edition from Amazon using the PC kindle reader)! Just in chapter 3, but couldn't resist to compile all the examples I downloaded.

Having some troubles though compiling some of the examples:

Treasureches.monkey gives an Identifier 'TouchHit' not found. So I decided to add the fantomEngine.monkey file from a atthedocks chapter 7 in the chapter 9 files. Then it says Identifier Height not found - perhaps you meant 'height'?

Airdogs1942.monkey gives an Monkey runtime error: Illegal operation on removed node when running.

Also, there are some sourcecode typos in the book. For instance on page 'Time for action player paddle movement', at point 5, there is a ControllPlayer() instead of ControlPlayer. Never found a book that was without fault though ;)

MikeHart(Posted 2012) [#68]
You definately need the newest version of fantomEngine. Get from google code. This node removal error happened with older version after Moneky 42 or 44 I think.
Did you got the source code from Packt or did you type it from the book?

Just checked the treasurechest code. There is definately a problem there. I will report back.

MikeHart(Posted 2012) [#69]
Thank Johnny, I am sure that helps a lot.

MikeHart(Posted 2012) [#70]
Just saw an email from PacktPub. If you would like to review this book and need a free ebook copy for the review, then please contact Vishal Tiwari at


PacktPub has a limited amount of ebook copies to give away for reviewing.

Snader(Posted 2012) [#71]
I got the code from Packt and the fantomEngine from your code.google page. Also the latest monkey is in place!

matt(Posted 2012) [#72]
I downloaded the code a few days ago and have reported a few issues at the google code site:

They are largely the same as above:
1. TreasureChest i was able to work around
2. Airdogs1942 works with the latest fantomEngine
3. RocketCommander I was not able to get working.

MikeHart(Posted 2012) [#73]
Guys, i will look into this quickly. Thanks for reporting this.

MikeHart(Posted 2012) [#74]
Funny, In Monkey56B no errors are reported reagrding missing cities and the touchHit. In Monkey58 it reports errors. :-(

MikeHart(Posted 2012) [#75]
Ok Matt and snader,

1) in TreasureChest please remove the "eng." infront of the TouchHit.

2) In RocketCommander please remove the "game." infront of cities. The class file is definately there, but since Monkey 58, Trans reports now this error. Before it somehow overlooked eng. and game. in the code and it still worked. Difficult to catch then :-)


Snader(Posted 2012) [#76]
Thank you Michael, working perfectly!

MikeHart(Posted 2012) [#77]
I am glad it works for you now.

matt(Posted 2012) [#78]
Thanks Michael :)

Neuro(Posted 2012) [#79]
Theres something odd in the ftEngine Class. Does CreateImage() actually loads and display the image right away? Is there a way to preload the images instead of displaying it right away?

MikeHart(Posted 2012) [#80]
Nothing weird there. CreateImage creates an object, loads the image and attached the image to that object. The object is active and visible right away and will render of course.

Just make it invisible via


And it iwll be still active but not render.

If you want, I can add a command so you can tell the engine not have objects visible and active right away. Something like


There is engine.SetDefaultLayer already so it fits right into this methology.

Neuro(Posted 2012) [#81]
But what if you need to create like a series of bullets, or clones of enemies? The engine would have to load an image file each time that object is created. Wouldn't it be more efficient to have that image data preloaded in memory first, and then accessed again each time ever its needed?

EDIT : Oh wait, i see that there is actually two CreateImage() overload, one actually preloads it from an atlas while the other loads it directly from a file. Makes sense now :)

matt(Posted 2012) [#82]
I'll be reviewing the book soon on here, Amazon, and at my monthly game coders meet-up.

Thanks to Packt for a review copy.

MikeHart(Posted 2012) [#83]
To all who bought the book... please leave a review at the sites you bought it. Thank you!

wmaass(Posted 2012) [#84]
Got the book! Working through it now. Thank you Michael for writing this.

MikeHart(Posted 2012) [#85]
Hi folks,

to the ones that bought the book... it would be great if you could post a link to your reviews here. My publisher is dying to know about your opinions so it would be awesome if you could share the links to your reviews.

Thanks a lot for all the support you guys have given me.


Snader(Posted 2012) [#86]
There you go:


kdf(Posted 2012) [#87]
I get the following error when I try to compile for the Android target.

fantomengine.android.java' not found.

Any help would be appreciated.

Tri|Ga|De(Posted 2012) [#88]
At first I was very exited with this book but as I read along trying the game examples I found more and more error in the book and its a little annoying. Most of the error is easy to correct. But there should be so many.

I only have the eBook so I don't know if its the same with the printed version.

I also some times do not get what it is the code is doing, but maybe thats just me who are not so clever.

Its great that you did this book and your fantomEngine is very nice.

In chapter 6 the game should run on an iOS device but I get a lot of warnings in Xcode.
When I fix this warnings I get a bad Exec and the game never starts.

Im using Mountain Lion and the latest Xcode, maybe thats why!

MikeHart(Posted 2012) [#89]
Well monkey is a moving target. The parser now catches errors that it didn't when I wrote this book. So stuff that worked before needs ajustment now. If you need help fixing stuff, then let me know where and I can look at it.

MikeHart(Posted 2012) [#90]
@KDF - are you sure that fantomengine is located iny our sources directory?

Tri|Ga|De(Posted 2012) [#91]

I have the eBook and the errors I mention is lines of code that gets cut of at the edge of the page.
Leaving it impossible to read.

I dont know if this is in the paper version or something that happened when converting the book to eBook. Every now and then I have to look at the examples I downloaded from you book to see how code lines are ending.

There are also some spelling errors but I don't mind them.

MikeHart(Posted 2012) [#92]
@TriGaDe: Ouch, that is really bad. As customer I would be pissed also. did you contact PacktPub about it? Which viewer do you use to read the book?

Tri|Ga|De(Posted 2012) [#93]
Yes I have contacted Packtpub. I'm using my iPad and iBooks.

kdf(Posted 2012) [#94]
Here's the folder structure:
2038_07_Code ->

Here's the full error log:

Translating atthedocks
E:/EDRIVE/MonkeyPro56/bin/trans_winnt -target=android -run "E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/atthedocks.monkey"

TRANS monkey compiler V1.32
E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/ftFunctions.monkey<4> : File 'E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/native/fantomengine.android.java' not found.
Monkey runtime error: E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/ftFunctions.monkey<4> : File 'E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/native/fantomengine.android.java' not found.

Is there any other folder I have to put the fantomEngine.monkey into ??

matt(Posted 2012) [#95]
You need to put the core fantomengine files into your Monkey modules directory. The only reference I can find regarding installation is on the the google code download page for fantomEngine:

Copy the content of the zip folder inside the module folder of your Monkey installation.

Installing modules is not mentioned in the book, or in the Monkey docs, as far as I can see.

Also, see here: http://www.monkeycoder.co.nz/Community/posts.php?topic=3366

kdf(Posted 2012) [#96]
Thanks Matt. Much obliged.
I also had to copy the 'native' folder into my source directory to get it to work.

MikeHart(Posted 2012) [#97]
Thanks Matt for helping out.

MikeHart(Posted 2013) [#98]
Ok, I finally got around to publish some errata for the books code to be able to still work with Monkey V70 and up and to adress the typos in the code: