Showing posts with label my book. Show all posts
Showing posts with label my book. Show all posts

Friday, March 14, 2014

My Book is on Amazon! (Game Programming)

After spending several weeks pulling together relevant blog posts, I decided to take the plunge and publish a book about Firefox OS game programming on Amazon.

You can get the book here: http://www.amazon.com/dp/B00IZUYIGO.

The title is:

Beginning Firefox OS HTML5 Game Programming

This is an Amazon Kindle book, which means it is an eBook you read on your computer, phone, tablet, or whatever. You can read it on a hardware Kindle tablet or with software available for Windows, Mac, Android, iPhone, iPad, and just about anything else (except Firefox OS and Linux).

I debated about what kind of cover to use. I'm not an artist at all (you may have noticed that all my art is clip art or circles or squares) and I wasn't sure what to do, but fortunately Amazon has thought of that and now provides a cover-making app as part of the submission process. You pick an image, color scheme, layout, type, and punch the button. This is what came out:


Well, it doesn't say Look Inside or kindle edition, that's just how they display covers. I'm sure anyone could do better, but it does convey the message of title, author, and that the book is for people who like to type a lot.

One of the things I like about Amazon is that they let you take a peek at the book. So if you click on it, you can see the table of contents and the first few chapters, all the way to part of the first chapter on Canvas!

You can even see the names of the people I thanked for help on this book:

Panagiotis Astithas
Dietrich Ayala
Richard Blechinger
@Boot2Gecko
M. Edward (Ed) Borasky
Monique Brunel
Asa Dotzler
@eliazerk
Robert Helmer
Nicolas Hoizey
Andre Jaenisch
Christer Kaitila
Ben Kelly
Andrzej Mazur
Vivien Nicolas
@nyrrrr
Ivano Palmentieri
Planet Firefox OS
Marek Raida
Eric Shepherd
Joshua Smith
Gabriele Svelto
Gabriele Vidali

One of the wonderful things about the Firefox OS community is how helpful people really are and I definitely appreciate any and all feedback for what I do. Sometimes the help is telling me I made a mistake or need to know that  Local Storage isn't recommended or just for inspiring me in some way. Again, thank you for helping me to produce a book!

When I uploaded the book to Amazon, I was surprised when it said the book was 402 pages (estimated). I knew that the word count was 49,000 words, which would usually be a 400 page book of straight text, but my book has a LOT of pictures and screenshots. So maybe pictures are 1000 words.

What's Next?

In terms of the book, I'm going to fix a few formatting errors (more about that in a minute) and then submit it to the new Amazon CreateSpace service that lets you create print-on-demand paper books that can be sold through Amazon. You can read about it here: https://www.createspace.com/. While I like eBooks for programming (so I can flip back and forth when I'm coding but keep my hands on the keyboard), there is something nice about a paperback. Who knows, maybe a book publisher would like to publish it.

I'm also thinking about putting it on Nook. I like Barnes & Noble and there might be some people there who are interested in Firefox OS.

I investigated some of the other eBook publishing services and here is what I am seeing:

Google Play

I couldn't get a lot of details without signing up, but the word on the street is that they don't have a lot of people looking for books and they might take a bigger cut. I'll pass for now.

Apple iTunes

While it might be amusing to publish on Apple when my motto is "Stay tuned, but not iTuned" I don't like that you must use a Mac to publish with them. I have a Mac Mini but it's packed away. You also have to use their special formatting tool, so more work for me.

Leanpub

A few people suggested them and I investigated and was drawn up short. To publish with them, you must use Markdown. I really don't want to spend weeks reformatting my manuscript for them. They look interesting and they publish a lot of works in progress. This might be a good place to buy. Check them out at https://leanpub.com/

There are other markets, and if you know of something great, let me know. I'm interested in finding people who are interested in Firefox OS. Part of the magic of FxOS (the official acronym) is that it is aimed at people who may not have programmed before and is reaching out to a new world-wide audience.

Speaking of which, my book is available (in English) in these countries through Amazon:

Andorra
Australia
Austria
Belgium
Brazil
Canada
France
Great Britain
Guernsey
Germany
India
Italy
Isle of Man
Japan
Jersey
Lichtenstein
Luxembourg
Monaco
Mexico
New Zealand
San Marino
Switzerland
Spain
United Kingdom
United States
Vatican City

How I Did It

Well, I just wrote a blog and pulled together some of the posts. I never intended to make a book, but as the blog grew and the content was driving to include all the things you need to make a game for Firefox OS, I felt like maybe I could do a book. I wasn't sure it would work and the formatting issues sounded like a big hassle.

