Summaries:
- Design different view for different devices (Mobile, Tablet, Desktop)
- Specify each ViewFactory with its corresponding Form Factor in the config file
- Orientation Change: Use addResizeHandle, check for Potrait (Height > Width) or not, and adjust accordingly
- Use MVP Pattern: Business Logic consist of Presenter (driving the View/Factory) and Model (DTO, RPC, cache, validation)
- Make it Snappy: use ClientBundle, use Code Splitting/runAsync
- GWT helps dead code elimination, duplicate function removal, obfuscation
- Use Application Cache to load resources (works with iPhone and Anroid, Chrome, Safari, Firefox). Use AppCache linker (GWT 2.4).Use LocalStorage (GWT 2.3). Application Cache might still have some defects.
Performance Tips:
- Reduce HTTP Request, use ClientBundle
- Use Scheduler for efficient Loop
- Use Gwt-RPC / RequestFactory to do batch request
- Gwt-RPC type explosion (because of serializer and deserializer for each subtype): use contrete types (ArrayList, not List), Limit Polymorphism with Gwt-RPC, blacklist certain RPC types, consider RequestFactory
- Don't use Widget if HTML will do (unless event responds is required, but you can't add Widgets to HTML elements; counter with HTML panel perhaps?), use LayoutPanels, use Cell Widgets
- Place is bookmarkable state, is History Management (handle app state when use click back or open a specific form directly through specific url)
- Place + Activity + Code Splitting (load JS on demand)
- Compile Faster: draftComple, set one User Agent and Locale
- Shrink JS (around 7% reduction for 300K size): -XdisableClassMetadata (Disable some java.lang.Class methods like getName), -XdisableCastChecking, -compileReport, set compiler.stackMode strip, set compiler.enum,obfuscate.names true, set CssResource.obfuscationPrefix empty
Resources:
Code,
Slides
Summary:
- Use Canvas
- Develop a simple AssetManager
- Game Loop, use requestAnimFrame - only draw when visible, save CPU (not setTimer)
- Calculate in-game clock to avoid worm-hole effects (not drawing when not visible)
- Refer to MDC site for canvas tutorials
- Use off-screen canvas, multiple layer, etc
- Save Mouse Click/Move event value for Game Loop processing
- Canvas Sprite sheet for animation
- Use Sound Manager 2 for sound
- Meassure Performance with Mr. Doob's stat.js, Chrome's FPS counter, Developer Tool's Profiler, Mozilla's mozPaintCount
- Use Application Cache for offline mode
- Public Game Engine: Impact, Crafty, Game Closure, Spaceport, Isogenic Engine, ForPlay for GWT
- Port your HTML5 + Javascript to native mobile play through Impact, Game Closure, Spaceport.
- Free Resources: freesound.org, lostgarden.com
- Distribute through Chrome Web Store
- Good Read: hiive, Lost Decade Games, Lost Garden, HTML5, meet the world of games
Why use GWT?
- Abstraction for Different Brower and Platform
- Ability to leverage on Java ecosystem, utilising existing Java game libraray like JBox2D
- Real Time Debugging
- ForPlay Game Engine, Asset Management, I/O System
- Abstract Network Call & JSON (not WebScoket yet)
- Ability to compile for HTML5 and Java (and Android), and Flash (ActionScript) *Apply to ForPlay only, not the entire GWT
More GWT Videos: