a programming language for 3d action creation a programming language for 3d action creation © 2009...

29
A programming language for 3D action creation © 2009 Gamer All Rights Reserved Xiang Shi Haochen Liu Jian Ma Enlin Xu Qi Liang

Post on 21-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

A programming language for 3D action creation

A programming language for 3D action creation

© 2009 Gamer All Rights Reserved

Xiang ShiHaochen Liu

Jian MaEnlin XuQi Liang

What?

•KAction is an imperative, integrated language to create 3D action animation.

simple

action-oriented

efficient

© 2009 Gamer All Rights Reserved

Kung fu Taekwondo

Yoga

Much more...

© 2009 Gamer All Rights Reserved

Why?

Who?

Kung fu master, Yoga expertise, dancer, etc.

People interested in these fields

little programming experience

© 2009 Gamer All Rights Reserved

Master 囧 (Jone)Master 囧 (Jone)© 2009 Gamer All Rights Reserved

© 2009 Gamer All Rights Reserved

/* Below is a simple example of KAction Language, HelloKAction */

KAction(Number argc, String argv[]){ Action a; Action b; Action c; Action d;

a = Turn (RElbow, RShoulder, -90, 0);b = Turn (RHand, RElbow, 45, 0);

c = Turn (RHand, RElbow, 90, 0); d = Turn (RHand, RElbow,-90,0);

Seq s(“HelloKAction”)=a>>b>>c;Do s;

}

HelloKAction

DatatypeFundamental datatype

Number String Bool

Action-oriented datatypePoint

Turn Move

Action

Seq

Set

© 2009 Gamer All Rights Reserved

Point

WaistWaistWaistWaist

HeadHeadHeadHead

ChestChestChestChest

RShoulderRShoulderRShoulderRShoulder

RElbowRElbowRElbowRElbow

RHandRHandRHandRHand

RKneeRKneeRKneeRKnee

RAnkleRAnkleRAnkleRAnkle

LShoulderLShoulderLShoulderLShoulder

LElbowLElbowLElbowLElbow

LHandLHandLHandLHand

LKneeLKneeLKneeLKnee

LAnkleLAnkleLAnkleLAnkle

© 2009 Gamer All Rights Reserved

Turnt1 = Turn (Head, Chest, HAngle1, VAngle2);

t2 = Turn (Chest, Head, HAngle1, VAngle2);

t3 = Turn (LShoulder, Chest, HAngle1, VAngle2);

t4 = Turn (Chest, LShoulder, HAngle1, VAngle2);

t5 = Turn (RShoulder, Chest, HAngle1, VAngle2);

t6 = Turn (Chest, RShoulder, HAngle1, VAngle2);

t7 = Turn (Waist, Chest, HAngle1, VAngle2);

t8 = Turn (Chest, Waist, HAngle1, VAngle2);

t9 = Turn (LElbow, LShoulder, HAngle1, VAngle2);

t10 = Turn (LShoulder, LElbow, HAngle1, VAngle2);

t11 = Turn (LHand, LElbow HAngle1, VAngle2);

t12 = Turn (LElbow, LHand, HAngle1, VAngle2);

t13 = Turn (RElbow, RShoulder, HAngle1, VAngle2);

t14 = Turn (RShoulder, RElbow, HAngle1, VAngle2);

t15 = Turn (RHand, RElbow HAngle1, VAngle2);

t16 = Turn (RElbow, RHand, HAngle1, VAngle2);

t17 = Turn (LKnee, Waist, HAngle1, VAngle2);

t18 = Turn (Waist, LKnee, HAngle1, VAngle2);

t19 = Turn (LAnkle, LKnee HAngle1, VAngle2);

t20 = Turn (LKnee, LAnkle, HAngle1, VAngle2);

t21 = Turn (RKnee, Waist, HAngle1, VAngle2);

t22 = Turn (Waist, RKnee, HAngle1, VAngle2);

t23 = Turn (RAnkle, RKnee HAngle1, VAngle2);

t24 = Turn (RKnee, RAnkle, HAngle1, VAngle2);

© 2009 Gamer All Rights Reserved

Turn• t11 = Turn (LHand, LElbow 45, 0);

© 2009 Gamer All Rights Reserved

Turn• t11 = Turn (LHand, LElbow 45, 0);

