• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Malmer

Problems building scripts

5 posts in this topic

When compiling any script I get this type of error. Building... Parsing: "data/ai/ship.script" Error : (17, 1) Unexpected token '''' Completed. (errors: 1, warnings: 0) Row 17 is the last row of that script, so apparently there is something wrong with the ending of the script code. This is how I load the script:
// Load the file
FILE * File = fopen( CUtil::GetPath( filename ), "rb" );
if ( File == NULL )
{
	...
}

// Get file size
int size = _filelength(_fileno( File ));
	
// Get file contents
char * scriptcode = new char[ size + 1 ];
fread( scriptcode, size, 1, File );
fclose (File);
scriptcode[ size ] = NULL;

// Load into scriptengine
int result = m_ScriptEngine->AddScriptSection( filename, scriptcode, strlen( scriptcode )+1 );
	
// Free memory
delete [] scriptcode;
 
As you can see I properly make sure the string is null-terminated. Some other comments: * If I do AddScriptSection and don''t do the +1 on strlen then the entire app crashes. * I''ve tried with using acCString in exactly the same way as in the downloadable sample, no luck. And a difference there also is that while it worked with just using "len" for strlen, I had to use len+1 or else it would crash. The difference with mine and the sample is that the sample uses 1.6.1, while I use 1.7.1. It also uses an external dll, while I don''t. * I''ve tried with different encodings of my script. Both DOS and UNIX. Also tried with the sample script. No luck. * Outputting the string data to my debug window shows nothing strange in the end of the file data stream. What is wrong?
0

Share this post


Link to post
Share on other sites
The bug appears when compiling with the Visual C++ Toolkit 2003 compiler, which is the same as in new versions of VC++. Available free.

Think it has something to do with different memory handling.

[edited by - malmer on June 10, 2004 11:49:57 AM]
0

Share this post


Link to post
Share on other sites
I''ve experienced problems like this, but the problems were usually inside the actual script file. Maybe you could post that?
0

Share this post


Link to post
Share on other sites
It works perfectly when I compile the same application with the VS6 compiler, so it has to be something with compiler differences.

Lib author: If you want to add a check for the VC7 compiler you can do like this:

#if (_MSC_VER >= 1300) // Visual Studio .NET

#endif
0

Share this post


Link to post
Share on other sites
To fix the bug change:


int asCBuilder::AddCode(const char *name, const char *code, int codeLength)
{
asCScriptCode *script = new asCScriptCode;
script->name = name;
script->code.SetLength(codeLength);
memcpy(script->code.AddressOf(), code, codeLength);

scripts.PushLast(script);

return 0;
}


into:


int asCBuilder::AddCode(const char *name, const char *code, int codeLength)
{
asCScriptCode *script = new asCScriptCode;
script->SetCode( name, code );
scripts.PushLast(script);

return 0;
}


The last code sample also works in the old compiler. The old code didn''t nullterminate the string put into script->code. That, by luck, worked ok in the old compilator. Did not in the new. The SetCode method that allready exists in the lib does it correctly, by adding a nullterminate to the script->code buffer.
0

Share this post


Link to post
Share on other sites
Well, it seems you found the bug already I''ll add the fix to the library as soon as possible. Thanks letting us know.

Regards,
Andreas



__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
0

Share this post


Link to post
Share on other sites