Slide 1

Slide 1 text

GAME DEVELOPMENT - THE RUBY WAY !!! RISHI JAIN @jainrishi15 Josh Software

Slide 2

Slide 2 text

Full-Stack ! Senior , GameProgrammer https://www.flickr.com/photos/dolmansaxlil/6012147519/in/photolist-aagPZR-boiiM2-7YyHDy-aFAUqH-JLVaF-71PnxX-kHcKA-4hVY61-9PSLHY-fKcyFp-4szDkt-4HYGCQ-6xmG7C-9eUfHz-644Ln2-ecSjmW-FW7q9-e7rUxJ-2oWHox-mgLHRS-HV5dj-5aXsQ7-aKDgQZ-3LvJax-9AiEUa- bSoFUt-6DLpEU-5TR36L-6xmHDy-gdr3gf-hFyk5m-4szzQ9-68RKJD-7RMSYq-d9viHW-5qdqRX-6V9ka5-6V5g4P-adoaPq-6fARp1-7RJCa6-76E98-5rFMKK-2p1BDP-buG23u-5EZsty-nMan63-6xmF4o-6NWEiK-nTQgua

Slide 3

Slide 3 text

HISTORY OF GAMES

Slide 4

Slide 4 text

PINBALL https://www.flickr.com/photos/aloha75/8378526094/in/photolist-mRKQxW-rNPff-rNPmX-32V4bW-9ish8B-dLhCbz-dLo8Us-dLo8P9-4BE2sS-5b8mk-mbRi9-asJhSm-4J4bbG-6UDndE-bBYhFc-LMw8K-8f26YB-dBRj5a-8xtm1J-7KueEo-6Hfgx1-7Fq6ja-9vNZCf-CYNzw-

Slide 5

Slide 5 text

https://www.flickr.com/photos/sibekokke/508363450/in/photolist-4s2Md3-4rXJw2-4s2May-iECMTJ-zb9gq-7tD1Th-LVuK5-dzCwFM-6iKhFP-69fTME-8ze5dG-6QAMrE-5Wr2rq-4s2M6L-4rXJsn-4rXJnv-4rXJuT-4s2Mc3-4s2M8U-4rXJpv-Cbu1x-7QhYcT-675tRb-7Yjo5-8ocxFu-6sQmF-t96na-21iH2k-zRzzG-

Slide 6

Slide 6 text

http://wallpapershared.com/game-breakout-atari-voyager.html

Slide 7

Slide 7 text

MY HISTORY OF GAMES

Slide 8

Slide 8 text

Identify the game from the sound track.

Slide 9

Slide 9 text

https://www.flickr.com/photos/arte/2423977915/sizes/l/

Slide 10

Slide 10 text

Identify the game from the sound track.

Slide 11

Slide 11 text

https://www.flickr.com/photos/somegeekintn/5427133506/in/photolist-9gztHm-9gztB7-4r9uUr-dgDKtR-7VDKCt-7VDKFZ-fUehZ6-5bdfcb-7u1MyT-9um6yx-8zDMqT-4J8aP4-8zGVEC-5VQpZ9-4E9yFM-7ta4ve-vWZfa-7Tmub5-6tJHjS-3En7yB-bKXT-aqx7mM-rFKvX-4Zpi9T-rFKw3-5eHJyQ-8tGEib-2oECWh-bQEtH-

Slide 12

Slide 12 text

Identify the game from the sound track.

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

I wanted to build a game, but why ?

Slide 15

Slide 15 text

https://www.flickr.com/photos/anua22a/2450798106/in/photolist-4JyYTL-pqYJK-nVks3G-4U6yXA-iniaf-7xxKyM-g97Nph-7ZBRNo-apJzGm-9TDrt-7t5UhK-fvFntG-5ZbrEE-eqqmuT-dQUgdC-7tDeDQ-3fXbra-aSZmyn-6wYoR8-59efoV-apa43t-84AZHc-cMgbim-5h28wB-fz3bSd-9Le6DZ-7SeHkk-2xCwen-4GrWvo-duF3GG-jYVkhr-eZoKBJ-4GkuVZ- https://www.flickr.com/photos/isriya/7180133440/in/photolist-bWu4w9-bWu2FL-bWu41J-bWu34N-bWu3BE-bWu3du-bWu2eu-bWu3PG-bWu4fC-bWu23w-6TqHos-5ZU29M-6m71g-6m7cG-6GPYhV-6m7nP-6m7g2-6m76Y-6m7aD-dnN9WN-6m7jB-6m749-dz56wz-dzaHgN-

Slide 16

Slide 16 text

a http://andrewschultz.com/wp-content/uploads/2012/10/fun_heart_blue.jpghttps://www.flickr.com/photos/isriya/7180133440/in/photolist-bWu4w9-bWu2FL-bWu41J-bWu34N-bWu3BE-bWu3du-bWu2eu-bWu3PG-bWu4fC-bWu23w-6TqHos-5ZU29M-6m71g-6m7cG-6GPYhV-6m7nP-6m7g2-6m76Y-6m7aD-dnN9WN-6m7jB-6m749-dz56wz-dzaHgN-

Slide 17

Slide 17 text

