gaming with javafx - jazoon.com · 2 agenda > challenges > advantages and opportunities >...

25
Gaming with JavaFX Developing the Next Generation of Casual Games Silveira Neto, José Maria Sun Microsystems 9044

Upload: tranthien

Post on 07-Dec-2018

230 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

Gaming with JavaFXDeveloping the Next Generation of Casual Games

Silveira Neto, José Maria

Sun Microsystems

9044

Page 2: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

2

AGENDA

> Challenges

> Advantages and Opportunities> Pixel art> JavaFX game development

– Opening resources– Sprite composition/animation

– Tile composition– Collision detection– Game Cloud

Page 3: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

3

Common game developers challenges

> Loading resources

– Libraries for handling different image formats

– also for video and sound codecs

> Proprietary platforms

– leads to proprietary libraries and expensive engines

– same for tools and plugins

– Independent game developers?

> Network is hard

– More libraries, sockets, protocols

> Finding resources

Page 4: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

4

JavaFX advantages and opportunities

> Java advantages

– JVM, libraries, speed, etc.

> One application, multiples screens (Desktop/Mobile/Tv).

> Performance

– Hardware advantages

> JavaFX Language and API

– Easy to program

– Skinnable UI with CSS

– Graphical entities like geometry and animations

– Profiles

> Java Store

Page 5: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

5

A few words on art

pixel pixel art

Page 6: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

6

Open and display resources made easy

var tree = ImageView { image: Image { url: "{__DIR__}tree.png" }}

Page 7: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

7

External resources transparent

var bed = ImageView { image: Image { url: "http://example.com/bed.png" }}

Page 8: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

8

Sprite composition

var layers = [ dress, hair, crown, shoes];

Page 9: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

9

Avatar Combinations

Page 10: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

10

For four directions

Page 11: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

11

Sprite animation

Ref.: http://silveiraneto.net/?p=1861

Sprite { img: “princess.png” frames: 4 (...)}

Page 12: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

12

Tile Composition

Tilemap { tiles: myTileSet Map: [5,1,12,63 (...)}

Page 13: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

13

Putting all togheter

Page 14: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

14

Putting all togheter

Page 15: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

15

Putting all togheter

Page 16: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

16

Putting all togheter

Page 17: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

17

Putting all togheter

Page 18: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

18

Feel free

> Those arts are free

– Creative Commons Attribution Share-Alike

– http://silveiraneto.net/pixelart

> Use it, put one more pixel.

> Get them in my blog

Page 19: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

19

Colision detection (by bouding boxes)

ay

by

ax cx dxbx

dy

cy

return ((ax>dx)|| (bx<cx)|| (ay>dy)|| (by<cy));

or just use the new API...

Page 20: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

20

Colision detection

for(obt in obstacles){ if(obt.boundsInLocal.intersects(x, y, w, h)){ return false; }}

Page 21: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

21

Demo

> Simple rpg like game

Page 22: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

22

Game Cloud

JavaFX App

resources

services> multi player> updates

> chat

> high scores

> graphics

> sounds

> maps

> resources

Page 23: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

23

Demo

> High score demo

– JavaFX

– Remote data at Zembly

Page 24: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

24

Questions?

Page 25: Gaming with JavaFX - jazoon.com · 2 AGENDA > Challenges > Advantages and Opportunities > Pixel art > JavaFX game development – Opening resources – Sprite composition/animation

José Maria Silveira Neto http://silveiraneto.net

Sun Microsystems [email protected]