sysml design of simulation game

28
Copyright© 2014 SysML Design of Simulation Game David Hetherington V1.0 9 April 2014 SysML Design of Simulation Game 1

Upload: david-hetherington

Post on 18-Aug-2015

27 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: SysML Design of Simulation Game

Copyright© 2014

SysML Design of Simulation Game

David Hetherington

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 1

Page 2: SysML Design of Simulation Game

Copyright© 2014

Introduction

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 2

David HetheringtonOdyssey of Homer Career‐ Digital PBX‐ Multimedia Audio‐ Systems Management‐ Software Internationalization‐ Blade Servers‐ Automotive Radar ChipsetCurrent: Bring Modeling to Petroleum Industry

Page 3: SysML Design of Simulation Game

Copyright© 2014

Initial Inspiration

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 3

• Experienced operator had unloaded truck daily for 15 years – no problems.

• Broke leg in a sporting accident.

• Younger replacement was well trained…

• And was spotted by another employee with a walkie‐talkie..

• But misjudged the slope backing down the ramp.

• No serious injuries, but some damage to the forklift. 

• Incident investigation revealed a slight slope to the truck bed that the older operator had simply assimilated into his routine.

Could we model this somehow?

Page 4: SysML Design of Simulation Game

Copyright© 2014

The OSHA Standard

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 4

https://www.osha.gov/pls/oshaweb/owadisp.show_document?p_table=STANDARDS&p_id=9829

Page 5: SysML Design of Simulation Game

Copyright© 2014

Reformatting the Standard

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 5

Copy and paste from website to Excel. Looks nice, but format not ready for SysMLtool input.

Fortunately, a few simple VBA can dramatically reduce the pain of reformatting the data. Use 80/20 rule. Code 20% of VBA that yields 80% of benefit. Do rest by hand.

Page 6: SysML Design of Simulation Game

Copyright© 2014

Create a New SysML Model

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 6

Here we are using MagicDraw by NoMagic to create the model. Sparx Enterprise Architect will work well as well. Papyrus will be problematic because it has no ability to import requirements from a spreadsheet. That means that in any realistic project, the task of inputting (usually hundreds or even thousands of) requirements into a Papyrus model would be onerous. 

Most source requirements documents that you will encounter are not written by professional systems engineers. As such, the individual requirements contain too many different concepts. The requirement below is a good example. As such, in our new SysML model we will create packages for “Source” and “Clarified” requirements.

Page 7: SysML Design of Simulation Game

Copyright© 2014

Narrow Down Requirements

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 7

First we narrow down the requirements to those that are relevant to a training game, ie: the truck operations. 

Next we notice that the relevant requirements are in four sections…

From which we make package names…

And Load them into the model

Page 8: SysML Design of Simulation Game

Copyright© 2014

Load Source Requirements into the Model

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 8

Now we massage the requirements a little more…

And load them into the model

Page 9: SysML Design of Simulation Game

Copyright© 2014

Create Clarified Requirements

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 9

Create clarified requirements. For example, text that contains two unrelated 

subjects should be broken into two separate requirements.

Page 10: SysML Design of Simulation Game

Copyright© 2014

Create Derive Relationships

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 10

Create Derive Requirements Relationships

Page 11: SysML Design of Simulation Game

Copyright© 2014

Allocate Requirements to Use Cases

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 11

(The anchored note is a really handy method for adding the text to a use case. Unfortunately, it is a vendor extension rather than a 

part of SysML)

Page 12: SysML Design of Simulation Game

Copyright© 2014

Model Structure of the Game

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 12

We design a basic game structure:1. Welcome Screen2. Some number of Game Levels3. Closing Screen

After starting the game, the player can select a level. If the player “wins” 

the level, play proceeds to the next level. If not, the player moves to the Closing Screen. The Closing Screen gives the player his score and also gives him the option of playing the 

game again (or exiting).

Page 13: SysML Design of Simulation Game

Copyright© 2014

Allocate Use Cases to Game Level Instances

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 13

Now we can allocate the use cases to specific Game Level instances. We can also make those 

specific Game Level instances “satisfy” the clarified requirements.

Page 14: SysML Design of Simulation Game

Copyright© 2014

Model State Machine for Avoid Edge Level

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 14

Now we have a behavior design for the level that we can design to and explore for potential code generation.

Page 15: SysML Design of Simulation Game

Copyright© 2014

Blender ‐ Overview

• Open source• Amazing 3D rendering• “Toy Story” quality animation

• Built‐In game engine• Challenging to learn, but very functional, and lots of help available on Youtube

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 15