Alright, lets code a game in …

Slide 18

Slide 18 text

C++ or C# http://andrewschultz.com/wp-content/uploads/2012/10/fun_heart_blue.jpg

Slide 19

Slide 19 text

Build a game + in RUBY http://www.weddingchicks.com/wp-content/uploads/2014/04/best-day-ever-entrance-550x366.jpg

Slide 20

Slide 20 text

GOSU • 2D Game Development Library. • Originally written in C++ by Julian Raschke and Jan Lucker. • Official Website: http://www.libgosu.org • Official game board: http://www.libgosu.org/cgi- bin/mwf/board_show.pl?bid=2

Slide 21

Slide 21 text

GOSU Showcase

Slide 22

Slide 22 text

pop-the-balloon / carfight

Slide 23

Slide 23 text

DragonEggs

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Captain Ruby

Slide 26

Slide 26 text

Game Development Considerations: • Story • Design (look and feel) • Gameplay

Slide 27

Slide 27 text

Game Development Concepts GAMELOOP

Slide 28

Slide 28 text

The only concept..!!! INITIALIZE DRAW UPDATE

Slide 29

Slide 29 text

Basic Gosu Methods • initialize! • draw! • update

Slide 30

Slide 30 text

Components of DragonEggs • Game Window • Eggs • Baskets • Collision + Game logic • Asthetics

Slide 31

Slide 31 text

1. Game Window a.) CONFIG FILE! ! game:! x_par: 800! y_par: 600! gravity: 5! ! eggs:! count: 100! ! ! baskets:! count: 500! speed: 4! !

Slide 32

Slide 32 text

1. Game Window require 'gosu'! require ‘yaml'! ! class Game < Gosu::Window! ! def initialize! #load all constants! @config = YAML.load_file('config.yml')! ! super @config[‘game']['x_par'],! ! ! ! ! @config[‘game']['y_par'],! ! ! ! ! false! ! self.caption = 'Drop the damn egg.’! end! ! end!

Slide 33

Slide 33 text

! ! def button_down(id)! close if id == Gosu::KbEscape! end Key Press Events

Slide 34

Slide 34 text

KEY GOSU EVENT! Escape Gosu::KbEscape! ! a/A Gosu::KbA! ! b/B Gosu::KbB! ! c/C Gosu::KbC!

Slide 35

Slide 35 text

2. Eggs • Initialize • Draw •Move & Drop a.k.a UPDATE

Slide 36

Slide 36 text

Egg Initialization Egg.new(self, 400, 100)! ! ! ! x-coordinate y-coordinate

Slide 37

Slide 37 text

0 x-axis 800 800 y-axis 0!

Slide 38

Slide 38 text

POSITION: (400, 100)

Slide 39

Slide 39 text

Egg class class Egg! ! attr_accessor :x, :y! ! def initialize(window, x, y)! @x = x! @y = y! @image = Gosu::Image.new(window,! ‘bad_egg.png',! false)! end! ! def draw! @image.draw(@x, @y, 1)! end! end

Slide 40

Slide 40 text

Multiple Eggs #initialize the eggs array! @eggs = []! ! ! #set the starting positions of eggs! @config[‘eggs’][‘count'].times do |d|! @eggs << Egg.new(self, 400*d + 400, 100)! end! instance of Game Window

Slide 41

Slide 41 text

0 x-axis 800 800 y-axis 0!

Slide 42

Slide 42 text

Draw Eggs def draw! @eggs.each(&:draw)! end!

Slide 43

Slide 43 text

Move Eggs def update_next_egg_position(position)! ! #the egg has fallen, so increase fall count by 1! @fall_count += 1 ! ! #egg should move -400 to be visible at the screen! current_egg.x = current_egg.x - (400 * @fall_count)! ! end

Slide 44

Slide 44 text

Drop Egg ! ! def update_current_egg(egg)! egg.y = egg.y + @config['game']['gravity'] if egg.free_fall! ! #when pressed space, current egg should fall! if button_down?(Gosu::KbSpace)! egg.free_fall!! #to move the curret egg left only when it is not free fall! elsif button_down?(Gosu::KbLeft) && !egg.free_fall! egg.x = egg.x - 10 if egg.x > 100! elsif button_down?(Gosu::KbRight) && !egg.free_fall! egg.x = egg.x + 10 if egg.x < 700! end! end

Slide 45

Slide 45 text

Baskets Same thing really ..!!!!!

Slide 46

Slide 46 text

Collision Gosu::Distance(x1, y1, x2, y2) or

Slide 47

Slide 47 text

Collision ! def egg_into_basket(egg, basket)! basket.x <= egg.x &&! (egg.x-basket.x).between?(0, 35) &&! egg.y <= basket.y &&! (basket.y - egg.y).between?(0, 15)! end

Slide 48

Slide 48 text

0 x-axis 800 800 y-axis 0! x,y = 400,400 x,y=380, 420

Slide 49

Slide 49 text

Resources • https://github.com/jlnr/gosu/ ! • www.libgosu.org/ ! • http://github.com/rishijain ! • https://www.youtube.com/watch?v=jJhbpY70miE

Slide 50

Slide 50 text

THANK YOU! ! @jainrishi15