Book Image

Learning Game AI Programming with Lua

By : David Young
Book Image

Learning Game AI Programming with Lua

By: David Young

Overview of this book

Table of Contents (16 chapters)
Learning Game AI Programming with Lua
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with AI Sandbox
Index

Extending the SandboxApplication class


Once your project has been set up, you need to create three blank files for Premake to discover.

Create the source and header files as follows:

src/my_sandbox/include/MySandbox.h
src/my_sandbox/src/MySandbox.cpp
src/my_sandbox/src/main.cpp

Now, it's time to regenerate the Visual Studio solution by executing vs2008.bat, vs2010.bat, vs2012.bat, or vs2013.bat. When you open the Visual Studio solution, you'll see your brand new My_Sandbox project!

Each of the sandbox demos is set up to extend the base SandboxApplication class and declare where to find the corresponding Lua script files for the executable.

Declaring your MySandbox class follows the same pattern and looks as follows:

MySandbox.h:

#include "demo_framework/include/SandboxApplication.h"

class MySandbox : public SandboxApplication {
public:
    MySandbox(void);

    virtual ~MySandbox(void);

    virtual void Initialize();
};

Inheriting from SandboxApplication gives you a base to start with. For now...