• 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.
Sign in to follow this  
Followers 0
WitchLord

AngelScript 1.10.0 FINAL (2004/11/02)

45 posts in this topic

To fix the assert failure in Dereference() you need to replace the code for asCDataType::GetSubType() (in as_datatype.cpp) with the following:


asCDataType asCDataType::GetSubType(asCScriptEngine *engine)
{
asCDataType dt(*this);
if( dt.arrayDimensions )
dt.arrayDimensions--;
else if( dt.pointerLevel )
dt.pointerLevel--;

if( dt.arrayDimensions > 0 )
dt.objectType = engine->GetArrayType(dt);
else if( dt.pointerLevel > 0 )
dt.objectType = 0;
else
dt.objectType = dt.extendedType;

return dt;
}



---

I'm still looking in to the conversion to double problem.
0

Share this post


Link to post
Share on other sites
The fix for the floating conversion problem is to change the VM code for the following two bytecodes:

as_context.cpp line 1282:

case BC_fTOd:
*(double*)--l_sp = double(*(float*)(l_sp));
l_bc += BCS_fTOd;
break;


as_context.cpp line 1267:

case BC_dTOf:
*(float*)++l_sp = float(*(double*)(l_sp));
l_bc += BCS_dTOf;
break;


Note, this problem most likely exist for other conversions to and from double as well. I will write tests for all conversions right now (something that I should have done a long time ago).

0

Share this post


Link to post
Share on other sites
Just an additional note: I think I had the double conversion thing working just ok with previous version(s) - not sure if I tested it last time with 1.8.x or 1.9.x. I was using it with wrapping std sin, cos, etc. and just noticed with the latest update that my test code for them wasn't working anymore.
0

Share this post


Link to post
Share on other sites
I know, the conversion bug was introduced with the optimization of the C++ VM. I failed to fully understand when the ++ and --operators are evaluated:

I was doing:

*sp = *sp++; // Doesn't update sp until after the assignment

instead of:

*++sp = *sp; // Updates sp after the right hand expression has been evaluated, but before the assignment



0

Share this post


Link to post
Share on other sites
I verified that your fixes for as_context.cpp fix the float<=>double conversions.

However, when I first noticed the problem, I was actually using code which casts a time value of type uint to double, and that one still didn't work. Which is not a surprise since the VM code related to that was still untouched :). That is, I have "uint mTime;" and "double(mTime)" didn't work, but adding additional typecast to float helped: "double(float(mTime))".

Looking at your fix, I made the equivalent changes to BC_dTOi, BC_dTOui, BC_iTOd and BC_uiTOd:

case BC_dTOi:
*++l_sp = int(*(double*)(l_sp));
l_bc += BCS_dTOui;
break;

case BC_dTOui:
*++l_sp = asDWORD(*(double*)(l_sp));
l_bc += BCS_dTOui;
break;

// ...

case BC_iTOd:
*(double*)--l_sp = double(int(*l_sp));
l_bc += BCS_iTOd;
break;

case BC_uiTOd:
*(double*)--l_sp = double(*l_sp);
l_bc += BCS_uiTOd;
break;


This seems to have fixed the problem and now the original script code seems to work again.
0

Share this post


Link to post
Share on other sites
Thanks, I had already fixed those cases, but I forgot to show the fixes here.

I've added test cases for all conversions so this should never happen again.

0

Share this post


Link to post
Share on other sites
Um.. hopefully your fixes are better, since I found out that the ones I presented above aren't probably correct after all - at least my usage case doesn't work with Release builds currently. :)
0

Share this post


Link to post
Share on other sites
Good point. I hadn't tested the fix with release build.

Here's a fix that works:


case BC_dTOi:
{
int i = int(*(double*)(l_sp++));
*l_sp = i;
}
l_bc += BCS_dTOui;
break;

case BC_dTOui:
{
asUINT u = asDWORD(*(double*)(l_sp++));
*l_sp = u;
}
l_bc += BCS_dTOui;
break;

case BC_dTOf:
{
float f = float(*(double*)(l_sp++));
*(float*)l_sp = f;
}
l_bc += BCS_dTOf;
break;

case BC_iTOd:
{
double d = double(int(*l_sp--));
*(double*)l_sp = d;
}
l_bc += BCS_iTOd;
break;

case BC_uiTOd:
{
double d = double(*l_sp--);
*(double*)l_sp = d;
}
l_bc += BCS_uiTOd;
break;

case BC_fTOd:
{
double d = double(*(float*)(l_sp--));
*(double*)l_sp = d;
}
l_bc += BCS_fTOd;
break;



This teaches us that we can't rely on when the ++ and -- operators will be evaluated. If we need them to be exactly as we want them then the expressions must to be broken up.
0

Share this post