© 2009 Gamer All Rights Reserved

Move

m1 = Move (Chest, HAngle1, VAngle2, Distance);

m2 = Move (Waist, HAngle1, VAngle2, Distance);

© 2009 Gamer All Rights Reserved

Action

•Fundamental action element

© 2009 Gamer All Rights Reserved

Seq

•Sequential combination of actions

© 2009 Gamer All Rights Reserved

Set

•Sequential combination of sequences

© 2009 Gamer All Rights Reserved

SetSet SetSet SeqSeq SeqSeqTurnTurnTurnTurnMovMov

eeMovMov

ee

ActionAction

© 2009 Gamer All Rights Reserved

HelloKAction/* Below is a simple example of KAction Language, HelloKAction */

KAction(Number argc, String argv[]){

Action a; Action b; Action c; Action d; a = Turn (RElbow, RShoulder, -90, 0);

b = Turn (RHand, RElbow, 45, 0); c = Turn (RHand, RElbow, 90, 0); d = Turn (RHand, RElbow,-90,0);

Seq s(“HelloKAction”)=a>>b>>c;Do s;

}

Create 4 ActionsCreate 4 ActionsCreate 4 ActionsCreate 4 Actions

KAction main KAction main functionfunction

KAction main KAction main functionfunction

Assign 4 Turn Assign 4 Turn actionsactions

Assign 4 Turn Assign 4 Turn actionsactions

Combine 4 Turns as Combine 4 Turns as a Seqa Seq

Combine 4 Turns as Combine 4 Turns as a Seqa Seq

Do the SeqDo the SeqDo the SeqDo the Seq

How?

© 2009 Gamer All Rights Reserved

KAction Architecture

© 2009 Gamer All Rights Reserved

ParserParserParserParser

Symbol Symbol TableTable

Symbol Symbol TableTable

Lexical Lexical AnalyzerAnalyzerLexical Lexical

AnalyzerAnalyzer

Token Stream

Type LibraryType LibraryType LibraryType Library

RenderRenderRenderRender

OpenGLOpenGLOpenGLOpenGL

Class Class “Set” in “Set” in

C++C++

Class Class “Set” in “Set” in

C++C++

Class Class “Set” in “Set” in

C++C++

Class Class “Set” in “Set” in

C++C++

Class Class “Set” in “Set” in

C++C++

Class Class “Set” in “Set” in

C++C++

Class Class “Set” in “Set” in

C++C++

Class Class “Set” in “Set” in

C++C++

OutputOutputOutputOutput

Front EndFront End Back EndBack End

<filename>.k<filename>.k<filename>.k<filename>.kKAction KAction IDEIDE

KAction KAction IDEIDE

Character Stream

Run

A = Turn ( P1, Chest, 90, 0);Do A;

<id, 1> = <TURN> <(> <id, 2> <,> <Chest> <,> <90>, <0> <)> <;><DO> <id, 1> <;>

1 A (address of A)

2 P1 ...

Symbol Table

Lexical AnalyzerLexical AnalyzerLexical AnalyzerLexical Analyzer

ParserParserParserParser

Set {...Seq {

...Action {

Turn[index] /* Store the parsed turn structure */...

}...

}...}

Set {...Seq {

...Action {

Turn[index] /* Store the parsed turn structure */...

}...

}...}

Development Tools and Environment

© 2009 Gamer All Rights Reserved

Flex

Bison

TextMate

Keynote

© 2009 Gamer All Rights Reserved

Integration

• A driver class is implemented in order to utilize both Flex and Bison in C++ mode and their output are encapsulated into class Set.

KAction IDE

Testing

Test casesTest casesTest casesTest cases

Interpreter testInterpreter testInterpreter testInterpreter test Application testApplication testApplication testApplication test

© 2009 Gamer All Rights Reserved

Test PlanInterpreter test

Blackbox testing for grammar consistency.

Complete test coverage and traceability.

Application test

Unit test for automation and regression.

Integration test.Each part of Master 囧 (Jone).Combination of different part of Master 囧 (Jone). © 2009 Gamer All Rights Reserved

Advantages

simple

powerful

efficient

Conclusion

Simple is good, but simple is hard.

Teamwork

Future workimplement system functions

complete grammar implementation

Thank you and Enjoy!

Thank you and Enjoy!