3D Gamestudio Manual
Total Page:16
File Type:pdf, Size:1020Kb
3D Gamestudio WDL Tutorial & Manual © Conitec February 2001 1 3D GameStudio World Definition Language Tutorial & Manual for A4 engine 4.23 and A5 engine 5.03 Johann C. Lotter / Conitec February 2001 3D Gamestudio WDL Tutorial & Manual © Conitec February 2001 2 Copyright © Conitec Corporation 1997...2001 Partially translated by Guenther Mulder WED level editor Matthew Ayres, Paul Hsu, Wladimir Stolipin MED model editor Wladimir Stolipin Map compiler Gennadi Wart WDL compiler Volker Kleipa Engine Johann Christian Lotter Example games Czeslav Gorski, Harald Schmidt, Doug Poston Script prefabs Doug Poston The latest news, demos, updates and tools, as well as the Users' Magazine, the Users' Forum and the annual Contest are available at the GameStudio main page http://www.3dgamestudio.com. If you own the commercial or professional edition, you are entitled to 3 or 12 months technical support via email. Please mail your question to [email protected], and give your edition, purchase date and serial or customer number (on the key disk or on your invoice). Try finding the answer in the manual first! Technical questions can only be answered if sent by email to that address. Normally each question is answered within one working day. Manual and Software are protected under the copyright laws of Germany and the U.S. Acknex and 3D GameStudio are trademarks of Conitec Corporation. Windows, DirectX and Direct3D are trademarks of Microsoft, Inc. Voodoo is a trademark of 3dfx, Inc. Quake is a trademark of Id Software, Inc. Any reproduction of the material and artwork printed herein without the written permission of Conitec is prohibited. We undertake no guarantee for the accuracy of this manual. Conitec reserves the right to make alterations or updates without further announcement. 3D Gamestudio WDL Tutorial & Manual © Conitec February 2001 3 Contents Tutorial: Teach Yourself Game Programming in 6 Days _________________ 6 Sunday afternoon: WDL Syntax ________________________________________ 7 Variables and Strings ______________________________________________________ 8 If Branching ______________________________________________________________ 10 Loops ___________________________________________________________________ 12 Debugging _______________________________________________________________ 14 Monday: Doors and Keys ______________________________________________ 18 Actions __________________________________________________________________ 18 The First Movement _______________________________________________________ 19 User interaction __________________________________________________________ 20 Tuesday: Game Physics ______________________________________________ 23 Acceleration, Inertia, Friction _______________________________________________ 25 Falling down _____________________________________________________________ 27 Wednesday: Artificial Intelligence ______________________________________ 30 The Theory of Black Boxes _________________________________________________ 30 The Table of States _______________________________________________________ 31 Advanced State Machines __________________________________________________ 36 Thursday: The User Interface __________________________________________ 37 Texts ___________________________________________________________________ 37 Panels __________________________________________________________________ 38 Friday: Controlling the Game __________________________________________ 41 Changing Levels __________________________________________________________ 41 Saving and Loading Games ________________________________________________ 42 Reference: WDL Syntax ___________________________________________ 44 Functions - the brain of the game _______________________________________ 46 Variable functions ________________________________________________________ 47 Vector instructions ________________________________________________________ 48 String instructions ________________________________________________________ 50 File instructions __________________________________________________________ 52 Control instructions _______________________________________________________ 54 Entity instructions ________________________________________________________ 56 Multimedia instructions ____________________________________________________ 63 Input / output instructions __________________________________________________ 64 Game flow instructions ____________________________________________________ 65 Plugin DLL instructions ____________________________________________________ 67 Debug instructions ________________________________________________________ 68 Attaching functions or actions ______________________________________________ 69 Variables, Strings, Synonyms __________________________________________ 71 Variables and Arrays ______________________________________________________ 71 Strings __________________________________________________________________ 72 Synonyms _______________________________________________________________ 72 File Objects _________________________________________________________ 73 Entities - inhabitants of the game world _________________________________ 75 Screen control parameters _________________________________________________ 75 3D Gamestudio WDL Tutorial & Manual © Conitec February 2001 4 Position parameters _______________________________________________________ 76 Visual Parameters ________________________________________________________ 76 Collision detection ________________________________________________________ 81 Events __________________________________________________________________ 82 Internal parameters _______________________________________________________ 85 User interface: Panels, Texts, Views ____________________________________ 86 Panels __________________________________________________________________ 86 Texte ___________________________________________________________________ 89 Views ___________________________________________________________________ 90 Engine-Variables _____________________________________________________ 93 Predefines __________________________________________________________ 104 Database and Dataview _______________________________________________ 106 Multi-User Mode ____________________________________________________ 108 Starter Window Definitions ____________________________________________ 110 Reference: Prefabricated Scripts ___________________________________ 112 Movement.wdl ____________________________________________________________ 112 Actors.wdl _______________________________________________________________ 114 Weapons.wdl _____________________________________________________________ 115 War.wdl _________________________________________________________________ 117 Doors.wdl _______________________________________________________________ 118 Messages.wdl ____________________________________________________________ 120 Particle.wdl ______________________________________________________________ 121 Menu.wdl ________________________________________________________________ 121 Venture.wdl ______________________________________________________________ 122 Appendix _______________________________________________________ 132 WDL traps __________________________________________________________ 132 The dreaded wait() instruction ______________________________________________ 132 Those bloody invalid synonyms _____________________________________________ 132 Bad timing ______________________________________________________________ 133 Wrong mathematics _______________________________________________________ 133 The event trap ____________________________________________________________ 134 Attaching entities to each other _____________________________________________ 134 Appendix B: Starting the Engine _______________________________________ 136 Command Line Options ___________________________________________________ 136 D3D Considerations _______________________________________________________ 138 Error Messages __________________________________________________________ 139 Frequently Asked Questions _______________________________________________ 144 Appendix C: Legal stuff _______________________________________________ 146 Frequently Asked Questions ________________________________________________ 147 3D Gamestudio WDL Tutorial & Manual © Conitec February 2001 5 ongratulations: As owner of 3D GameStudio you can now create interactive realtime Capplications – especially, but not only 2D and 3D computer games – quick, easy and without previous programming knowledge. “Easy” does not mean that GameStudio applications are all prefabricated and look and play similar. You can use WDL, a scripting language, for giving the user interface and the objects within your game an arbitrary behaviour, which may suit especially your needs. This way, your games will not necessarily look and feel like “made with 3D GameStudio”; they will look and feel the way you've programmed them. Creating commerical quality games is an ambitious task. Before reading this manual, you should start WED and begin with the WED tutorial to get an idea how 3D GameStudio works. At reaching the last lesson, you're ready for WDL. This manual consists of several parts. The first part, the WDL tutorial, is an introduction into the programming language. In the following part, the WDL reference, the syntax and objects of the World Definition Language WDL is described. If you don't want to write your own WDL scripts, but prefer to use the prefabricated ones, read the