Part of the problem is that Amazon Kindle has changed what they require over the years and so there's a lot of misinformation. Also, because this blog is in Google Blogger which has its own formatting issues, I just wasn't sure how to proceed.

Here is what I did and I'm pretty happy with the results. In fact, I feared worse!

Step 1 - LibreOffice

The first step was to read up a lot. Some said to convert your book to HTML others said to use Microsoft Word. Well I obviously know HTML, but I didn't want to spend hours formatting that. Microsoft Word I know how to use but don't like it. Then I decided to give LibreOffice a try and I loved it. LibreOffice (a fork of OpenOffice) is at version 4.2 right now and it is really fast and efficient and is actually a lot easier to use than Word. The problem with Word is that they have a lot of legacy to support so they can't really make sweeping changes. Furthermore, each version of Word is really different but because they want money, I can't afford to upgrade every copy on every machine. On my various machines I have Office 2003, 2010, 2013, and Office365. But I also can put LibreOffice 4.2 on every machine and upgrade them all if there is a major change. LibreOffice will save to a .DOC format that is compatible with several versions of Office. That seemed like a safe bet.

Step 2 - Lay Out the Book

I had an outline based on my blog posts. I then created a title page, copyright page, etc. (known as front matter) and for each of those pages, I ended them with a page break. Next I created page breaks for each chapter and made each chapter title a Heading 1.

Once I did that, LibreOffice has a feature that lets you create a table of contents by using all those Heading 1 chapter titles. I put that between the front matter and the first chapter and it looks good! The table of contents then becomes a set of links for each chapter. To me, a programming book must have a table of contents! You don't need an index because you can search through the eBook.

I just used default formatting for the text and that seemed to work out all right. I used bold and italic when needed, and I had heard that Amazon doesn't like bulleted lists, so every list is a numbered list and not done with automatic numbering, just by hand.

I then copied-and-pasted each blog post to a text file (to remove any hidden Blogger characters) and then copied-and-pasted the pure text into LibreOffice.

And of course, I did some editing, removed parts that were extra, and in general thought about what was there and would it be useful. Writing a blog is one thing, but writing a book is to a wider audience. 

Step 3 - The Code

One of the trickiest parts of a programming book is to format the code. Not only must you make sure that the code is mono-spaced (like a typewriter) but you don't want the code lines to break in unexpected places. One of the things I did (and it was a pain) was to format all my code so it is only 45 characters wide. I did this originally so it would fit nicely in Blogger, but it also fits nicely on Kindle, at least in the Kindle Reader software on my desktop.

LibreOffice can format text as Paragraph and also as Character styles, and I did both for the code. Kindle seemed to pick up on it. I wanted the code to be mono-spaced and bold and 45 characters and it is! This book is all about code!

Step 4 - Pictures

This book had a lot of pictures. Someone else can count them up, but almost every post has screenshots or other helpful material. In my posts I often have clipart that is just a fun decoration, but I didn't bring them over to Kindle. But I did need the screenshots!

Those I formatted as centered and aligned to the bottom, and with no wrap for text. All my pictures were .PNG and Amazon seems to like those (I think it converts them to .JPG).

Step 5 - Upload

I already had an Amazon account. I went to https://kdp.amazon.com/ and got started. They wanted information and none of it was hard to figure out what they wanted. There were choices about pricing and royalties, name, tax stuff, etc. I then made a cover and uploaded my manuscript.

A few minutes later, the book was published and I'm there.

Promote Firefox OS

One of the main reasons to do this book is to help promote Firefox OS and show people how easy it is to program. Especially games, which are a big driver of adoption for an OS. If you want to tweet or blog about my book, that would be great. I don't know how to do reviewer copies, but maybe you do. Anything that we can do to tell the world that programming games on Firefox OS is fun and easy will help. I know nothing about promoting a book or anything, I'm just a retired engineer who likes to code. And really likes Firefox OS!

Wednesday, March 5, 2014

HTML5 Game Frameworks (Game Programming)

HTML5 game frameworks is an interesting subject. There are dozens of them around, all promising to make game programming easy. Personally I'm interested in using just HTML5, CSS, JavaScript, and CSS. But there are two frameworks I thought I should mention that work in Firefox OS.

Construct 2

Construct 2, by Scirra, has been around a lot and is perfect for people who want to make HTML5 games but don't want to do all the coding. You can learn all about Construct 2 at https://www.scirra.com/.

Basically you drag and drop bits, choose behaviors from menus, and build your game. I've tried almost all applications like this and Construct 2 is the best. Why? Because they seem to have the best community and they are very transparent about what they do and why. Run by two brothers in London, Ashley and Thomas Gullen, you feel like they are responsive to problems and their forum is legendary for people (not just Ashley and Thomas) helping you out if you get stuck. They have a ton of tutorials and their engine is updated frequently.

