SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
Making a Speedy HTML5 Game
                                                      Published by Sean Soria



This is a guest post by Sean Soria of Gamzee, a leader in HTML5 game development. In this post, he describes the potential
of creating a city build using HTML5, as well as the trial and tribulations and how you can avoid them.
Back when we started Gamzee, a lot of people in the game industry were down on HTML5. The hopeful ones said that HTML5
was the wave of the future, but it just wasn't stable or fast enough to make the big sort of 'Ville-type Flash games that
dominate social gaming today. So what did we do? We set out to make a big, isometric game in HTML5. And not only would it
run on Facebook on desktop Web, but it would also run on mobile Web, utilizing Facebook Platform. On all iOS devices and
Android phones.
Pretty unambitious, right? Well, it’s what we did in making Skyscraper City -- an HTML5/node.JS game that runs on a single
codebase and was built by a single team. As our first game as a new company, no less.
In case you don't want to read the rest of this blog post, the results of all that work is here (apps.facebook.com/skyscrapercity).
And you can, indeed, play it on Facebook on the Web or on mobile on your iOS device or Android phone. Skyscraper City is a
city-building game that combines the gameplay of social builders with the fun of Lego-style blocks. You can stack almost any
city unit on top of any other to build towers, elaborate structures, or whatever you want.




What We Learned
Was it easy to make? Heck no.
What did we learn? Here are the highlights.


Way more people play the game on mobile devices than we expected
One of the reasons we wanted to make a cross-platform HTML5 game is because we're all gamers. I play CityVille, and I want
to check into my city on my phone while I'm out and about. Zynga did launch CityVille Hometown, and I can download that if
I've got an iPhone or and Android phone, but it's not the same game and it's not the same city. Our game is truly cross-
platform; you can play on your computer, your tablet, and your mobile device and maintain your progress on all those devices.
That's how we thought most people would play the game, too -- mostly playing on a computer, then continuing on a tablet or
phone while they’re not at their computers. But there are more people playing the game on the iPod Touch or the iPad than
there are on a Mac, for example. And way more Android phone users playing than any of those devices combined.
Had we known that at the start, we could have spent more time optimizing mobile and less on Mac browsers. While we built
with mobile in mind, we envisioned mobile as a secondary play environment. We recommend that game developers making
cross-platform focus on delivering a great mobile experience as their primary goal.
You have to do a lot of experimentation
We started with the idea that we'd use Canvas (yay, HTML5) to render our game. That worked great on desktops -- no
performance issues. But on an iPhone 3GS, the performance was horrid (rendering less than 5 frames per second when we
were working on the game; performance has improved a lot with the release of iOS 5.0).
So we had to create another render engine. And another one. And another one. Until we have the one we use now (a DOM
renderer), that works pretty well on most devices. The DOM renderer uses CSS animations, creating and animating in divs. It
also allows us to use a little kludge, using fake 3D CSS transforms on our 2D images in order to trigger hardware acceleration
on mobile (which gives us a little boost in performance).




Some things you're just not going to be able to do well
Sound performance in HTML5 is still pretty iffy. The expectation in game development is that you’ll have mutliple sounds that
can play in response to cues in the game and gamer inputs. Despite a lot of experimentation, it's hard to get low-latency cued
up sound (i.e. a sound that reliably plays in response to a game or user action) and impossible to get multitracking (sound and
music playing at the same time, for example) on most mobile devices. So we opted for sound and music on desktop and just
music on mobile Web.
Similarly, a simple trick to speed up performance on the DOM is fake 3D transforms on your CSS. That triggers hardware
acceleration on most mobile devices, resulting in better performance than Canvas, for example.
For some reason, this doesn’t work on some Android phones, like Samsung’s Galaxy S2. As a result, you don’t get a
performance boost there.
Here’s code that we used to trigger 3D transforms. And, as a bonus, we’re also showing you how we prevent the user from
selecting big chunks of text/graphics inadvertently and how we prevent the game from displaying the text cursor occasionally
(both fixes help make the game feel more like a native app than a Web app).
/******************************/
/* Makes screen non-selectable and prevents text cursor from displaying */
/******************************/
div {
      margin: 0;
      padding: 0;
      -moz-user-select: -moz-none;
      -khtml-user-select: none;
      -webkit-user-select: none;
      /*3D transform */
      -webkit-transform: scale3d(1, 1, 1);
      -o-user-select: none;
      user-select: none;
}