Page 16: SysML Design of Simulation Game

Copyright© 2014

Blender – Model the Forklift

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 16

Find a brochure of a real forklift on the internet and use it as a background image in Blender to create a Bézier curve outline of the forklift cab. 

After that extrude the outline to create the initial body shell.

Page 17: SysML Design of Simulation Game

Copyright© 2014

Blender – Model the Forklift

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 17

Cut some horizontal holes, slice off pieces, add some surfaces

Add textures and lettering

And add a few more things…

Page 18: SysML Design of Simulation Game

Copyright© 2014

Avoid Edge Game Level – Create Platform

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 18

1. Create a platform 20m by 20m and 1m high.2. Create a ramp up onto the platform 3m wide and 3m long.3. Create 1m wide safety areas all around the platform that are planes 

positioned 2cm above the platform.4. Add the forklift to the scene

• Lighting is a headache...• Fonts/Text do not behave well. Convert “Asatte Lift” to a mesh.• Linked objects are a headache for the physics engine. For the moment, I have 

joined the forklift components into a single mesh.

Page 19: SysML Design of Simulation Game

Copyright© 2014

Add Basic Motion

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 19

Add keyboard controls to create basic motion of forklift. Very powerful. Note that we only need to push the forklift around. The physics engine will figure out the rest.

Page 20: SysML Design of Simulation Game

Copyright© 2014

Detect Entry into Ramp – 1 of 2

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 20

1. Assign the Forklift object a property “ForkLift”

2. Assign the Ramp a sensor that notices a collision with “ForkLift”

3. Make that sensor send a broadcast message “StatusEnterRamp”

Page 21: SysML Design of Simulation Game

Copyright© 2014

Detect Entry into Ramp – 2 of 2

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 21

The Status Text overlay (a separate blend file) receives the message and runs a script.

Now we have the basic mechanics to implement the rest of the game and also connect the 

physics simulation to the Python 

scripting.

Page 22: SysML Design of Simulation Game

Copyright© 2014

Prototype of “Avoid Edge” Level Ready

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 22

Page 23: SysML Design of Simulation Game

Copyright© 2014

Code Generation Issues

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 23

Issue Work Around

Not much Python Code

Convert More Logic Bricks to Python

Tools SysML Tools don’t 

Generate Python

Work from XMI file

Use XSLT (Saxon)

Use Microsoft Excel Visual 

Basic

Final Game does not 

Quite Match Model

Update the Model Open Source 

Code Generators

Page 24: SysML Design of Simulation Game

Copyright© 2014

Why Bother With Code Generation?

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 24

PowerPoint Compiler

Draw Some Pretty Charts

p

Feed to PowerPoint Compiler

Ship Finished Product

Crack Open a Beer

More Realistic View

Model in SysML

Prototype by Prototype by Hand Using Model

Learn a *LOT*

Update Model to 

Match Reality

Custom Design Code Generator 

Generate & Hand‐Complete Production Code

Verification and Validation

Ship a Version of Product

This vision is very appealing to marketing guys and non‐

technical executives….

Code generation becomes the path to replication of 

patterns and best practices across a large 

number of levels of a complex game.

Page 25: SysML Design of Simulation Game

Copyright© 2014

What Worked? What Didn’t Work?

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 25

Not so Great Great!

Requirements Traceability

SysML Model of Behavior

Reliability of Game

Code Generation

SysML Model of Game Structure

Page 26: SysML Design of Simulation Game

Copyright© 2014

Future Exploration

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 26

Port to Commercial Game Engine Use SysML

Parametrics to Model Physics

Full Implementation 

of Code Generator

Add Human Actors

Model Forklift Controls More Accurately

How to Test Fact 

Knowledge?

How to Model Forklift and Working Area Inspections?

Page 27: SysML Design of Simulation Game

Copyright© 2014

Recommended Reading

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 27

Not for beginners, but very good working 

examples that you can studyBlender Foundations: The 

Essential Guide to Learning Blender 2.6 Roland Hess

Good starting point for Blender basics before tackling game programming.

Game Development with BlenderDalai Felinto, Mike Pan 

SysML Distilled: A Brief Guide to the Systems Modeling LanguageLenny Delligatti

UML and SysML together make a huge subject. This text does a nice job of presenting SysML concisely without getting lost in a forest of discussions of layers of metamodel abstraction.

Page 28: SysML Design of Simulation Game

Copyright© 2014

Questions/Comments/Suggestions…

V1.0 ‐ 9 April 2014 SysML Design of Simulation Game 28

Send me an e‐mail:  [email protected]

My website:  http://asattepress.com