ãžã§ããã¬ãã·ã³ã°ç¬èªã®C ++ã²ãŒã ãšã³ãžã³ãæžãæ¹æ³ ã
C ++ã§ç¬èªã®ã²ãŒã ãšã³ãžã³ãäœæããæ¹æ³
æè¿ãç§ã¯C ++ã§ã²ãŒã ãšã³ãžã³ãæžãã®ã«å¿ããã§ãã ããã䜿ã£ãŠãå°ããªã¢ãã€ã«ã²ãŒã Hop OutãäœæããŸãã ãããç§ã®iPhone 6ããé²ç»ããããããªã§ãïŒãµãŠã³ãããªã³ã«ã§ããŸãïŒïŒ
Hop Outã¯ãèªåã§ãã¬ã€ãããã²ãŒã ã§ãã挫ç»ã®ãããª3Dã°ã©ãã£ãã¯ãåããã¬ãããªã¢ãŒã±ãŒãã²ãŒã ã§ãã ã²ãŒã ã®ç®æšã¯ãQ * Bertã®ããã«ãåãã©ãããã©ãŒã ãå¡ãçŽãããšã§ãã
Hop Outã¯ãŸã éçºäžã§ããããããé§åãããšã³ãžã³ã¯æçãã圢ã«ãªãå§ããŠããã®ã§ãããã§ãšã³ãžã³ã®éçºã«é¢ããããã€ãã®ãã³ããå ±æããããšã«ããŸããã
ãªã誰ããã²ãŒã ãšã³ãžã³ãæžãããã®ã§ããããïŒ èããããå€ãã®çç±ããããŸãã
- ããªãã¯è·äººã§ãã ã·ã¹ãã ããŒãããæ§ç¯ããŠãã·ã¹ãã ãã©ã®ããã«æ©èœãããã確èªããã®ã奜ãã§ãã
- ã²ãŒã éçºã«ã€ããŠãã£ãšç¥ãããã ç§ã¯ã²ãŒã æ¥çã«14幎éæºãã£ãŠããŸããããŸã 解æããããšããŠããŸãã ãšã³ãžã³ããŒãããæžãããšãã§ãããã©ãããã確信ã§ããŸããã§ããããªããªããããã¯å€§èŠæš¡ãªã¹ã¿ãžãªã®ããã°ã©ããŒã®æ¥ã ã®ä»äºã®è²¬ä»»ãšã¯éåžžã«ç°ãªãããã§ãã ãã§ãã¯ãããã£ãã
- ããªãã¯ã³ã³ãããŒã«ã®æèŠã奜ãã§ãã æã¿ã©ããã«ã³ãŒããæŽçãããã¹ãŠãã©ãã«ããããåžžã«ææ¡ããã®ã¯æ¥œããã§ãã
- AGIïŒ1984ïŒãid Tech 1ïŒ1993ïŒãBuildïŒ1995ïŒãªã©ã®å€å žçãªã²ãŒã ãšã³ãžã³ãããã³UnityãUnrealãªã©ã®æ¥çã®å·šäººã«è§ŠçºãããŠããŸãã
- ã²ãŒã æ¥çã§ããç§ãã¡ã¯ããšã³ãžã³ã®éçºããè¬ã解ãæŸããªããã°ãªããªããšä¿¡ããŠããŸããã ã²ãŒã éçºã®æè¡ããŸã ãã¹ã¿ãŒããŠããŸããã ãã®ããã»ã¹ã培åºçã«èª¿æ»ããã°ããã»ã©ãæ¹åã®å¯èœæ§ãé«ããªããŸãã
2017幎ã®ã²ãŒã ãã©ãããã©ãŒã ïŒã¢ãã€ã«ãã³ã³ãœãŒã«ãPCïŒã¯éåžžã«åŒ·åã§ãããå€ãã®ç¹ã§äºãã«é¡äŒŒããŠããŸãã ã²ãŒã ãšã³ãžã³ã®éçºã¯ãéå»ãšåæ§ã«ã匱ããŠåžå°ãªéãšã®éãã§ãªããªããŸããã ç§ã®æèŠã§ã¯ãããã¯ããªãèªèº«ã®ä»äºã®è€éããšã®éäºã®å€ãã§ãã ã¢ã³ã¹ã¿ãŒãç°¡åã«äœæã§ããŸãïŒ ãã®ããããã®èšäºã®ãã¹ãŠã®ãã³ãã¯ãã³ãŒãã管çããããããæ¹æ³ãäžå¿ã«å±éããŠããŸãã ãããã3ã€ã®ã°ã«ãŒãã«çµåããŸããã
- å埩ã¢ãããŒãã䜿çšãã
- äžè¬åããåã«ããèããŠãã ãã
- ã·ãªã¢ã«åã¯åºç¯ãªãããã¯ã§ããããšãèªèããŠãã ããã
ãããã®ãã³ãã¯ããã¹ãŠã®ã²ãŒã ãšã³ãžã³ã«é©çšãããŸãã ã·ã§ãŒããŒã®èšè¿°æ¹æ³ãoctreeããªãŒãšã¯äœããç©çåŠã®è¿œå æ¹æ³ã«ã€ããŠã¯èª¬æããŸããã ãããç¥ã£ãŠããã¹ãã ãšããããšã¯æ¢ã«ç¥ã£ãŠãããšæããŸãããããŠããããã®ãããã¯ã¯ãããªããäœãããã²ãŒã ã®ã¿ã€ãã«å€ãã®ç¹ã§äŸåããŠããŸãã 代ããã«ãåºãã«ããŒãããŠããªããããã¯ãæ éã«éžæããŸãã-äœãã«å¯Ÿããç§å¯ã®ããŒã«ãç Žãããšãããšãã«æãèå³æ·±ããšæããããã¯ã
å埩ã¢ãããŒãã䜿çšãã
ç§ã®æåã®ã¢ããã€ã¹ã¯ãäœãïŒäœã§ãïŒåäœãããã«ãç¹°ãè¿ããŸãã
å¯èœã§ããã°ãããã€ã¹ãåæåããŠç»é¢ã«äœããæç»ãããµã³ãã«ã¢ããªã±ãŒã·ã§ã³ããå§ããŸãã ãã®å Žåã SDLãããŠã³ããŒããã Xcode-iOS/Test/TestiPhoneOS.xcodeproj
ãiPhoneã§testgles2
ãµã³ãã«ãèµ·åãtestgles2
ã
åºæ¥äžããïŒ OpenGL ES 2.0ã䜿çšããŠããã°ãããå転ãã¥ãŒããåŸãŸããã
次ã®ã¹ãããã¯ã誰ããäœã£ãããªãªã®3Dã¢ãã«ãããŠã³ããŒãããããšã§ããã ç§ã¯ããã«OBJãã¡ã€ã«ã®ã©ãããŠã³ããŒããŒãäœæããŸããïŒãã®åœ¢åŒã¯ããã»ã©è€éã§ã¯ãããŸããïŒããµã³ãã«ã調æŽããŠããã¥ãŒãã§ã¯ãªãããªãªãæç»ããŸããã ãŸãããã¯ã¹ãã£ãããŒãããããã«SDL_Imageãçµ±åããŸããã
次ã«ã2ã€ã®ã¹ãã£ãã¯ç®¡çãå®è£ ããŠããªãªãåãããŸããã ïŒæåã¯ããã¥ã¢ã«ã¹ãã£ãã¯ã·ã¥ãŒã¿ãŒãäœæãããšããã¢ã€ãã¢ãæ€èšããŸããããã ããããªãªã§ã¯ããã§ã¯ãããŸããã§ããïŒã
次ã«éªšæ Œã¢ãã¡ãŒã·ã§ã³ã«ç²Ÿéãããã£ãã®ã§ã Blenderãéãã觊æã®ã¢ãã«ãäœæããããã«æºãåã2ã€ã®ããŒã³ã®ã¹ã±ã«ãã³ãã¢ã¿ããããŸããã
ãã®æãŸã§ã«ãç§ã¯OBJ圢åŒãæŸæ£ããBlenderããèªåã®JSONãã¡ã€ã«ããšã¯ã¹ããŒãããPythonã¹ã¯ãªãããæžããŸããã ãããã®JSONãã¡ã€ã«ã«ã¯ãã¹ãã³ã¡ãã·ã¥ãã¹ã±ã«ãã³ãããã³ã¢ãã¡ãŒã·ã§ã³ããŒã¿ãèšè¿°ãããŠããŸããã C ++ JSONã©ã€ãã©ãªã䜿çšããŠããããã®ãã¡ã€ã«ãã²ãŒã ã«ããŒãããŸããã
ãã¹ãŠãããŸããã£ããšããã«ãç§ã¯Blenderã«æ»ãããã粟巧ãªãã£ã©ã¯ã¿ãŒãäœæããŸããïŒããã¯ç§ãäœæãã¹ãã£ã³ãã«ããæåã®3次å ã®äººç©ã§ããã
次ã®æ°ãæã«ããã£ãŠãç§ã¯æ¬¡ã®æé ãå®è¡ããŸããã
- 圌ã¯ãç¬èªã®3次å æ°åŠã©ã€ãã©ãªã§ãã¯ãã«ãšè¡åãæäœããæ©èœãåé¢ãå§ããŸããã
-
.xcodeproj
ãCMakeãããžã§ã¯ãã«çœ®ãæããŸãã - Visual Studioã§äœæ¥ããã®ã奜ããªã®ã§ããšã³ãžã³ãWindowsãšiOSã®äž¡æ¹ã§å®è¡ããŸããã
- 圌ã¯ã³ãŒããå¥ã®ã©ã€ãã©ãªããšã³ãžã³ããšãã²ãŒã ãã«ç§»åãå§ããŸããã æéãçµã€ã«ã€ããŠãç§ã¯ããããããã«å°ããªã©ã€ãã©ãªã«åå²ããŸããã
- JSONãã¡ã€ã«ããã²ãŒã ãçŽæ¥ããŠã³ããŒãã§ãããã€ããªããŒã¿ã«å€æããå¥ã®ã¢ããªã±ãŒã·ã§ã³ãäœæããŸããã
- ããæç¹ã§ãiOSãã«ããããã¹ãŠã®SDLã©ã€ãã©ãªãåé€ããŸããã ïŒWindowsçšã®ãã«ãã§ã¯ãåŒãç¶ãSDLã䜿çšãããŸããïŒ
éèŠãªç¹ã¯ããã§ãã ããã°ã©ãã³ã°ãéå§ããåã«ããšã³ãžã³ã®ã¢ãŒããã¯ãã£ãèšç»ããŠããŸããã§ãã ã ããã¯æèçãªéžæã§ããã 代ããã«ãæ©èœã®æ¬¡ã®éšåãå®è£ ããå¯èœãªéãåçŽãªã³ãŒããäœæãããããèŠãŠãã©ã®ã¢ãŒããã¯ãã£ãèªç¶ã«çºçãããã確èªããŸããã ããšã³ãžã³ã¢ãŒããã¯ãã£ããšã¯ãã²ãŒã ãšã³ãžã³ãæ§æããäžé£ã®ã¢ãžã¥ãŒã«ããããã®ã¢ãžã¥ãŒã«éã®äŸåé¢ä¿ãããã³åã¢ãžã¥ãŒã«ãšå¯Ÿè©±ããããã®APIãæå³ããŸãã
ãã®ã¢ãããŒãã¯ãå°ããªå®çšçãªçµæã«çŠç¹ãåãããŠããããã å埩çã§ãã ã²ãŒã ãšã³ãžã³ãäœæããå Žåããã¹ãŠã®ã¹ãããã§åäœããããã°ã©ã ããããããããŸãæ©èœããŸãã æ°ããã¢ãžã¥ãŒã«å ã®ã³ãŒãã匷調衚瀺ãããšãã«äœãåé¡ãçºçããå Žåã¯ããã€ã§ãåäœããŠããã³ãŒããšå€æŽãæ¯èŒã§ããŸãã ãã¡ãããããªãã¯äœããã®ããŒãžã§ã³ç®¡çã·ã¹ãã ã䜿çšããŠãããšæããŸãã
ãã®ã¢ãããŒãã§ã¯ãåžžã«æªãã³ãŒããæžãã®ã§ãå€ãã®æéã浪費ãããŠããããã«èŠãããããããŸããã ããããã»ãšãã©ã®å€æŽã¯ãã³ãŒãããã.cpp
ãã¡ã€ã«ããå¥ã®.cpp
ãã¡ã€ã«ã«ç§»åããé¢æ°å®çŸ©ã.h
ãã¡ã€ã«ã«æœåºããããä»ã®åæ§ã«åçŽãªã¢ã¯ã·ã§ã³ã§ãã ã©ãã«ããã¹ãããå€æããããšã¯é£ããäœæ¥ã§ãããã³ãŒããæ¢ã«ååšããå Žåã¯ããã解決ããã®ã¯ç°¡åã§ãã
ç§ã¯ãå察ã®ã¢ãããŒãã§ããå€ãã®æéãè²»ããããŠãããšç¢ºä¿¡ããŠããŸãïŒå¿ èŠãªãã¹ãŠãè¡ãã¢ãŒããã¯ãã£ãäºåã«èããããšããããšã ãªãŒããŒãšã³ãžãã¢ãªã³ã°ã®å±éºæ§ã«ã€ããŠã®ç§ã®ãæ°ã«å ¥ãã®èšäºã®2ã€ã¯ã äžè¬åã®æªåŸªç°ããã¹ã»ããããŠã¹ããŒãšå»ºç¯å®å®é£è¡å£«ãæãããããžã§ãšã«ã»ã¹ãã«ã¹ããŒã§ãã
ã³ãŒãã§åé¡ã«åºãããåã«ãçŽã®åé¡ã解決ãã¹ãã§ã¯ãªããšèšã£ãŠããã®ã§ã¯ãããŸããã ãŸããå¿ èŠãªæ©èœãäºåã«æ±ºå®ããŠã¯ãªããªããšãã䞻匵ãããŠããŸããã ããšãã°ãæåããããšã³ãžã³ããã¹ãŠã®ãªãœãŒã¹ãããã¯ã°ã©ãŠã³ãã¹ã¬ããã«ããŒãããããšãç¥ã£ãŠããŸããã ãšã³ãžã³ãå°ãªããšãããã€ãã®ãªãœãŒã¹ã®èªã¿èŸŒã¿ãéå§ãããŸã§ããã®æ©èœãèšèšãŸãã¯å®è£ ããããšããªãã£ããšããã ãã§ãã
å埩çãªã¢ãããŒãã«ãããçœçŽã®çŽãèŠãŠæ³åãããããã¯ããã«ãšã¬ã¬ã³ããªã¢ãŒããã¯ãã£ãåŸãããŸããã ä»æ¥ã®ç§ã®ãšã³ãžã³ã®iOSãã«ãã¯ãç¬èªã®æ°åŠã©ã€ãã©ãªãã³ã³ãããã³ãã¬ãŒãããªãã¬ã¯ã·ã§ã³/ã·ãªã¢ã«åã·ã¹ãã ãã¬ã³ããªã³ã°ãã¬ãŒã ã¯ãŒã¯ãç©çåŠããªãŒãã£ãªãããµãŒãå«ã100ïŒ ãªãªãžãã«ã³ãŒãã§ãã ãããã®åã¢ãžã¥ãŒã«ãèªåã§äœæããçç±ããããŸããããããã¯å¿ èŠã§ã¯ãªããããããŸããã 代ããã«ããšã³ãžã³ã«é©ããã©ã€ã»ã³ã¹èš±å¯ãæã€åªãããªãŒãã³ãœãŒã¹ã©ã€ãã©ãªããããããããŸãã GLM ã Bullet Physics ãããã³STBããããŒã¯ãèå³æ·±ãäŸã®ã»ãã®äžéšã§ãã
äžè¬åããåã«ããèããŠãã ãã
ããã°ã©ããŒãšããŠãç§ãã¡ã¯ã³ãŒãã®éè€ãé¿ããããåªããŠãããã³ãŒããå ±éã®ã¹ã¿ã€ã«ã«åŸãå Žåã«ããã奜ãã§ãã ãã ãããããã®æ¬èœããã¹ãŠã®æ±ºå®ãå¶åŸ¡ããªãããã«ããããšã¯æçã ãšæããŸãã
æã DRYååãç Žã
äŸãæããŸãããïŒç§ã®ãšã³ãžã³ã«ã¯ã std::shared_ptr
䌌ãã¹ããŒããã€ã³ã¿ãŒã®ãã³ãã¬ãŒãã¯ã©ã¹ãããã€ãå«ãŸããŠããŸãã ãããã¯ãããããçã®ãã€ã³ã¿ã®ã©ãããŒãšããŠæ©èœããããšã«ãããã¡ã¢ãªãªãŒã¯ãåé¿ããã®ã«åœ¹ç«ã¡ãŸãã
- åäžã®ææè
ãæã€åçã«å²ãåœãŠããããªããžã§ã¯ãã®
Owned<>
ã -
Reference<>
ã¯ãåç §ã«ãŠã³ãã䜿çšããŠããªããžã§ã¯ããè€æ°ã®ææè ãæã€ããšãèš±å¯ããŸãã -
audio::AppOwned<>
ããªãŒãã£ãªãããµãŒã®å€éšã®ã³ãŒãã§äœ¿çšãããŸãã ããã«ãããã²ãŒã ã·ã¹ãã ã¯ãçŸåšåçäžã®é³å£°ãªã©ããªãŒãã£ãªãããµãŒã䜿çšãããªããžã§ã¯ããææã§ããŸãã -
audio::AudioHandle<>
ã¯ããªãŒãã£ãªãããµãŒå éšã®åç §ã«ãŠã³ãã·ã¹ãã ã䜿çšããŸãã
ãããã®ã¯ã©ã¹ã®äžéšã¯ãDRYã®ååã«éåããŠãä»ã®ã¯ã©ã¹ã®æ©èœãè€è£œããŠããããã«èŠãããããããŸããã å®éãéçºã®æåã«ãæ¢åã®Reference<>
ã¯ã©ã¹ãå¯èœãªéãåå©çšããããšããŸããã ãããããªãŒãã£ãªãªããžã§ã¯ãã®ã©ã€ãã¿ã€ã ã¯ç¹å¥ãªã«ãŒã«ã«åŸãããšãããããŸããããªããžã§ã¯ãããã©ã°ã¡ã³ãã®åçãçµäºããã²ãŒã ããã®ãªããžã§ã¯ããžã®ãã€ã³ã¿ãææããŠããªãå Žåãããã«åé€ãã¥ãŒã«å
¥ããããšãã§ããŸãã ã²ãŒã ããã€ã³ã¿ãŒãã€ããã å ŽåããªãŒãã£ãªãªããžã§ã¯ããåé€ããªãã§ãã ããã ãããŠãã²ãŒã ããã€ã³ã¿ãŒããã£ããã£ããããåçãçµäºããåã«ãã€ã³ã¿ãŒã®ææè
ãç Žå£ãããå Žåããã£ã³ã»ã«ããå¿
èŠããããŸãã Reference<>
ãè€éã«ãã代ããã«ãåå¥ã®ãã³ãã¬ãŒãã¯ã©ã¹ãå°å
¥ããæ¹ãå®çšçã§ãããšå€æããŸããã
95ïŒ ã®æéãæ¢åã®ã³ãŒããåå©çšããã®ãæ£ããæ¹æ³ã§ãã ãããããããããªããçžãå§ãããããã€ãŠç°¡åã ã£ããã®ãè€éã«ããŠããããšã«æ°ä»ããããèªåããŠã¿ãŠãã ããïŒã³ãŒãããŒã¹ã®ãã®éšåã¯æ¬åœã«2ã€ã«åå²ãããã¹ãã§ããïŒ
ç°ãªãåŒã³åºãèŠçŽã䜿çšããããšã¯åé¡ãããŸãã
Javaã奜ãã§ã¯ãªãããšã®1ã€ã¯ãã¯ã©ã¹å ã®ãã¹ãŠã®é¢æ°ã匷å¶çã«å®çŸ©ããããšã§ãã ç§ã®æèŠã§ã¯ãããã¯ç¡æå³ã§ãã ããã«ãããã³ãŒãã®å€èŠ³ãããäžè²«ãããã®ã«ãªãå¯èœæ§ããããŸãããéå°ãªè€éããå©é·ããåè¿°ã®å埩ã¢ãããŒãããµããŒãããŸããã
ç§ã®C ++ãšã³ãžã³ã§ã¯ãäžéšã®é¢æ°ã¯ã¯ã©ã¹ã«å±ããäžéšã¯å±ããŠããŸããã ããšãã°ãã²ãŒã å
ã®å察æŠçžæã¯ã¯ã©ã¹ã§ããã察æŠçžæã®åäœã®ã»ãšãã©ã¯ãäºæ³ãããããã«ãã®ã¯ã©ã¹ã§å®è£
ãããŸãã äžæ¹ãç§ã®ãšã³ãžã³ã§ã®ã¹ãã£ã¢ãã£ã¹ãã¯ã physics
ããŒã ã¹ããŒã¹ã®é¢æ°ã§ããsphereCast()
åŒã³åºãããšã§å®è¡ãããŸãã sphereCast()
ã¯ã©ã®ã¯ã©ã¹ã«ãå±ããŸãã-ããã¯physics
ã¢ãžã¥ãŒã«ã®äžéšã«ãããŸããã ã¢ãžã¥ãŒã«éã®äŸåé¢ä¿ã管çãããã«ãã·ã¹ãã ããããã³ãŒããé©åã«æŽçãããŠããŸãïŒç§ã«ãšã£ãŠïŒã ãã®é¢æ°ãä»»æã®ã¯ã©ã¹ã«ã©ããããŠããã³ãŒãã®æ§æã¯æ¹åãããŸããã
ãŸãã ããªã¢ãŒãã£ãºã ã®äžåœ¢æ ã§ããåçãã£ã¹ãããããããŸãã å€ãã®å Žåããã®ãªããžã§ã¯ãã®æ£ç¢ºãªã¿ã€ããç¥ããã«ãªããžã§ã¯ãã®é¢æ°ãåŒã³åºãå¿ èŠããããŸãã C ++ããã°ã©ããŒã®æåã®è¡åã¯ãä»®æ³é¢æ°ã§æœè±¡åºæ¬ã¯ã©ã¹ãå®çŸ©ãã掟çã¯ã©ã¹ã§ãããã®é¢æ°ããªãŒããŒããŒãããããšã§ãã åäœããŸãããããã¯ãã¯ããã¯ã®1ã€ã«ãããŸããã ããã»ã©å€ãã®äœåãªã³ãŒãããããããªãããŸãã¯ä»ã®å©ç¹ãããä»ã®åçãã£ã¹ãããã¡ãœããããããŸãã
- C ++ 11ã§ã¯
std::function
å°å ¥ãããããã¯ã³ãŒã«ããã¯é¢æ°ãä¿åãã䟿å©ãªæ¹æ³ã§ãã ãŸããç¬èªã®ããŒãžã§ã³ã®std::function
ãèšè¿°ããããšãã§ããŸããããã¯ããããã¬ãŒã§èµ·åããŠãããã»ã©èŠçãåŒãèµ·ãããŸããã - å€ãã®ã³ãŒã«ããã¯é¢æ°ã¯ã1察ã®ãã€ã³ã¿ãŒïŒé¢æ°ãžã®ãã€ã³ã¿ãŒãšäžéæãªåŒæ°ïŒã䜿çšããŠå®è£ ã§ããŸãã ã³ãŒã«ããã¯é¢æ°å ã®æ瀺çãªãã£ã¹ãã®ã¿ãå¿ èŠã§ãã ããã¯ãå€ãã®å ŽåãçŽç²ãªCã©ã€ãã©ãªã«ãããŸãã
- ã³ã³ãã€ã«æã«ããŒã¹åãããã£ãŠããå Žåããããã©ã³ã¿ã€ã ã«ãªãŒããŒããããªãã§é¢æ°åŒã³åºãããã€ã³ãã§ããŸãã Turf-ã²ãŒã ãšã³ãžã³ã§äœ¿çšããã©ã€ãã©ãªã¯ããã®ã¡ãœããã«å€§ããäŸåããŠããŸãã äŸãšããŠ
turf::Mutex
ãturf::Mutex
ãã ããã ããã¯ãåã«ãã©ãããã©ãŒã åºæã®ã¯ã©ã¹ã«å¯Ÿããtypedef
ã§ãã - æãçŽæ¥çãªæ¹æ³ã¯ãçã®é¢æ°ãã€ã³ã¿ã®ããŒãã«ãèªåã§äœæããŠç¶æããããšã§ãã ç§ã¯ãªãŒãã£ãªãããµãŒãšã·ãªã¢ã«åã·ã¹ãã ã§ãã®ã¢ãããŒãã䜿çšããŸããã 以äžã«ç€ºãããã«ãPythonã€ã³ã¿ãŒããªã¿ãŒããã®ææ³ãæ倧éã«æŽ»çšããŸãã
- é¢æ°åãããŒãšããŠäœ¿çšããŠãé¢æ°ãã€ã³ã¿ãŒãããã·ã¥ããŒãã«ã«æ ŒçŽããããšãã§ããŸãã ãã®ææ³ã䜿çšããŠããã«ãã¿ããã€ãã³ããªã©ã®å ¥åã€ãã³ãããã£ã¹ãããããŸãã ããã¯ãã²ãŒã å ¥åãèšé²ãããªãã¬ã€ã·ã¹ãã ã§ãã¬ã€ããããã®æŠç¥ã®äžéšã§ãã
åçã¹ã±ãžã¥ãŒãªã³ã°ã¯åºç¯ãªãããã¯ã§ãã å®è£
ã®æ¹æ³ãããã€ãããã瀺ãããã«ãç§ã¯ããã«ã€ããŠè¡šé¢çã«è©±ããŸããã ããªããæžããã䌞瞮æ§ã®ããäœã¬ãã«ã®ã³ãŒã-ã²ãŒã ãšã³ãžã³ã«ãšã£ãŠçããããšã§ã¯ãããŸãã-ã¯ãããå€ãã®å Žåã代æ¿æ段ãå匷ããŠããããšã«æ°ã¥ããŸãã ãã®ãããªããã°ã©ãã³ã°ã«æ
£ããŠããªãå Žåã¯ãCã§æžãããPythonã€ã³ã¿ãŒããªã¿ãŒãåŠã¶ã®ã«æé©ãªäŸã§ãã 匷åãªãªããžã§ã¯ãã¢ãã«ãå®è£
ããŸããåPyObject
ã¯PyTypeObject
æããåPyTypeObjet
ã¯åçãã£ã¹ãããçšã®é¢æ°ãã€ã³ã¿ãŒã®ããŒãã«ãå«ãŸããŠããŸãã 詳现ã詳ããç¥ãããå Žåã¯ã æ°ããã¿ã€ãã®å®çŸ©ããã¥ã¡ã³ããåºçºç¹ãšããŠé©ããŠããŸãã
ã·ãªã¢ã«åã¯åºç¯ãªãããã¯ã§ããããšãèªèããŠãã ããã
ã·ãªã¢ã«åãšã¯ãã©ã³ã¿ã€ã ãªããžã§ã¯ãããã€ãã·ãŒã±ã³ã¹ã«ããŸãã¯ãã®éã«å€æããããšã§ãã ã€ãŸããããŒã¿ã®ä¿åãšèªã¿èŸŒã¿ã
ã»ãšãã©ã®ãšã³ãžã³ã§ã¯ãªãã«ããŠããå€ãã®å Žåãã²ãŒã ã³ã³ãã³ãã¯.png
ã .json
ã .blend
ãŸãã¯ç¬èªã®åœ¢åŒãªã©ã®ããŸããŸãªç·šéå¯èœãªåœ¢åŒã§äœæãããæçµçã«ãšã³ãžã³åºæã®ã²ãŒã 圢åŒã«å€æããããšã³ãžã³ããã°ããèªã¿èŸŒãããšãã§ããŸãã ãã®ããã»ã¹ã®æåŸã®ã¢ããªã±ãŒã·ã§ã³ã¯ããã°ãã°ãã¯ãã«ãŒããšåŒã°ããŸãã ã¯ãã«ãŒã¯å¥ã®ããŒã«ã«çµ±åããããšããè€æ°ã®ãã·ã³ã«åæ£ããããšãã§ããŸãã éåžžãã¯ãã«ãŒãšããã€ãã®ããŒã«ã¯ãã²ãŒã ãšã³ãžã³èªäœãšé£æºããŠéçºããã³ä¿å®ãããŸãã
ãã®ãããªãã€ãã©ã€ã³ãæºåãããšããå段éã§ã®ãã¡ã€ã«åœ¢åŒã®éžæã¯ããªã次第ã§ãã ããã€ãã®ãã€ãã£ã圢åŒãå®çŸ©ã§ãããšã³ãžã³ã«æ©èœãè¿œå ããã«ã€ããŠé²åã§ããŸãã ããããé²åããã«ã€ããŠã以åã«ä¿åãããã¡ã€ã«ãšäžéšã®ããã°ã©ã ã®äºææ§ãç¶æããå¿ èŠãããå ŽåããããŸãã ã©ã®åœ¢åŒã§ãã£ãŠããæçµçã«ã¯C ++ã§ã·ãªã¢ã«åããå¿ èŠããããŸãã
C ++ã§ã·ãªã¢ã«åããæ¹æ³ã¯ç¡æ°ã«ãããŸãã ããªãæçœãªãã®ã®1ã€ã¯ãã·ãªã¢ã«åããã¯ã©ã¹ã«save
ããã³load
é¢æ°ãè¿œå ããããšã§ãã ããŒãžã§ã³çªå·ããã¡ã€ã«ããããŒã«ä¿åãããã®çªå·ãåload
é¢æ°ã«æž¡ãããšã«ãããäžäœäºææ§ãå®çŸã§ããŸãã ããã¯æ©èœããŸãããã³ãŒãã¯é¢åã«ãªããŸãã
void load(InStream& in, u32 fileVersion) { // - in >> m_position; in >> m_direction; // 2. if (fileVersion >= 2) { in >> m_velocity; } }
ãªãã¬ã¯ã·ã§ã³ãå©çšããŠãã€ãŸããC ++åã®å Žæãèšè¿°ããå®è¡æããŒã¿ãäœæããããšã«ãããããæè»ã§ãšã©ãŒã®å°ãªãã·ãªã¢ã«åã³ãŒããäœæã§ããŸãã ãªãã¬ã¯ã·ã§ã³ãã·ãªã¢ã«åã«ã©ã®ããã«åœ¹ç«ã€ããç°¡åã«ç解ããã«ã¯ããªãŒãã³ãœãŒã¹ãããžã§ã¯ãã§ããBlenderãã©ã®ããã«ãããè¡ãããèŠãŠãã ããã
ãœãŒã¹ããBlenderããã«ããããšãå€ãã®æé ãå®è¡ãããŸãã æåã«ãç¬èªã®makesdna
ãŠãŒãã£ãªãã£ãã³ã³ãã€ã«ããã³å®è¡ãããŸãã ãã®ãŠãŒãã£ãªãã£ã¯ãBlenderãœãŒã¹ããªãŒã®CããããŒãã¡ã€ã«ã®ã»ããã解æããå®çŸ©ããããã¹ãŠã®ã¿ã€ãã®ç°¡åãªèŠçŽãSDNAãšåŒã°ããç¬èªã®åœ¢åŒã§è¡šç€ºããŸãã ãããã®SDNAããŒã¿ã¯ã ãªãã¬ã¯ã·ã§ã³ããŒã¿ãšããŠæ©èœããŸã ã ãã®åŸãSDNAã¯Blenderèªäœã§ã³ã³ãã€ã«ãããBlenderãæžã蟌ããã¹ãŠã®.blend
ãã¡ã€ã«ãšãšãã«ä¿åãããŸãã ãã以éãBlenderã¯.blend
ãã¡ã€ã«ãããŒããããã³ã«ãSDNA .blend
ãã¡ã€ã«ãå®è¡æã«çŸåšã®ããŒãžã§ã³ã«ãªã³ã¯ãããSDNAãšæ¯èŒããå
±éã®ã·ãªã¢ã«åã³ãŒãã䜿çšããŠãã¹ãŠã®éããåŠçããŸãã ãã®æŠç¥ã¯ãBlenderã«åŸæ¹ããã³åæ¹äºææ§ã®å°è±¡çãªç¯å²ãäžããŸãã Blenderã®ææ°ããŒãžã§ã³ã§ã¯ããŒãžã§ã³1.0ãã¡ã€ã«ãã¢ããããŒãã§ããŸãããå€ãããŒãžã§ã³ã§ã¯æ°ãã.blend
ãã¡ã€ã«ãã¢ããããŒãã§ããŸãã
Blenderãšåæ§ã«ãå€ãã®ã²ãŒã ãšã³ãžã³ïŒããã³é¢é£ããŒã«ïŒã¯ãç¬èªã®ãªãã¬ã¯ã·ã§ã³ããŒã¿ãäœæããŠäœ¿çšããŸãã ãããè¡ãã«ã¯å€ãã®æ¹æ³ããããŸããBlenderãšåæ§ã«ãç¬èªã®C / C ++ãœãŒã¹ã³ãŒãã解æããŠåæ å ±ãæœåºã§ããŸãã åå¥ã®ããŒã¿èšè¿°èšèªãäœæãããã®èšèªããåèšè¿°ãšC ++ãªãã¬ã¯ã·ã§ã³ããŒã¿ãçæããããŒã«ãäœæã§ããŸãã ããªããã»ããµãã¯ããšC ++ãã³ãã¬ãŒãã䜿çšããŠãå®è¡æã«ãªãã¬ã¯ã·ã§ã³ããŒã¿ãçæã§ããŸãã ãããŠãåå°ããŒã¿ãæå ã«çŸãããšããã«ããã®äžã«æ±çšã·ãªã¢ã©ã€ã¶ãŒãæžãããã®ç¡æ°ã®æ¹æ³ãéãããŸãã
確ãã«ãç§ã¯å€ãã®è©³çŽ°ãèŠéããŠããŸãã ãã®èšäºã§ã¯ãããŒã¿ãã·ãªã¢ã«åããå€ãã®æ¹æ³ãããããã®ãã¡ã®ããã€ãã¯éåžžã«è€éã§ããããšã瀺ãããã£ãã ãã§ãã ããã°ã©ãã¯ãä»ã®ã»ãšãã©ã®ã·ã¹ãã ãã·ãªã¢ã«åã«äŸåããŠããå Žåã§ããä»ã®ãšã³ãžã³ã·ã¹ãã ã»ã©ã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ã«ã€ããŠè°è«ããŸããã ããšãã°ã96ã®GDC 2017ããã°ã©ããŒã¬ããŒãã®ãã¡ãã°ã©ãã£ãã¯ã«é¢ããã¬ããŒã31ããªã³ã©ã€ã³ã§11ãããŒã«ã§10ãç©çã§3ããªãŒãã£ãªã§2ããããŠã·ãªã¢ã«åãçŽæ¥æ±ãã®ã¯1ã€ã ãã§ãã
å°ãªããšããèŠä»¶ãã©ãã»ã©è€éã«ãªããæ³åããŠã¿ãŠãã ããã Flappy Birdã®ãããªå°ããªã²ãŒã ãããã€ãã®ã¢ã»ããã§äœæããå Žåãããããã·ãªã¢ã«åã«ã€ããŠããŸãèããå¿ èŠã¯ãªãã§ãããã ãããããã¯ã¹ãã£ãPNGããçŽæ¥èªã¿èŸŒãããšãã§ããããã§ååã§ãã äžäœäºææ§ã®ããã³ã³ãã¯ããªãã€ããªåœ¢åŒãå¿ èŠã§ããããç¬èªã«éçºããããªãå Žåã¯ã CerealãBoost.Serializationãªã©ã®ãµãŒãããŒãã£ã©ã€ãã©ãªãã芧ãã ãã ã Google Protocol Buffersã¯ã²ãŒã ãªãœãŒã¹ã®ã·ãªã¢ã«åã«ã¯çæ³çã§ã¯ãªããšæããŸããããŸã 調æ»ãã䟡å€ããããŸãã
ã²ãŒã ãšã³ãžã³ã®äœæã¯ãå°ããªãã®ã§ãã£ãŠãã倧äŒæ¥ã§ãã ãã£ãšèšãããšãã§ããŸãããæ£çŽã«èšããšããã®é·ãã®èšäºã§æãã€ãæãæçšãªã¢ããã€ã¹ã§ãïŒå埩ããŠäœæ¥ããã³ãŒããäžè¬åããè¡åã«å°ãæµæããã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ãåºç¯ãªãããã¯ã§ããããšãå¿ããªãã§ãã ãããæ£ããæŠç¥ãéžæããå¿ èŠããããŸãã ç§ã®çµéšã§ã¯ããããã®ç¹ã®ãããããç¡èŠããããšãé害ã«ãªãå¯èœæ§ãããããšã瀺ãããŠããŸãã
ãã®ãããã¯ã«é¢ãã芳å¯çµæãæ¯èŒãããã®ã§ãä»ã®éçºè ã®æèŠãèãããšã«éåžžã«èå³ããããŸãã ãšã³ãžã³ãäœæããå Žåãããªãã®çµéšã¯åãçµè«ã«ã€ãªãããŸãããïŒ ãããŠãããããªããæžããŠããªããããã è¡ãã€ãããªããããªãã®èããç§ã«ãšã£ãŠèå³æ·±ããã®ã§ãã è¯ãåŠç¿ãªãœãŒã¹ã¯äœã ãšæããŸããïŒ ããªãã«ã¯ãŸã ã©ã®ãããªåŽé¢ãç¥ç§çã ãšæãããŸããïŒ ä»¥äžã«ã³ã¡ã³ããæ®ãããTwitterã§ç§ã«é£çµ¡ããŠãã ããã