If you're going cross-platform, you have to design that from the ground up
We wanted to achieve as close to 1:1 parity as we could on the mobile experience as the desktop Web experience. So that
meant turning off pinch to zoom on phones, not having rollover item/drop pickups on the Web version of the game, and
figuring out ways to implement rollovers on mobile (ours are either activated off of a button or by holding down your finger on
the item in question).




Something like Cityville wouldn't work on mobile, at least not without substantially changing the game experience, because it
wasn't designed around mobile screens. The menus are too large and complicated, and there's too much going on in a city to
easily show on a (relatively) tiny iPhone screen (hence the separate app Cityville Hometown for iOS and Android rather than
an integrated experience).


Don't do stacking(!)
One of the cool features of our game is that ability to stack I mentioned earlier. It's really fun to make a giant robot in your city
or construct an odd, stepped reverse pyramid supported by four thin columns.
Unfortunately, stacking presents a host of issues on mobile. People with less than slender fingers sometimes have a hard time
accurately picking what they want to click on. And, like Flash, render times increase the more objects you're drawing on
screen.
We start our players out with a 10x10 city grid. You can get that up to 11 stories tall. If you slapped down 1-tile buildings that
high, that's 1,100 buildings. That's a lot of buildings to render. (And that's before the expansions we just added that let you
quadruple the size of your grid). So while stacking is very neat, it can bite you in the butt with a very large city, making the
game take a while to load (up to a minute-plus on some mobile devices; the problem isn’t noticeable on desktop due to larger
processing power). We’re making optimzations to how the game renders large amounts of objects. But we would have been
better served by realizing this in advance and coming up with another gameplay feature instead of stacking.
Love CSS
You'd better be good at CSS, because getting a game working on all major browsers on desktop Web and Android phones
and all iOS devices requires a lot of the stuff. We have one Web Developer whose whole job is focusing on that, building out
menus that will dynamically size for various mobile devices and master versions for Web and tablet. One of the axioms of
video game design is that it's 50% menu work. HTML5 cross-platform games are probably 50% CSS work.
Areas of focus and useful tools
So what did we take away from our experience?

        We validated that you can make a cool, rich isometric game in HTML5 and have it be cross-platform.
        We learned that if people can play a game on any device, a lot of them are going to do it primarily on mobile or tablet.
        We learned that HTML5 cross-platform games require a lot of experimentation.
        We learned that as great as HTML5 is, some things still aren't quite there yet;
        That designing a cross-platform experience means you need to think about the user experience on all devices from
           the ground up (in your game design);

        That you shouldn't have a game on mobile that does a lot of stacking or overdrawing;
        And that you'd better love CSS and be good at it.
Hopefully you learned something, and hopefully you'll enjoy our game.
And for those of you who read through to the end, here are a few things that made our lives easier as we developed a cross-
platform HTML5 game on Facebook Platform.
1) Viewporter. https://github.com/zynga/viewporter. Zynga’s open-source code allows you to get screen size on any device
and to scale your game to match. It saves a lot of time from writing it yourself (we know because we’ve used Viewporter and
written our own).
2) Weinre. http://phonegap.github.com/weinre/. A remote debugger that works like Web Inspector, but on mobile devices. A
real lifesaver when it comes to tracking down console errors on devices like iPhones and iPads.
3) JQuery. http://jquery.com/. Why write your own code if you can leverage a library? For things like text animations, JQuery’s
very solid. We’ve made a few modifications, and JQuery Mobile now exists, which is better optimized for mobile devices, but
JQuery gave us a huge headstart.
4) node.JS. http://nodejs.org/. When you’re working in Javascript, it saves a lot of time and effort when you can have your
client code and server code match as closely as possible. node.JS also scales remarkably well when acting as a game server.
Building a game using HTML5? Leave your feedback below!

Mais conteúdo relacionado

Mais de Wahyu Surya

Mais de Wahyu Surya (20)

1770 ss
1770 ss1770 ss
1770 ss
 
1770 ss
1770 ss1770 ss
1770 ss
 
1770 iii
1770 iii1770 iii
1770 iii
 
1770 s
1770 s1770 s
1770 s
 
1770 iv
1770 iv1770 iv
1770 iv
 
1770 ii
1770 ii1770 ii
1770 ii
 
1770 i
1770 i1770 i
1770 i
 
1770 i hal-1
1770 i hal-11770 i hal-1
1770 i hal-1
 
1770 iii
1770 iii1770 iii
1770 iii
 
1770
17701770
1770
 
Kumpulan soal kkpi
Kumpulan soal kkpiKumpulan soal kkpi
Kumpulan soal kkpi
 
Kumpulan soal kkpi
Kumpulan soal kkpiKumpulan soal kkpi
Kumpulan soal kkpi
 
