Slide 1

Slide 1 text

2014.04.11 @ OSDC.tw By Johnson Lin @cubeatgame || www.facebook.com/cubeatgame The Making of Programming-wise

Slide 2

Slide 2 text

About me Johnson Lin Programmer & Indie Game igdshare.org & IGDA Taiwan ( igda.tw ) archilife.org & Indie game contests scholarship ( 祐生研究基金會 )

Slide 3

Slide 3 text

Overview Libraries Used (with some in-house ones) - especially: Easing Functions & Custom Dictionary Development Issues (that I think is interesting) - AI design & impl - Why game programming is messy - Cross-platform? All (?) the Mistakes (??)

Slide 4

Slide 4 text

Let's demo first.

Slide 5

Slide 5 text

Overview Libraries Used (with some in-house ones) - especially: Easing Functions & Custom Dictionary Development Issues (that I think is interesting) - AI design & impl - Why game programming is messy - Cross-platform? All (?) the Mistakes (??)

Slide 6

Slide 6 text

Libs & tools https://github.com/godfat/cubeat/

Slide 7

Slide 7 text

Libs & tools gcc 4.6 ruby 1.8-1.9 CMake code::Blocks (on Win) https://github.com/godfat/cubeat/

Slide 8

Slide 8 text

Libs & tools Irrlicht 1.7 (custom) Boost 1.48 Freetype 2.3.x LuaJIT2 Ogg/Vorbis ALmixer ManyMouse Loki … (any many other things no longer used) gcc 4.6 ruby 1.8-1.9 CMake code::Blocks (on Win) https://github.com/godfat/cubeat/

Slide 9

Slide 9 text

Easing Equations Lala (Demo)

Slide 10

Slide 10 text

Easing Equations obj->tween (start, end, time, loop, callback, delay);

Slide 11

Slide 11 text

Easing Equations obj->tween (start, end, time, loop, callback, delay); AnimatorParam anim, anim2; anim.start(s).end(e).time(t); anim2.start(s2).end(e2).time(t2);

Slide 12

Slide 12 text

Easing Equations obj->tween (start, end, time, loop, callback, delay); AnimatorParam anim, anim2; anim.start(s).end(e).time(t); anim2.start(s2).end(e2).time(t2); obj->queue(anim).tween(anim2);

Slide 13

Slide 13 text

Easing Equations obj->tween (start, end, time, loop, callback, delay); AnimatorParam anim, anim2; anim.start(s).end(e).time(t); anim2.start(s2).end(e2).time(t2); obj->queue(anim).tween(anim2); * cubeat-core/include/EasingEquations.hpp * cubeat-core/include/Accessors.hpp * cubeat-core/include/view/Object.hpp * cubeat-core/include/view/detail/CustomAnimator.hpp

Slide 14

Slide 14 text

Custom "dictionary" 'key1': { 'somelist': [-1.1, [14, 15, [3]], 6, 13], 1: '234', 'val': 5 }

Slide 15

Slide 15 text

Custom "dictionary" 'key1': { 'somelist': [-1.1, [14, 15, [3]], 6, 13], 1: '234', 'val': 5 } #comment #number => 1, -1, 1.0, -1.0, 0xfe, -0xfd. #string => 'string', ThisIsAString_Too #map => { ... } #vector => [ ... ] #delim => ,(comma) :(colon)

Slide 16

Slide 16 text

Custom "dictionary" map.V("stafflist").M(1).S("phone");

Slide 17

Slide 17 text

Custom "dictionary" map.V("stafflist").M(1).S("phone"); implies => 'stafflist': [ ... , { 'phone' : 'something', ... }, ... ]

Slide 18

Slide 18 text

Custom "dictionary" map.V("stafflist").M(1).S("phone"); implies => 'stafflist': [ ... , { 'phone' : 'something', ... }, ... ] map = map_any::construct( from_str ); vec = vector_any::construct( from_str );

Slide 19

Slide 19 text

Custom "dictionary" Uses: tr1::unordered_map & std::vector + boost.any boost.algorithm boost.lexical_cast

Slide 20

Slide 20 text

Custom "dictionary" Uses: tr1::unordered_map & std::vector + boost.any boost.algorithm boost.lexical_cast Have often-used std container interfaces

Slide 21

Slide 21 text

Custom "dictionary" Uses: tr1::unordered_map & std::vector + boost.any boost.algorithm boost.lexical_cast Have often-used std container interfaces Very ugly usage of exception when serializing

Slide 22

Slide 22 text

Custom "dictionary" Uses: tr1::unordered_map & std::vector + boost.any boost.algorithm boost.lexical_cast Have often-used std container interfaces Very ugly usage of exception when serializing * cubeat-core/include/utils/dictionary.hpp * cubeat-core/src/utils/dictionary.cpp

Slide 23

Slide 23 text