Link to post
Share on other sites
Oops!

At first I didn't see what you meant. I thought you were wondering about the parameters, but then I saw the difference in function names. [wink]

I'll have that fixed for the next release.
0

Share this post


Link to post
Share on other sites
Is there any way we could get the VC++ style Debug Trace associated with the MS IDE for AngelScript...I think VC++ would support this anyhow with a 3rd party plugin. any Ideas?
0

Share this post


Link to post
Share on other sites
Is there any way in which we could emulate a Debug Build in VC with the AS code, like breakpoints and call stack viewing, possibly integrated into VC itself, pushing it closer to C++ code compatibility! Just your thoughts and suggestions on this subject.
0

Share this post


Link to post
Share on other sites
With a few changes it would be possible to query the call stack. Setting break points would also be possible. But this would be with function calls to the context, i.e. the application would have to do this.

Integration into the MSVC++ debugger would be a completely different matter though. I don't know how to do this, or even if it's possible.
0

Share this post


Link to post
Share on other sites
No function calls to the context are necesary for the debug, but the oposite, function calls from the context to the client application.

That is what i have implemented here, and i asked you if you want this to be integrated in the current AS or in the new AS2, the debug hook

in bc_Line step, there is a:

if(debug_hook)
status = debug_hook(linenumber, state, whatever, ....)
if(status == _Suspend)
jmp bc_Suspsend

so if the client application implements a function with the correct declaration ( scriptEngine->SetDebugHook(debug_hookFunc); ) it will recive callbacks every line of execution with the line number and all the parameters that it will need

in the client application:

uint debug_hookFunc(int linenumber, uint state, whatever, ....) {
........
application specific code

if(breakpointsMap.find(linenumber)) {
execution line is on some breakpoint, do what you need
........
application specific code

return state_Suspsend;

}
........
application specific code

return state_continue;
}

this way the debugger can be created very easy, externally and will not affect the as engine, because in release it will compiled without the bc_line opcode

Lioric
0

Share this post


Link to post
Share on other sites
That is certainly a nice solution for setting break points.

Another hook could be set up for when a script exception occurs, this would allow the application to examine the call stack before it is cleaned up.

Then it would also be useful to have a database of function variables, and access to the context stack. This one would require a lot more work though.

You can send me the code you have, if you'd like. I can include it in versions 1.11.0 and 2.0.0.
0

Share this post


Link to post
Share on other sites
I would love to see those in AS, as we speak it gets more professional, and when a coupla titles get to use it, could get that worldwide support for a great scripting language!
0

Share this post


Link to post
Share on other sites
I got a bug report from a mod author for my game in development. I believe this is related to changes in AS, since he was just upgrading existing script to work with latest version of game (having new AS as well).

I'm quoting here what he posted. (pay attention to the differences in last parameter of drawString call)
--

I narrowed it down a bit and while this still doesn't work:

medFont->drawString(float(screenWidth / 2), float(screenHeight / 4) + 180, UIFONT_ALIGN_HORIZ_CENTER | UIFONT_ALIGN_VERT_CENTER, "Total: " + bstrFormat(float(handsFirst ? 1500 : 0)));


This does:

bstr test = bstrFormat(float(handsFirst ? 1500 : 0));
medFont->drawString(float(screenWidth / 2), float(screenHeight / 4) + 180, UIFONT_ALIGN_HORIZ_CENTER | UIFONT_ALIGN_VERT_CENTER, "Total: " + test);


As does this:

medFont->drawString(float(screenWidth / 2), float(screenHeight / 4) + 180, UIFONT_ALIGN_HORIZ_CENTER | UIFONT_ALIGN_VERT_CENTER, "Total: " + bstrFormat(handsFirst ? 1500 : 0));


0

Share this post


Link to post
Share on other sites
I've fixed a bug related to casting the ?: ternary operator in the WIP. Have you tried the latest WIP already?

I'll try your test cases to verify that they all work with the latest version.
0

Share this post


Link to post
Share on other sites
I identified a bug where temporary variables where prematurely released. It can be fixed by adding a test to verify that bc != 0 before calling ReleaseTemporaryVariable() in method asCCompiler::Dereference().

as_compiler.cpp line 1904:


if( bc )
ReleaseTemporaryVariable(*type, bc);


This is for the latest WIP. With this fix, the latest WIP can compile and execute all three of the situations you mentioned.

Later this week, I'm releasing version 1.10.1, which will be the first officially stable version AngelScript. Stable in that I will maintain this version with bug fixes while going forward with other versions for future features.

Thanks Jetro.
0

Share this post


Link to post
Share on other sites
I'm somewhat busy now, so I haven't had chance to test any WIP releases. I'll upgrade to next release or so, when I have some hacking time again.. :)
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0