Introduction to Game Programming TutorialRichard Jones
The slides to accompany the Introduction to Game Programming tutorial I ran at LCA 2010. The tutorial ran over 90 minutes with the participants following along.
An introduction to making browser based games in JavaScript and HTML5.
This workshop was presented at an open day for the Academy of Interactive Entertainment in Sydney, Australia on November 17, 2012.
Introduction to Game Programming TutorialRichard Jones
The slides to accompany the Introduction to Game Programming tutorial I ran at LCA 2010. The tutorial ran over 90 minutes with the participants following along.
An introduction to making browser based games in JavaScript and HTML5.
This workshop was presented at an open day for the Academy of Interactive Entertainment in Sydney, Australia on November 17, 2012.
Software developers need more space to think, scribble, and hold their thoughts about programming tasks. Code Pad is a multi-touch tablet that allows developers interact with several programming elements in support of tasks such as refactoring or keeping reminders.
In a galaxy far, far away - A procedural generation taleShay Davidson
Let's create a game set in space!
For this, I have to render a nice looking galaxy. How do I do it? Do I create a pre-rendered image and place 100k stars manually (oh no!), or do I try to create something random procedurally that looks awesome?
In this talk, I'll delve into the basic concepts of procedural generation - mostly around the basic mathematical tools at your disposal as a developer to create awesome procedural generated art.
With every step in creating a realistic looking galaxy, I will provide code examples in JavaScript.
I first put together the core tools of Stegosploit in October 2014 at the Level2.LU hackerspace in Luxembourg. This year, Stegosploit comes full circle, with an updated toolkit and a new IMAJS technique presented at Hack.LU 2015.
Full paper available at http://stegosploit.info/
Software developers need more space to think, scribble, and hold their thoughts about programming tasks. Code Pad is a multi-touch tablet that allows developers interact with several programming elements in support of tasks such as refactoring or keeping reminders.
In a galaxy far, far away - A procedural generation taleShay Davidson
Let's create a game set in space!
For this, I have to render a nice looking galaxy. How do I do it? Do I create a pre-rendered image and place 100k stars manually (oh no!), or do I try to create something random procedurally that looks awesome?
In this talk, I'll delve into the basic concepts of procedural generation - mostly around the basic mathematical tools at your disposal as a developer to create awesome procedural generated art.
With every step in creating a realistic looking galaxy, I will provide code examples in JavaScript.
I first put together the core tools of Stegosploit in October 2014 at the Level2.LU hackerspace in Luxembourg. This year, Stegosploit comes full circle, with an updated toolkit and a new IMAJS technique presented at Hack.LU 2015.
Full paper available at http://stegosploit.info/
Following are the changes mentioned in bold in order to obtain the r.pdfanithareadymade
Following are the changes mentioned in bold in order to obtain the required result and stop
scrolling in the background.
#include \"SDL/SDL.h\"
#include
//The attributes of the screen can be defined as follows
const int SCN_WIDTH = 640;
const int SCN_HEIGHT = 480;
const int SCN_BPP = 32;
//BPP defines bits per pixel
SDL_Surface* Background = NULL;
SDL_Surface* SpriteImage = NULL;
SDL_Surface* Backbuffer = NULL;
int SpriteFrame = 0;
int FrameCounter = 0;
const int MaxSpriteFrame = 12;
const int FrameDelay = 2;
int BackgroundX = 0;
SDL_Surface* LoadImage(char* fileName);
bool LoadFiles();
void FreeFiles();
void DrawImage(SDL_Surface* image, SDL_Surface* destSurface, int x, int y);
void DrawImageFrame(SDL_Surface* image, SDL_Surface* destSurface, int x, int y, int width,
int height, int frame);
bool ProgramIsRunning();
int main(int argc, char* args[])
{
if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
{
printf(\"Failed to initialize SDL!\ \");
return 0;
}
Backbuffer = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE);
SDL_WM_SetCaption(\"Image Animation\", NULL);
if(!LoadFiles())
{
printf(\"Failed to load all files!\ \");
FreeFiles();
SDL_Quit();
return 0;
}
while(ProgramIsRunning())
{
//Update\'s the sprites frame
FrameCounter++;
if(FrameCounter > FrameDelay)
{
FrameCounter = 0;
SpriteFrame++;
}
if(SpriteFrame > MaxSpriteFrame)
SpriteFrame = 0;
//Background scrolling can be removed from this position
//Render the scene
DrawImage(Background,Backbuffer, BackgroundX, 0);
DrawImage(Background,Backbuffer, BackgroundX+800, 0);
DrawImageFrame(SpriteImage, Backbuffer, 350,250, 150, 120, SpriteFrame);
SDL_Delay(20);
SDL_Flip(Backbuffer);
}
FreeFiles();
SDL_Quit();
return 0;
}
SDL_Surface* LoadImage(char* fileName)
{
SDL_Surface* imageLoaded = NULL;
SDL_Surface* processedImage = NULL;
imageLoaded = SDL_LoadBMP(fileName);
if(imageLoaded != NULL)
{
processedImage = SDL_DisplayFormat(imageLoaded);
SDL_FreeSurface(imageLoaded);
if(processedImage != NULL)
{
//Here we map the color key
Uint32 colorKey = SDL_MapRGB(processedImage->format, 0, 0xFF, 0xFF);
//Now, set all the pixels of color R 0,G 0*FF,B 0*FF to be transparent
SDL_SetColorKey(processedImage, SDL_SRCCOLORKEY, colorKey);
}
}
return processedImage;
}
bool LoadFiles()
{
Background = LoadImage(\"graphics/background.bmp\");
if(Background == NULL)
return false;
SpriteImage = LoadImage(\"graphics/bat.bmp\");
//The file should be preloaded and linked with the required libraries in SDL
if(SpriteImage == NULL)
return false;
else
return true;
}
void FreeFiles()
{
SDL_FreeSurface(Background);
SDL_FreeSurface(SpriteImage);
}
void DrawImage(SDL_Surface* image, SDL_Surface* destSurface, int x, int y)
//A temporary rectangle is used to hold the offsets
{
SDL_Rect destRect;
//Giving the offsets to the rectangle
destRect.x = x;
destRect.y = y;
//Blit the surface
SDL_BlitSurface(image, NULL, destSurface, &destRect);
}
//Here, we need to start the main function:
int main(int argc,char** args)
//Now, initialize all SDL subsystems
if .
Flash over the years, has been used to prop up the regular browser like a sad old man drinking alone in a pub.
Today browsers come shipped with technology designed to rival flash and aim to shut it squarely out of the game.
Are browser ready to rock without Flash?
Solo PHP. Niente trucchi e niente inganno (ne Javascript ne Web). Ci imbarcheremo nell’odissea che porta un programmatore a pensare di poter scrivere videogiochi con PHP e SDL. Disegnare sullo schermo, gestire gli input, fare il play di audio e gestire il mixer.
PHPDay GrUSP edition 2022
Lab Practices and Works Documentation / Report on Computer GraphicsRup Chowdhury
This is a report that I have prepared during my Computer Graphics Lab course. This contains the theoretical information that we learned in our introduction class. It also contains information on different computer graphics tools and software. It contains codes to create different and also the procedure.
1. Information on GLUT
2. Flag drawing with GLUT
3. DDA Algorithm
4. Midpoint Line Drawing Algorithm
5. Tansformation
Can someone please explain what the code below is doing and comment on.pdfkuldeepkumarapgsi
Can someone please explain what the code below is doing and comment on its network
performance? Please and thank you.
import numpy as np
import matplotlib.pyplot as plt
import keras
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers import LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv2D
from keras.models import Sequential, Model
from keras.optimizers import Adam,SGD
from keras.datasets import cifar10
#Loading the CIFAR10 data
(X, y), (_, _) = keras.datasets.cifar10.load_data()
#Selecting a single class of images
#The number was randomly chosen and any number
#between 1 and 10 can be chosen
X = X[y.flatten() == 8]
#Defining the Input shape
image_shape = (32, 32, 3)
latent_dimensions = 100
#Define a utility function to build the generator.
def build_generator():
model = Sequential()
#Building the input layer
model.add(Dense(128 * 8 * 8, activation="relu",
input_dim=latent_dimensions))
model.add(Reshape((8, 8, 128)))
model.add(UpSampling2D())
model.add(Conv2D(128, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(UpSampling2D())
model.add(Conv2D(64, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(Conv2D(3, kernel_size=3, padding="same"))
model.add(Activation("tanh"))
#Generating the output image
noise = Input(shape=(latent_dimensions,))
image = model(noise)
return Model(noise, image)
#Define a utility function to build the discriminator.
def build_discriminator():
#Building the convolutional layers
#to classify whether an image is real or fake
model = Sequential()
model.add(Conv2D(32, kernel_size=3, strides=2,
input_shape=image_shape, padding="same"))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(64, kernel_size=3, strides=2, padding="same"))
model.add(ZeroPadding2D(padding=((0,1),(0,1))))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
model.add(Conv2D(128, kernel_size=3, strides=2, padding="same"))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(256, kernel_size=3, strides=1, padding="same"))
model.add(BatchNormalization(momentum=0.8))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
#Building the output layer
model.add(Flatten())
model.add(Dense(1, activation='sigmoid'))
image = Input(shape=image_shape)
validity = model(image)
return Model(image, validity)
#Step 6: Define a utility function to display the generated images.
def display_images():
r, c = 4,4
noise = np.random.normal(0, 1, (r * c,latent_dimensions))
generated_images = generator.predict(noise)
#Scaling the generated images
generated_images = 0.5 * generated_images + 0.5
fig, axs = plt.subplots(r, c)
count = 0
for i in range(r):
for j in range(c):
axs[i,j].imshow(ge.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
PHP Frameworks: I want to break free (IPC Berlin 2024)
building_games_with_ruby_rubyconf
1. High A!
on top of
Low-level APIs
Building Games with Ruby
Andrea O. K. Wright, Chariot Solutions
www.chariotsolutions.com
2. High A!
on top of
Low-level APIs
Building Games with Ruby
Agenda
1. Buiding 2D Games with Ruby
2. Building 3D Games with Ruby
3. Is Ruby a legitimate player in the gaming space?
3. Creator and Lead Developer: Ohai
http://www.kmc.gr.jp/~ohai/rubysdl.en.html
12. Sample Event Loop
while true
while event = SDL::Event2.poll
case event
when SDL::Event2::Quit
exit
when SDL::Event2::KeyDown
exit if event.sym == SDL::Key::ESCAPE
end
end
screen.fillRect(0,0,640,480,0)
SDL::Key.scan
sprites.each {|i|
i.move
i.draw(screen)
}
screen.updateRect(0,0,0,0)
end
13. Sprite: Random Motion
class Sprite
def initialize
@x=rand(640)
...
@dx=rand(11)-5
end
def move
@x += @dx
if @x >= 640 then
@dx *= -1
@x = 639
end
if @x < 0 then
@dx *= -1
@x = 0
end
...
end
def draw(screen)
SDL.blitSurface($image,0,0,32,32,screen,@x,@y)
end
end
14. Event-Driven Sprite
class MovableSp
def initialize()
@ud=@lr=0;
end
def move()
@ud=@lr=0;
@lr=-1 if SDL::Key.press?(SDL::Key::LEFT)
@lr=1 if SDL::Key.press?(SDL::Key::RIGHT)
@ud=1 if SDL::Key.press?(SDL::Key::DOWN)
@ud=-1 if SDL::Key.press?(SDL::Key::UP)
end
def draw(screen)
SDL.blitSurface($image,0,0,32,32,
screen,300+@lr*50,200+@ud*50)
end
end
19. Principle of Least Surprise?
SDL_Surface *SDL_SetVideoMode(int width, int height,
int bpp,Uint32 flags);
static VALUE displaySurface_new(int argc, VALUE* argv,
VALUE self)
20. Principle of Least Surprise?
screen = SDL::setVideoMode(640,480,16,SDL::SWSURFACE)
display = DisplaySurface.new([640,480])
21. Principle of Least Surprise?
static VALUE sdl_setVideoMode(VALUE mod,VALUE w,VALUE h,
VALUE bpp,VALUE flags){
SDL_Surface *screen;
screen = SDL_SetVideoMode(NUM2INT(w),NUM2INT(h, NUM2IN
(bpp), NUM2UINT(flags));
if(screen == NULL){
rb_raise(eSDLError,
"Couldn't set %dx%d %d bpp video mode:%s",
NUM2INT(w),NUM2INT(h),NUM2INT(bpp),SDL_GetError());
}
return Data_Wrap_Struct(cScreen,0,0,screen);
}
rb_define_module_function(mSDL, "setVideoMode",
sdl_setVideoMode,4);
22. Principle of Least Surprise?
static VALUE displaySurface_new(int argc, VALUE*
argv, VALUE self)
{
...
surf = SDL_SetVideoMode(w, h, depth, flags);
currentDisplaySurface = Data_Wrap_Struct
(classDisplaySurface, 0, 0, surf);
return currentDisplaySurface;
})
rb_define_singleton_method(classDisplaySurface,
"new",
displaySurface_new,
-1);
23. Principle of Least Surprise?
screen = SDL::setVideoMode(640,480,16,SDL::SWSURFACE)
display = DisplaySurface.new([640,480])
24. OpenGL
http://nehe.gamedev.net/
RUDL Ports of Neon Helium Tutorials, Packaged with RUDL,
Ported by Martin Stannard
25. OpenGL
def init(w,h)
GL.ClearColor(0.0, 0.0, 0.0, 0.0)
GL.ClearDepth(1.0)
GL.DepthFunc(GL::LESS)
GL.Enable(GL::DEPTH_TEST)
GL.ShadeModel(GL::SMOOTH)
GL.MatrixMode(GL::PROJECTION)
GL.LoadIdentity()
GLU.Perspective(45.0, w.to_f/h.to_f,
0.1, 100.0)
GL.MatrixMode(GL::MODELVIEW)
GL.LoadIdentity()
GLU.LookAt(0.0, 0.0, 5.0,
0.0, 0.0, 0.0, 0.0, 1.0,
0.0)
end
Source by Martin Stannard: from RUDL samples
31. and
Rect
left centerx right
(x, y) midtop
top
topleft topright
midleft midright
centery
center
bottomleft bottomright
bottom
midbottom
@rect.topleft = 10,10
32. and
Rect
# Attempt to punch a target.
# Returns true if it hit or false if not.
def punch(target)
@punching = true
return @rect.inflate(-5,-5).collide_rect?(target.rect)
end
41. Main Window
class MainWindow < Gosu::Window
def initialize(width, height, fullscreen)
super
end
def update
# Change display attributes, if necessary.
def draw
# Display calls go here.
end
def button_down(id)
# Buttons are keys, mouse buttons, and
# game pad controls.
end
end
w = MyWindow.new(640, 480, false)
w.show
45. and
if rand(100) < 4 and @stars.size < 25 then
body = CP::Body.new(0.0001, 0.0001)
shape = CP::Shape::Circle.new(body, 25/2,
CP::Vec2.new(0.0, 0.0))
shape.collision_type = :star
@space.add_body(body)
@space.add_shape(shape)
stars.push(Star.new(@star_anim, shape))
end
GosuChipmunk Tutorial by Dirk Johnson
48. and
def remove_dirt point, radius
$playfield_buffer.filled_circle([point[0],
point[1]], radius, [0,0,0])
$backbuffer.filled_circle([point[0],point[1]],
radius, [0,0,0])
end
Sample Packaged with RUDL
“Barrage” by Brian Palmer, Pocket Martian Software
49. and
if not @crater_image then
@crater_image = Magick::Image.new(50, 50)
{self.background_color = 'none'}
gc = Magick::Draw.new
gc.fill('black').circle(25, 25, 25, 0)
gc.draw(@crater_image)
@crater_shadow = @crater_image.shadow(0,0,5,1)
end
@crater_image @crater_shadow
51. and
def draw
gl do
glClearColor(0.0, 0.2, 0.5, 1.0)
glClearDepth(0)
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
@gl_background.exec_gl
end
...
end
58. Shattered Ruby
Martyn Garcia on Shattered Ruby vs. Rails
“...while Rails has a simple text output view,
Shattered has a very complex 3d rendering. And
while Shattered has simple game logic, Rails has a
very complex database backend.
Our focus is swapped.
The way Rails gains a ton of power is by making
assumptions on the model. ..[o]ur view is the
largest part...”
59. ShatteredRuby
From the Ogre.rb Samples
class SkyPlaneApplication < Application
def create_scene
scene_manager.set_ambient_light ColourValue.new(0.5,
0.5, 0.5)
plane = Plane.new
plane.d = 5000
plane.normal = -Vector3.UNIT_Y
scene_manager.set_sky_plane(true,
plane,"SpaceSkyPlane", 10000, 3)
light = scene_manager.create_light("MainLight")
light.set_position(20, 80, 50)
dragon = scene_manager.create_entity("dragon",
"dragon.mesh")
scene_manager.root_scene_node.attach_object(dragon)
end
end
60. ShatteredRuby
From the Ogre.rb Samples
class SkyPlaneApplication < Application
def create_scene
scene_manager.set_ambient_light ColourValue.new(0.5,
0.5, 0.5)
plane = Plane.new
Shattering the Code....
plane.d = 5000
plane.normal = -Vector3.UNIT_Y
scene_manager.set_sky_plane(true,
plane,"SpaceSkyPlane", 10000, 3)
class SkyPlane
light = scene_manager.create_light("MainLight")
light.set_position(20, 80, 50)
light “Mainlight”,
dragon = scene_manager.create_entity("dragon",
:position => (20,80,50)
"dragon.mesh")
end
scene_manager.root_scene_node.attach_object(dragon)
end class Dragon
end
end
65. ShatteredRuby
ModelViewActor Architecture
Actor
space_race>script/generate actor flying_carpet
exists app/models/
exists test/unit/ Model
create app/models/flying_carpet.rb
create test/unit/flying_carpet_test.rb
exists app/views/
create app/media/flying_carpet View
create app/views/flying_carpet_view.rb
create app/media/flying_carpet/flying_carpet.mesh
create app/media/flying_carpet/flying_carpet.png
Model
Contains game logic and handles user input events.
When a method is called on the Model, and a method with the same
name exists on the View -- the View’s method is automatically invoked.
View
The View responds to methods on the Model.
66. ShatteredRuby
State Management
space_race>script/generate state menu
create app/states/
create app/states/menu_state.rb
space_race>script/generate state game
exists app/states/
create app/states/game_state.rb
State
Represents routes through the application
Provides a top level where actors can interact
67. ShatteredRuby
OGRE Materials Format
// This is a comment
material walls/funkywall1
{
// first, preferred technique
technique
{
// first pass
pass
{
ambient 0.5 0.5 0.5
diffuse 1.0 1.0 1.0
// Texture unit 0
texture_unit
{
texture wibbly.jpg
scroll_anim 0.1 0.0
wave_xform scale sine 0.0 0.7 0.0 1.0
}
// Texture unit 1 (this is a multitexture pass)
texture_unit
{
texture wobbly.png
rotate_anim 0.25
colour_op add
}
}
}
// Second technique, can be used as a fallback or LOD level
technique
{
// .. and so on
}
}
(from the OGRE manual:
http://www.ogre3d.org/docs/manual/manual_14.html)
68. Shattered Ruby Rmaterials
material < %= name % >
OGRE Materials Format
{
// This is a comment
technique
material walls/funkywall1
{
{
// first, preferred technique
technique
{
// first pass
pass pass
{
{
ambient 0.5 0.5 0.5
diffuse 1.0 1.0 1.0
lighting off
// Texture unit 0
texture_unit
{ texture_unit
{
texture wibbly.jpg
scroll_anim 0.1 0.0
wave_xform scale sine 0.0 0.7 0.0 1.0
} texture < %= texture % >
// Texture unit 1 (this is a multitexture pass)
texture_unit
{ }
}
texture wobbly.png
rotate_anim 0.25
colour_op add
}
}
}
}
}
// Second technique, can be used as a fallback or LOD level
technique
{
// .. and so on
}
material :flying_carpet, :template => 'basic',
}
(from the OGRE manual:
:texture => 'tapestry.png'
http://www.ogre3d.org/docs/manual/manual_14.html)
70. Shattered Ruby
That’s right, there are no more “What, Shattered
doesn’t support per vertex bi-quadruple render
transmutation?! -- that’s outragous!”. Anything
supported in Ogre will be supported in Shattered!
-- Mikkel Garcia
73. Shattered Ruby
Co-Creators and Co-Lead Developers:
Martyn Garcia and Mikkel Garcia
http://groups.google.com/group/shatteredruby
74. Creator and Lead Developers: David Koontz
http://rubyforge.org/projects/railgun/
75. High A!
on top of
Low-level APIs
Building Games with Ruby
Agenda
1. Buiding 2D Games with Ruby
2. Building 3D Games with Ruby
3. Is Ruby a legitimate player in the gaming space?
76. The GGZ Gaming Zone Project
Founders: Brent M. Hendricks and Rich Gade
Developed & Maintained by
an International Team
http://www.ggzgamingzone.org/
81. GGZ Gaming Zone
ggzcommgen
game client net.c net.c
game server
Game Client/Game Server (tictactoe)
Individual Protocol
TCP/IP or UDP/IP
ggzmod/game ggzdmod/server
Game Client/Core Client Game Server/GGZ Server
Binary Protocol Binary Protocol
Local Connection Local Connection
ggzmod/core ggzmod/core
core client Core Client/GGZ Server ggz server
XML Protocol
TCP/IP
ggzcore
82. GGZ Gaming Zone
game client Game Client to
Core Client
GAME_STATE(0), STAND(1), SIT(2),
ggzmod/game BOOT(3), BOT(4), OPEN(5),
CHAT(6)
Core Client to
Game Client
ggzmod/core
GAME_LAUNCH(0), GAME_SERVER(1),
core client GAME_PLAYER (2), GAME_SEAT(3),
core client GAME_SPECTATOR SEAT(4)
GAME_CHAT(5), GAME_STATS(6)
83. GGZ Gaming Zone
game client Game Client to
DATA TYPE
Core Client
Opcode 4
GAME_STATE(0), STAND(1), SIT(2),
ggzmod/game BOOT(3), BOT(4), OPEN(5),
Spectator Seat#
CHAT(6) integer
Spectator Name string
Core Client to
Game Client
ggzmod/core
GAME_LAUNCH(0), GAME_SERVER(1),
core client GAME_PLAYER (2), GAME_SEAT(3),
core client GAME_SPECTATOR SEAT(4)
GAME_CHAT(5), GAME_STATS(6)
84. GGZ Gaming Zone
ggzcommgen
game client net.c net.c
game server
Game Client/Game Server (tictactoe)
Individual Protocol
TCP/IP or UDP/IP
ggzmod/game ggzdmod/server
Game Client/Core Client Game Server/GGZ Server
Binary Protocol Binary Protocol
Local Connection Local Connection
ggzmod/core ggzmod/core
core client Core Client/GGZ Server ggz server
XML Protocol
TCP/IP
ggzcore
85. GGZ Gaming Zone
ggzcommgen
game client net.c net.c
game server
Game Client/Game Server (tictactoe)
Individual Protocol
TCP/IP or UDP/IP
<ggzcomm engine="tictactoe" version="4">
<definitions>
<def name="msggameover" value="3"/>
</definitions>
<server>
...
<event name="msggameover">
<data name="winner" type="byte"/>
</event>
</server>
</ggzcomm>
86. GGZ Gaming Zone
ggzcommgen
game client net.c net.c
game server
Game Client/Game Server (tictactoe)
Individual Protocol
TCP/IP or UDP/IP
<ggzcomm engine="tictactoe" version="4">
<definitions>
void ggzcomm_msggameover(GGZCommIO * io) {
<def name="msggameover" value="3"/>
ret = ggz_write_int(io->fd, msggameover);
</definitions>
if(ret < 0)
<server>
... ggzcomm_error();
ret = ggz_write_char(io >fd,variables.winner);
<event name="msggameover">
if(ret < 0)name="winner" type="byte"/>
<data
ggzcomm_error();
</event>
}
</server>
</ggzcomm>
87. GGZ Gaming Zone
ggzcommgen
net.rb net.rb
Ruby Game Client/Game Server Ruby
game client Individual Protocol game server
TCP/IP or UDP/IP
<ggzcomm engine="tictactoe" version="4">
<definitions>
<def name="msggameover" value="3"/>
def send_gameover(p, winner)
... </definitions>
s = <server>
GGZRawSocket.for_fd($server.get_seat_fd(p))
...
<event name="msggameover">
s.puti(::MSG_GAMEOVER)
s.putb(winner) name="winner" type="byte"/>
<data
end </event>
</server>
</ggzcomm>
88. GGZ Gaming Zone
ggzcommgen
net.rb net.rb Ruby
Ruby
game client Game Client/Game Server game server
Individual Protocol
TCP/IP or UDP/IP
ggzmod/game ruggzmod/ ruggzdmod ggzdmod/server
RGGZMod
Game Client/Core Client Game Server/GGZ Server
Binary Protocol Binary Protocol
Local Connection Local Connection
ggzmod/core ggzmod/core
core client Core Client/GGZ Server ggz server
XML Protocol
TCP/IP
ggzcore
89. GGZ Gaming Zone
ggzcommgen
net.rb net.rb
QtRuby
Game Client/Game Server
Individual Protocol
rubytoe
game server
game client TCP/IP or UDP/IP
ggzmod/game ruggzmod/ ruggzdmod ggzdmod/server
RGGZMod
Game Client/Core Client Game Server/GGZ Server
Binary Protocol Binary Protocol
Local Connection Local Connection
ggzmod/core ggzmod/core
core client Core Client/GGZ Server ggz server
XML Protocol
TCP/IP
ggzcore
90. GGZ Gaming Zone
ggzcommgen
net.rb net.rb
QtRuby
Game Client/Game Server
Individual Protocol
rubytoe
game server
game client TCP/IP or UDP/IP
ggzmod/game ruggzmod/ ruggzdmod ggzdmod/server
RGGZMod
Game Client/Core Client Game Server/GGZ Server
Binary Protocol Binary Protocol
Local Connection Local Connection
ggzmod/core ggzmod/core
core client Core Client/GGZ Server ggz server
XML Protocol
TCP/IP
ggzcore
91. GGZ Gaming Zone
begin rubytoe
require "TTTAI" game server
$ai = TTTAI.new
puts "## Info: Using TTT-AI plugin ##"
rescue LoadError
$ai = nil
puts "## Warning: TTT-AI not found, using
internal random AI ##"
end
92. GGZ Gaming Zone
begin
require "TTTAI"
$ai = TTTAI.new
rubytoe
puts "## Info: Using TTT-AI plugin for higher game server
def find_move(p)
intelligence $ai then
if ##"
rescue LoadError
return $ai.ai_findmove(p, 1, @board)
$ai = nil end
puts "## Warning: TTT-AI not found, using
for i in 0..100
internal random AI rand(9)
move = ##"
end
if evaluate_move(p, move) == ::MOVE_OK then
return move
end
e
nd
return -1
end
end