Soal praktek kkpi 2012
Soal praktek kkpi 2012Soal praktek kkpi 2012
Soal praktek kkpi 2012
 
Soal pilihan ganda akuntansi myob
Soal pilihan ganda akuntansi myobSoal pilihan ganda akuntansi myob
Soal pilihan ganda akuntansi myob
 
Soal kkpi online
Soal kkpi onlineSoal kkpi online
Soal kkpi online
 
Tujuan pengajaran kkpi
Tujuan pengajaran kkpiTujuan pengajaran kkpi
Tujuan pengajaran kkpi
 
Soal soal kkpi 2012
Soal soal kkpi 2012Soal soal kkpi 2012
Soal soal kkpi 2012
 
Soal bahasa arab kelas xii smk
Soal bahasa arab kelas xii smkSoal bahasa arab kelas xii smk
Soal bahasa arab kelas xii smk
 
Nilai ut
Nilai utNilai ut
Nilai ut
 
Pos un-smp-sma-smk-2012
Pos un-smp-sma-smk-2012Pos un-smp-sma-smk-2012
Pos un-smp-sma-smk-2012
 

Último

Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...
Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...
Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...ritikasharma
 
WhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex Experience
WhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex ExperienceWhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex Experience
WhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex ExperienceNitya salvi
 
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.Nitya salvi
 
Ranikhet call girls 📞 8617697112 At Low Cost Cash Payment Booking
Ranikhet call girls 📞 8617697112 At Low Cost Cash Payment BookingRanikhet call girls 📞 8617697112 At Low Cost Cash Payment Booking
Ranikhet call girls 📞 8617697112 At Low Cost Cash Payment BookingNitya salvi
 
Almora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment BookingAlmora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment BookingNitya salvi
 
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser... Shivani Pandey
 
Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...
Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...
Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...hotbabesbook
 
Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...
Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...
Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...hotbabesbook
 
Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034 Independent Chenna...
Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034  Independent Chenna...Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034  Independent Chenna...
Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034 Independent Chenna... Shivani Pandey
 
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...SUHANI PANDEY
 
Borum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Borum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceBorum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Borum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceDamini Dixit
 
Hire 💕 8617697112 North Sikkim Call Girls Service Call Girls Agency
Hire 💕 8617697112 North Sikkim Call Girls Service Call Girls AgencyHire 💕 8617697112 North Sikkim Call Girls Service Call Girls Agency
Hire 💕 8617697112 North Sikkim Call Girls Service Call Girls AgencyNitya salvi
 
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24... Shivani Pandey
 
📞 Contact Number 8617370543VIP Rajsamand Call Girls
📞 Contact Number 8617370543VIP Rajsamand Call Girls📞 Contact Number 8617370543VIP Rajsamand Call Girls
📞 Contact Number 8617370543VIP Rajsamand Call GirlsNitya salvi
 
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...SUHANI PANDEY
 
VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...
VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...
VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...Nitya salvi
 
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...rahim quresi
 
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls ServiceCollege Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls ServiceNitya salvi
 
📞 Contact Number 8617697112 VIP East Sikkim Call Girls
📞 Contact Number 8617697112 VIP East Sikkim Call Girls📞 Contact Number 8617697112 VIP East Sikkim Call Girls
📞 Contact Number 8617697112 VIP East Sikkim Call GirlsNitya salvi
 

Último (20)

Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...
Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...
Dum Dum ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready...
 
WhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex Experience
WhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex ExperienceWhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex Experience
WhatsApp Chat: 📞 8617697112 Hire Call Girls Raiganj For a Sensual Sex Experience
 
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
 
Ranikhet call girls 📞 8617697112 At Low Cost Cash Payment Booking
Ranikhet call girls 📞 8617697112 At Low Cost Cash Payment BookingRanikhet call girls 📞 8617697112 At Low Cost Cash Payment Booking
Ranikhet call girls 📞 8617697112 At Low Cost Cash Payment Booking
 
Almora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment BookingAlmora call girls 📞 8617697112 At Low Cost Cash Payment Booking
Almora call girls 📞 8617697112 At Low Cost Cash Payment Booking
 
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
 
Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...
Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...
Mira Road | Call Girls Service Mumbai | ₹,9500 Pay Cash 9833325238 Free Home ...
 
Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...
Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...
Mumbai ] Call Girls Service Mumbai ₹7.5k Pick Up & Drop With Cash Payment 983...
 
Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034 Independent Chenna...
Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034  Independent Chenna...Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034  Independent Chenna...
Verified Trusted Call Girls Ambattur Chennai ✔✔7427069034 Independent Chenna...
 
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
 