The cost is reasonable. You can buy if for 79 pounds if you are not a professional, and 259 pounds if you are, the difference being how much money you make from their product. I can't say enough of how helpful they are, and how advanced as well. They're really on top of things like WebGL and they export the games you make to the following targets:

Web (HTML5), Wii U, iOS, Android, Win 8, Win 8 Phone, Windows desktop, Mac, Linux, Blackberry 10, Firefox Marketplace, Tizen, Facebook, Chrome Web Store, Amazon Appstore!
Just for fun (and as part of some long-forgotten contest), I put an app in the Chrome Web Store and it was very easy to create, even though it has an odd format. You can check out its fabulous features here: https://chrome.google.com/webstore/detail/tilt-a-twirl/klabggekijaanbjbakdimcdikdhihhdn?hl=en-US.

If writing code freaks you out, you probably aren't reading this, but if you have a friend who doesn't code but who wants to make games, go for it! Construct 2 is also used a lot in the industry for prototyping bigger games. And the best part is that you can put your games in the Firefox OS Marketplace!

Phaser

I haven't had a chance to try out Phaser, but it is getting a lot of notice. I'd place it somewhere between hand-coding and Construct 2. You still code, but you use Phaser to do the heavy lifting, and it adds things that would be very hard to do in raw code, like Physics.

Check out Phaser here: http://www.photonstorm.com/phaser. The main honcho is Richard Davey and he seems very helpful. Again, like Construct 2, there are lots of tutorials and the community is very active and the updates are frequent. I'm hoping to try out Phaser pretty soon and see how well it likes Firefox OS, but Mr. Davey says it will work in Firefox OS and if anyone has done this, let me know.

A Game A Week

I'm a proud member of the One Game A Month jam at http://www.onegameamonth.com/ but I recently ran across a site where someone is doing one game a week! I was doubtful at first. After all, many can do a game jam in a weekend, but they often are wasted afterward and the pace isn't easy to keep up!

But this weekly site, called http://www.lessmilk.com/. The author, one Thomas Palef, has been doing a game a week for a few months and the games are cool. As I dug a little deeper, I found that he's coding in Phaser. This is a very, very good argument for using Phaser if you want to code fast.

He also walks you through a two-part tutorial on making an Angry Birds clone. I fear that this will be the new standard for simple gaming, but who am I to complain? He also had a nice short article on pixel art at http://blog.lessmilk.com/pixel-art-how-i-made-the-princess-in-game-6/. This is a person to watch.

I was amused that he said
Since I started this project I've received a lot of supportive emails, which is awesome. But there's more: I've also had emails that have opened up new opportunities for me:
  • I got a job offer from a big company
  • A publisher contacted me to buy some of my games
  • A small company wants me to build them exclusive games
  • A couple of indie teams want me to help them as a game designer on some interesting projects
  • I even got contacted by a PhD student who wants me to help him with his thesis
So if you want a job in the game industry, just do something cool and people will come to you!

Right now I'm happy doing this blog and preparing my book, but I expect Mr. Palef to be a rising star!

My Book

I've revised about two thirds of the posts I want to use for my book and things are going along smoothly. I'm finding that there is a lot of details to follow to format it so Amazon will like it, and with any luck I'll finish in about two weeks.

I'm hoping that my book will help get the word out that Firefox OS is easy to program and fun! I appreciate all the offers I've had to help publicize the book and I'll be looking to see if I can also put it on Nook, Google Books, and Leanpub. Maybe I should put it in the Apple store for amusement. After all, when the iPhone came out, Steve Jobs wanted everyone to write apps in HTML5!

I'll keep you posted!

Twitter

I've been having a lot of fun discovering Twitter. I never used it before starting this blog, and my thought was that it might be a good way to let people know that there was a blog on Firefox OS game programming and game playing. But I've since found out that it is a fun way to find out what's going on in the worlds I care about: Firefox OS and game programming.

Yesterday Twitter told me I couldn't follow any more people! It turns out they don't want you to follow more than 2000 people, so I've been unfollowing a few people who had followed me but who weren't tweeting things I was interested in. And if I want to follow people who I discover, I'll have to unfollow someone else.

So right now, if I follow you because of Firefox OS, I won't ever unfollow you. Same goes with any HTML5 game programmers. And also any game programmers that do pixel art or otherwise something that catches my attention (like ASCII Art). And an occasional odd person that has something interesting. And definitely not anyone who can sell me how get more followers or how to maximize my web site profits!