Overview Libraries Used (with some in-house ones) - especially: Easing Functions & Custom Dictionary Development Issues (that I think is interesting) - AI design & impl - Why game programming is messy - Cross-platform? All (?) the Mistakes (??)

Slide 24

Slide 24 text

AI Design & Impl Problems Started asking around on ptt.cc (Prob_Solve) in 2007.

Slide 25

Slide 25 text

AI Design & Impl Problems Started asking around on ptt.cc (Prob_Solve) in 2007. Dunno how to impl AI strategy for building chains.

Slide 26

Slide 26 text

AI Design & Impl Problems Started asking around on ptt.cc (Prob_Solve) in 2007. Dunno how to impl AI strategy for building chains. Research some kind of patterns? Neural network?? Reinforcement learning??? Genetic algorithm????

Slide 27

Slide 27 text

AI Design & Impl Problems Started asking around on ptt.cc (Prob_Solve) in 2007. Dunno how to impl AI strategy for building chains. Research some kind of patterns? Neural network?? Reinforcement learning??? Genetic algorithm????

Slide 28

Slide 28 text

AI Design & Impl Problems http://kamoland.com/wiki/wiki.cgi?RensaWiki

Slide 29

Slide 29 text

AI Design & Impl Problems http://kamoland.com/wiki/wiki.cgi?RensaWiki Puyopuyo "Rensa" walkthrough site with AI programming competiton !!! ...

Slide 30

Slide 30 text

AI Design & Impl Problems http://kamoland.com/wiki/wiki.cgi?RensaWiki Puyopuyo "Rensa" walkthrough site with AI programming competiton !!! ... And basically, the strongest strategy is just brute-force.

Slide 31

Slide 31 text

AI Design & Impl Problems http://kamoland.com/wiki/wiki.cgi?RensaWiki

Slide 32

Slide 32 text

AI Design & Impl Problems So, let players try the AI.

Slide 33

Slide 33 text

AI Design & Impl Problems So, let players try the AI.

Slide 34

Slide 34 text

AI Design & Impl Problems So, let players try the AI.

Slide 35

Slide 35 text

AI Design & Impl Problems So, let players try the AI. Few people could beat EASY.

Slide 36

Slide 36 text

AI Design & Impl Problems So, let players try the AI. Few people could beat EASY. * made AI even slower, too boring - player learns nothing

Slide 37

Slide 37 text

AI Design & Impl Problems So, let players try the AI. Few people could beat EASY. * made AI even slower, too boring - player learns nothing * occasional "critical hit" - randomness problem - you don't want player get defeated randomly - computer simulated "hand-shaking" - had to make pace feel right to new player

Slide 38

Slide 38 text

AI Design & Impl Problems

Slide 39

Slide 39 text

AI Design & Impl Problems FACT 1 Easy AI is the HARDEST one to get right.

Slide 40

Slide 40 text

AI Design & Impl Problems FACT 1 Easy AI is the HARDEST one to get right. FACT 2 Good enough is good enough.

Slide 41

Slide 41 text

Why Game Programming is Messy (Demo)

Slide 42

Slide 42 text

Why Game Programming is Messy A. Impossible to know what will actually work

Slide 43

Slide 43 text

Why Game Programming is Messy A. Impossible to know what will actually work B. Many things are coupled by nature/design, nothing to do with how you code it

Slide 44

Slide 44 text

Why Game Programming is Messy A. Impossible to know what will actually work B. Many things are coupled by nature/design, nothing to do with how you code it A+B = layers of workarounds, unexpected complexity & bugs/crashes hard to keep code clean

Slide 45

Slide 45 text

Cross-Platform meaning? C/C++ is a portable language.

Slide 46

Slide 46 text

Cross-Platform meaning? C/C++ is a portable language. But use cross-platform libs & tools & getting all the code to compile is only the beginning.

Slide 47

Slide 47 text

Cross-Platform meaning? C/C++ is a portable language. But use cross-platform libs & tools & getting all the code to compile is only the beginning. Some libraries may not be maintained well.

Slide 48

Slide 48 text

Cross-Platform meaning? Deployment & UX adjustments is PITA.

Slide 49

Slide 49 text

Cross-Platform meaning? Deployment & UX adjustments is PITA. - OSX *.app formats

Slide 50

Slide 50 text

Cross-Platform meaning? Deployment & UX adjustments is PITA. - OSX *.app formats - ManyMouse (old) on Linux

Slide 51

Slide 51 text

Cross-Platform meaning? Deployment & UX adjustments is PITA. - OSX *.app formats - ManyMouse (old) on Linux - Android apk filesystem restrictions - etc

Slide 52

Slide 52 text

Cross-Platform meaning? Deployment & UX adjustments is PITA. - OSX *.app formats - ManyMouse (old) on Linux - Android apk filesystem restrictions - etc May be better to focus on 1 platform at a time, but keep code portability at all cost.