Borum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Borum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceBorum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Borum Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
 
Hire 💕 8617697112 North Sikkim Call Girls Service Call Girls Agency
Hire 💕 8617697112 North Sikkim Call Girls Service Call Girls AgencyHire 💕 8617697112 North Sikkim Call Girls Service Call Girls Agency
Hire 💕 8617697112 North Sikkim Call Girls Service Call Girls Agency
 
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
 
📞 Contact Number 8617370543VIP Rajsamand Call Girls
📞 Contact Number 8617370543VIP Rajsamand Call Girls📞 Contact Number 8617370543VIP Rajsamand Call Girls
📞 Contact Number 8617370543VIP Rajsamand Call Girls
 
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
 
VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...
VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...
VIP ( Goa Call Girls ) Margao Beach👉 8617370543 Escort Service Enjoy Your Dre...
 
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
 
CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls ServiceCollege Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
 
📞 Contact Number 8617697112 VIP East Sikkim Call Girls
📞 Contact Number 8617697112 VIP East Sikkim Call Girls📞 Contact Number 8617697112 VIP East Sikkim Call Girls
📞 Contact Number 8617697112 VIP East Sikkim Call Girls
 

Making a speedy html5 game

  • 1. Making a Speedy HTML5 Game Published by Sean Soria This is a guest post by Sean Soria of Gamzee, a leader in HTML5 game development. In this post, he describes the potential of creating a city build using HTML5, as well as the trial and tribulations and how you can avoid them. Back when we started Gamzee, a lot of people in the game industry were down on HTML5. The hopeful ones said that HTML5 was the wave of the future, but it just wasn't stable or fast enough to make the big sort of 'Ville-type Flash games that dominate social gaming today. So what did we do? We set out to make a big, isometric game in HTML5. And not only would it run on Facebook on desktop Web, but it would also run on mobile Web, utilizing Facebook Platform. On all iOS devices and Android phones. Pretty unambitious, right? Well, it’s what we did in making Skyscraper City -- an HTML5/node.JS game that runs on a single codebase and was built by a single team. As our first game as a new company, no less. In case you don't want to read the rest of this blog post, the results of all that work is here (apps.facebook.com/skyscrapercity). And you can, indeed, play it on Facebook on the Web or on mobile on your iOS device or Android phone. Skyscraper City is a city-building game that combines the gameplay of social builders with the fun of Lego-style blocks. You can stack almost any city unit on top of any other to build towers, elaborate structures, or whatever you want. What We Learned Was it easy to make? Heck no. What did we learn? Here are the highlights. Way more people play the game on mobile devices than we expected One of the reasons we wanted to make a cross-platform HTML5 game is because we're all gamers. I play CityVille, and I want to check into my city on my phone while I'm out and about. Zynga did launch CityVille Hometown, and I can download that if I've got an iPhone or and Android phone, but it's not the same game and it's not the same city. Our game is truly cross- platform; you can play on your computer, your tablet, and your mobile device and maintain your progress on all those devices. That's how we thought most people would play the game, too -- mostly playing on a computer, then continuing on a tablet or phone while they’re not at their computers. But there are more people playing the game on the iPod Touch or the iPad than there are on a Mac, for example. And way more Android phone users playing than any of those devices combined. Had we known that at the start, we could have spent more time optimizing mobile and less on Mac browsers. While we built with mobile in mind, we envisioned mobile as a secondary play environment. We recommend that game developers making cross-platform focus on delivering a great mobile experience as their primary goal.
  • 2. You have to do a lot of experimentation We started with the idea that we'd use Canvas (yay, HTML5) to render our game. That worked great on desktops -- no performance issues. But on an iPhone 3GS, the performance was horrid (rendering less than 5 frames per second when we were working on the game; performance has improved a lot with the release of iOS 5.0). So we had to create another render engine. And another one. And another one. Until we have the one we use now (a DOM renderer), that works pretty well on most devices. The DOM renderer uses CSS animations, creating and animating in divs. It also allows us to use a little kludge, using fake 3D CSS transforms on our 2D images in order to trigger hardware acceleration on mobile (which gives us a little boost in performance). Some things you're just not going to be able to do well Sound performance in HTML5 is still pretty iffy. The expectation in game development is that you’ll have mutliple sounds that can play in response to cues in the game and gamer inputs. Despite a lot of experimentation, it's hard to get low-latency cued up sound (i.e. a sound that reliably plays in response to a game or user action) and impossible to get multitracking (sound and music playing at the same time, for example) on most mobile devices. So we opted for sound and music on desktop and just music on mobile Web. Similarly, a simple trick to speed up performance on the DOM is fake 3D transforms on your CSS. That triggers hardware acceleration on most mobile devices, resulting in better performance than Canvas, for example. For some reason, this doesn’t work on some Android phones, like Samsung’s Galaxy S2. As a result, you don’t get a performance boost there. Here’s code that we used to trigger 3D transforms. And, as a bonus, we’re also showing you how we prevent the user from selecting big chunks of text/graphics inadvertently and how we prevent the game from displaying the text cursor occasionally (both fixes help make the game feel more like a native app than a Web app).
  • 3. /******************************/ /* Makes screen non-selectable and prevents text cursor from displaying */ /******************************/ div { margin: 0; padding: 0; -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; /*3D transform */ -webkit-transform: scale3d(1, 1, 1); -o-user-select: none; user-select: none; } If you're going cross-platform, you have to design that from the ground up We wanted to achieve as close to 1:1 parity as we could on the mobile experience as the desktop Web experience. So that meant turning off pinch to zoom on phones, not having rollover item/drop pickups on the Web version of the game, and figuring out ways to implement rollovers on mobile (ours are either activated off of a button or by holding down your finger on the item in question). Something like Cityville wouldn't work on mobile, at least not without substantially changing the game experience, because it wasn't designed around mobile screens. The menus are too large and complicated, and there's too much going on in a city to easily show on a (relatively) tiny iPhone screen (hence the separate app Cityville Hometown for iOS and Android rather than an integrated experience). Don't do stacking(!) One of the cool features of our game is that ability to stack I mentioned earlier. It's really fun to make a giant robot in your city or construct an odd, stepped reverse pyramid supported by four thin columns. Unfortunately, stacking presents a host of issues on mobile. People with less than slender fingers sometimes have a hard time accurately picking what they want to click on. And, like Flash, render times increase the more objects you're drawing on screen. We start our players out with a 10x10 city grid. You can get that up to 11 stories tall. If you slapped down 1-tile buildings that high, that's 1,100 buildings. That's a lot of buildings to render. (And that's before the expansions we just added that let you quadruple the size of your grid). So while stacking is very neat, it can bite you in the butt with a very large city, making the game take a while to load (up to a minute-plus on some mobile devices; the problem isn’t noticeable on desktop due to larger processing power). We’re making optimzations to how the game renders large amounts of objects. But we would have been better served by realizing this in advance and coming up with another gameplay feature instead of stacking.
  • 4. Love CSS You'd better be good at CSS, because getting a game working on all major browsers on desktop Web and Android phones and all iOS devices requires a lot of the stuff. We have one Web Developer whose whole job is focusing on that, building out menus that will dynamically size for various mobile devices and master versions for Web and tablet. One of the axioms of video game design is that it's 50% menu work. HTML5 cross-platform games are probably 50% CSS work. Areas of focus and useful tools So what did we take away from our experience?  We validated that you can make a cool, rich isometric game in HTML5 and have it be cross-platform.  We learned that if people can play a game on any device, a lot of them are going to do it primarily on mobile or tablet.  We learned that HTML5 cross-platform games require a lot of experimentation.  We learned that as great as HTML5 is, some things still aren't quite there yet;  That designing a cross-platform experience means you need to think about the user experience on all devices from the ground up (in your game design);  That you shouldn't have a game on mobile that does a lot of stacking or overdrawing;  And that you'd better love CSS and be good at it. Hopefully you learned something, and hopefully you'll enjoy our game. And for those of you who read through to the end, here are a few things that made our lives easier as we developed a cross- platform HTML5 game on Facebook Platform. 1) Viewporter. https://github.com/zynga/viewporter. Zynga’s open-source code allows you to get screen size on any device and to scale your game to match. It saves a lot of time from writing it yourself (we know because we’ve used Viewporter and written our own). 2) Weinre. http://phonegap.github.com/weinre/. A remote debugger that works like Web Inspector, but on mobile devices. A real lifesaver when it comes to tracking down console errors on devices like iPhones and iPads. 3) JQuery. http://jquery.com/. Why write your own code if you can leverage a library? For things like text animations, JQuery’s very solid. We’ve made a few modifications, and JQuery Mobile now exists, which is better optimized for mobile devices, but JQuery gave us a huge headstart. 4) node.JS. http://nodejs.org/. When you’re working in Javascript, it saves a lot of time and effort when you can have your client code and server code match as closely as possible. node.JS also scales remarkably well when acting as a game server. Building a game using HTML5? Leave your feedback below!