Right now I have 798 followers, but I'm not seeking followers unless you like Firefox OS game programming and game playing or Firefox in general or Pixel Art games or ASCII Art games or goofy game developers like the people who hang out at @OneGameAMonth or, well, you get the idea.

2000 tweets, 2000 follows, 798 followers.

Oh, and this blog has had a total of 23,000 views. The most popular page was on Device Orientation, which is definitely a cool subject. Second-most was my comparison of CSS, Canvas, and SVG, and third was IndexedDB.

Not surprising, most of my readers are in the USA:

United States
11512
France
1003
Germany
995
United Kingdom
536
Brazil
511
Spain
459
Canada
351
Ukraine
344
Italy
329
Serbia
148

Browsers weren't a surprise:

Firefox
12171 (52%)
Chrome
4884 (21%)
Safari
2710 (11%)
Internet Explorer
2134 (9%)

And Operating Systems wasn't too surprising:

Windows
10148 (44%)
Macintosh
6857 (29%)
Linux
2705 (11%)
Android
1246 (5%)

I appreciate every single one of you that takes the time to read what I write and I intend to keep going. As I said last time, I'm torn between these next paths:

1. Advanced topics like WebGL, WebAudio, WebSockets, WebWorkers, etc.

2. Going back and fleshing out more about how to use CSS for gaming.

3. Writing a series that leads to a full RPG!

4. Doing lots more with SVG, the undiscovered country.

5. More about creating music and art.

6. Making games in Construct 2 and/or Phaser.

7. There is no 7!

8. Working with servers. Node and MMORPG.
If anyone has any requests, let me know!

Well, I guess I'd better flip some coins and get back to work on reformatting and rewriting my book.

Thursday, February 27, 2014

Firefox OS Book and What's Next (Game Programming)

I've mentioned this before, but I've been thinking about publishing a book on Amazon covering beginning Firefox OS game programming. As you might guess, the book will consist of roughly 30 blog posts. I'll revise the posts and I'll let you know how I went about publishing a book on Amazon. In keeping with the tone of this blog, my focus will be for people who want to program games but who are not experts and who want to try making things with HTML5 on Firefox OS.

I've already edited about 15 posts/chapters and I expect to edit the rest and publish in about two weeks. Revising for a book takes extra time so I'm planning on cutting back on my posts and catch up on some game reviews.

Here's my tentative list of chapters:

1 -  Introduction - Hello World!
2 -  Pushing your Game to a Device
3 -  Measuring Screen Size from the Inside
4 -  Bouncing a Ball in CSS
5 -  Drawing with Canvas - Part 1
6 -  Drawing with Canvas - Part 2
7 -  Drawing with Canvas - Part 3
8 -  Bouncing SVG - Part 1
9 -  Bouncing SVG - Part 2
10 - Bouncing SVG - Part 3
11 - Touch and more SVG
12 - Screen Orientation
13 - CSS Shell
14 - CSS Collisions
15 - Canvas Collisions in Color
16 - SVG Collisions
17 - CSS, Canvas, SVG Compared
18 - HTML5 Audio - Part 1
19 - HTML5 Audio - Part 2
20 - HTML5 Audio - Part 3
21 - HTML5 Audio - Part 4
22 - HTML5 Audio - Part 5
23 - Vibration
24 - Device Orientation
25 - Local Storage
26 - Asynchronous Storage
27 - IndexedDB Storage
28 - Simple Complete Game - PaddleFox!
29 - Submitting a Game to the Marketplace
30 - Firefox OS Hardware
31 - Resources for Going Further

The code will be retested and will be reformatted so that it fits on Amazon devices (with short line lengths). I'm excited to publish this book and I'm hoping that it will help gain a wider audience for people who want to make games but are intimidated by the more complicated tools of Windows, Android, and Apple development.

What's Next?

After I get the book out, I'm back to writing about game programming. Here are my feelings at the moment:


I've been toying with the idea of writing a space shooter game but also I am seriously drawn to writing an RPG. I've always loved RPG computer games and I've always wanted to write one, but never got around to it. I think this will be what will be next.

I'm going to study Ultima II (my all-time favorite) and also some Gameboy RPG titles like Dragon Warrior, Final Fantasy Legends and Adventure, Ultima Runes of Virtue, Pokemon, and Azure Dreams. These simple tile-based games might just fit on a Firefox OS phone. As with earlier posts, I'll examine what works with CSS, Canvas, and SVG. I won't make a full-blown RPG, but I imagine that there will be a long series of posts. And I'm likely to go with some retro art to go with it.

I'll also keep reviewing games!

So definitely stay tuned, but not iTuned!