Slide 53

Slide 53 text

Overview Libraries Used (with some in-house ones) - especially: Easing Functions & Custom Dictionary Development Issues (that I think is interesting) - AI design & impl - Why game programming is messy - Cross-platform? All (?) the Mistakes (??)

Slide 54

Slide 54 text

All the Mistakes Questionable/Bogus stuff & decisions we had "MVP" Presenter View Model

Slide 55

Slide 55 text

All the Mistakes Questionable/Bogus stuff & decisions we had "MVP" Presenter View Model Presenter bind view's method to model's function object

Slide 56

Slide 56 text

All the Mistakes Questionable/Bogus stuff & decisions we had Well.. why not

Slide 57

Slide 57 text

All the Mistakes Questionable/Bogus stuff & decisions we had Well.. why not View Model

Slide 58

Slide 58 text

All the Mistakes Questionable/Bogus stuff & decisions we had Template setter & getter for view objects: obj->set(vec2(100, 200)).set(128);

Slide 59

Slide 59 text

All the Mistakes Questionable/Bogus stuff & decisions we had Template setter & getter for view objects: obj->set(vec2(100, 200)).set(128); And because it looks cool: obj->onPress(button) = bind(function, ...);

Slide 60

Slide 60 text

All the Mistakes Questionable/Bogus stuff & decisions we had Pre-processed C++ source/header

Slide 61

Slide 61 text

All the Mistakes Questionable/Bogus stuff & decisions we had Pre-processed C++ source/header Using eruby (erb-like) to proc. embedded ruby

Slide 62

Slide 62 text

All the Mistakes Questionable/Bogus stuff & decisions we had Pre-processed C++ source/header Using eruby (erb-like) to proc. embedded ruby Model.cpp.eruby -> preprocess -> Model.cpp

Slide 63

Slide 63 text

All the Mistakes Questionable/Bogus stuff & decisions we had Pre-processed C++ source/header Using eruby (erb-like) to proc. embedded ruby Model.cpp.eruby -> preprocess -> Model.cpp Debug hooks Auto #ifndef #define #endif block for headers Generate property getter/setters. Expand Boost.object_pool signatures.

Slide 64

Slide 64 text

All the Mistakes Questionable/Bogus stuff & decisions we had "Multiple-View System"

Slide 65

Slide 65 text

All the Mistakes Questionable/Bogus stuff & decisions we had "Multiple-View System" There was a time when 2D/3D switches seemed cool to us.

Slide 66

Slide 66 text

All the Mistakes Questionable/Bogus stuff & decisions we had "Multiple-View System" There was a time when 2D/3D switches seemed cool to us. And we also thought maybe we need multiple view presentations.

Slide 67

Slide 67 text

All the Mistakes Questionable/Bogus stuff & decisions we had

Slide 68

Slide 68 text

All the Mistakes Questionable/Bogus stuff & decisions we had

Slide 69

Slide 69 text

All the Mistakes Questionable/Bogus stuff & decisions we had "Multiple-View System" void go_exploding(int color_id){ BOOST_FOREACH(pViewBase& view, view_slaves_){ if(view) view->go_exploding(color_id); } view_master_->go_exploding(color_id); }

Slide 70

Slide 70 text

All the Mistakes Questionable/Bogus stuff & decisions we had "Multiple-View System" void go_exploding(int color_id){ BOOST_FOREACH(pViewBase& view, view_slaves_){ if(view) view->go_exploding(color_id); } view_master_->go_exploding(color_id); } It hasn't been utilitzed. ....Yet.

Slide 71

Slide 71 text

All the Mistakes Questionable/Bogus stuff & decisions we had

Slide 72

Slide 72 text

All the Mistakes Questionable/Bogus stuff & decisions we had Read the book already even before we started, clearly that was not enough.

Slide 73

Slide 73 text

All the Mistakes Questionable/Bogus stuff & decisions we had Read the book already even before we started, clearly that was not enough. The last 10% need 90% time,

Slide 74

Slide 74 text

All the Mistakes Questionable/Bogus stuff & decisions we had Read the book already even before we started, clearly that was not enough. The last 10% need 90% time, and it is recursively true.

Slide 75

Slide 75 text

All the Mistakes Questionable/Bogus stuff & decisions we had Biggest Mistake:

Slide 76

Slide 76 text

All the Mistakes Questionable/Bogus stuff & decisions we had Biggest Mistake: The game isn't out yet.

Slide 77

Slide 77 text

All the Mistakes Questionable/Bogus stuff & decisions we had Biggest Mistake: The game isn't out yet. (hopefully we can get it done before Spring is out, but Spring includes May... hmmm)

Slide 78

Slide 78 text

Thank you for listening! Q & A [email protected] gplus.to/jslin johnson_lin @ plurk