Outline - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Outline

Description:

... or from other commands running in parallel ... Commands can be executed in serial or ... load balancing of parallel commands on a variable number of ... – PowerPoint PPT presentation

Number of Views:76
Avg rating:3.0/5.0
Slides: 19
Provided by: jcb94
Category:
Tags: commands | outline

less

Transcript and Presenter's Notes

Title: Outline


1
  • Outline
  • What is URBI?
  • Language Introduction
  • Multicore Integration
  • Finite State Machines
  • Object Oriented Prog.
  • Example program
  • Conclusion

Universal Real-time Behavior Interface www.urbifo
rge.com
URBI for Games
2
What is URBI?
def neurons.init() sum 0 sum-gtblend
add inputNb random(C) for
(j0jltinputNbj) inputj
random(N) for (i0iltNi) subclass
neurons neuroni neurons.init() ...
Universal Real-time Behavior Interface
C-like syntax
  • Script language (like Python, Lua, UnrealScript,
    QuakeC)
  • Initially coming from and developed for Robotics
  • Original features useful for game scripting
  • Parallel programming
  • Safe mutex integration (blending modes)
  • Powerful command tagging mechanism
  • stop / freeze / unfreeze a command from
    anywhere
  • Native event driven programming
  • Variables as dynamical structures with temporal
    evolution
  • Multicore integration
  • Client/Server architecture gt flexibility

3
Client / Server Architecture
The Client / Server architecture gives a lot of
flexibility with good performances on localhost.
3D Engine
Physics Engine
Animation
Sound
URBI server
URBI client(s)
commands
messages
4
Tags Messages
All messages from the server are composed with
the same standard structure
player.hitpoints 136901543notag 15.000000
the command to the server
the message from the server
Time stamp (ms)
Command tag
Message content
myname player.name 136901543myname "kergoth"
custom tag useful to know who is sending what
dangerous, level5.area24 ... commands
... 136901543dangerous, level5.area24
message
Multi tag and hierachical tags (in version 1.0)
5
Advanced Tagging
stop / block / freeze
mytag command1 if (player.hitpoints lt 50)
stuff command2 while (index lt 10)
ping index ...
From another client or from other commands
running in parallel
6
Parallelism
Commands can be executed in serial or parallel
mode
player3.pos 15 x 30
Set player3.pos to 15 and x to 30 at the same time
pl.pos 15 pl.pos 30
Set pl.pos to 15 and after, set pl.pos to 30.
Some useful "new" constructs in URBI
for (i0ilt100i) ...
while ...
7
Complex Assignments
Simple assignment
headPan -2
Numerical assignments can be specified via
modifiers
This command never terminates
8
Blending modes
Conflicting assignments can occur from several
clients or inside the same program. How to handle
it?
door.pos-gtblend add
Each assignment occurs at the same time and is
added to the others gt Used to superimpose
sinuses in Fourier decomposition
// example of code avg-gtblend mix for
(i0 ilt100 i) avg tabi echo avg //
average of the tab array
door.pos-gtblend mix
Like add, but they are averaged instead of added
door.pos-gtblend queue
Each assignement occurs only when the others are
finished
door.pos-gtblend discard
Each conflicting assignment is ignored
door.pos-gtblend cancel
Each new assignment terminate any other pending
assignment
door.pos-gtblend normal
The latest assignment has the focus, be the
others run in background
9
Objects
guards new npc peons new npc("peon")
Usual OOP features are available (v 1.0)
class npc def name def showname() event
tired subclass npc guards, peon, knight,
wolf subclass npc guards, peon, knight,
wolf init("npc")
npc
guards
peons
knights
dragons
guard1
guard2
guard3
URBI multiple parallel launch going downward
def npc.showname() echo name guards.shown
ame()? gets npc.showname ? broadcast
showname() ? guards.showname()
guard1.showname() guard2.showname()
guard3.showname()
Usual virtual method search going upward
def npc.showname() echo name guard2.shown
ame()? gets npc.showname
10
Event catching
Several event catching mechanisms are available
waituntil (test)
Terminates only when test becomes true. gt If
given a number, the wait command pauses for this
nb of ms.
usage
waituntil (test) instructions
11
Event catching (2)
You can control the lifespan of a command
12
Event catching(3)
You can emit your own events with the emit
function
13
Multicore Integration
OS
Hardware
Automatic load balancing of parallel commands on
a variable number of cores and threads, with
real-time scheduling capabilities (currently in
development)
Core 1
Physical Thread
Physical Thread
URBI Scheduler
URBI Kernel
URBI Code Client1
Physical Thread
Core 2
URBI Code Client2
Physical Thread
Network Layer
Physical Thread
URBI Code Client3
URBI Commands Micro-threads (logical thread)
Core 3
Physical Thread
Synchronisation
14
Finite State Machines
def area2.enter() area2.tag1 at
(cond1) action1 emit go_area4 stop
area2 area2.tag2 at (cond2)
action2 emit go_area3 stop area2
area2.main loop ... at (go_area2)
area2 area2.enter() at (go_area4) area4
area4.enter()
Integrated
Area 2
cond3
Action3
cond1
Area 1
Action1
cond2
Action2
Area 3
Area 4
cond4
Action4
15
Object Oriented Programming
// class definition class switches def
lights event pressed def
switches.init() at (pressed) foreach
light in lights (light) 1 subclass
elements switches, doors, lights subclass
switches switch25, switch12 subclass lights
light47, light12, light14 //
instances switch25.lights light47,
light12 switch12.lights light14 ... //
main program switches.init()
elements
switches
doors
lights
switch12
switch25
16
Random walkers
Random walk
def walkers.move() angle angle
(random(11) - 5) x x speed sin(angle)
timetimestep y y speed cos(angle)
timetimestep walkers.nb 10000 for (i0
iltwalkers.nb i) walkeri new
walkers walkers.x random(walkers.maxx) walker
s.y random(walkers.maxy) walking every
(timestep) walkers.move() // "pulsing" command
With borders
def walkers.border() at (x lt 0 x gt maxx)
angle pi angle at (y lt 0 y gt
maxy) angle angle walkers.border()
17
Conclusion

URBI Demo Server for Aibo Liburbi are freely
available for non commercial use
at www.urbiforge.com
  • Key points
  • Parallelism with tag based control
  • Native event programming
  • Multicore
  • Easy to extend with the
  • client/server model
  • Important features in development
  • Real-time scheduling capabilities
  • Powerful debugger to handle parallelism
  • Current status
  • Looking for partners and future clients in game
    industry

Short demo video
18
Programming a crowd (2)
class walkers class grid def
x,y,speed,angle,maxx,maxy def val event
chatting walkers.nb 1000 for (i0
iltwalkers.nb i) walkeri new walkers
walkeri.n i walkers.x
random(walkers.maxx) walkers.y
random(walkers.maxy) for (x0 xltwalkers.maxx
x) for (y0 yltwalkers.maxy y)
gridxy new grid def walkers.move()
angle angle (5 - random(10)) if
(!chatting) x x speed sin(angle)
timestep y y speed cos(angle)
timestep gridxy.val
gridxy.val n def grid.chat()
foreach x in val if (!walkerx.chatting)
emit(random(10s)) walkerx.chatting walking
every (step) grid.val walkers.move()
grid.chat()
chat
Write a Comment
User Comments (0)
About PowerShow.com