Jump to content
  • Advertisement

ruphert

Member
  • Content Count

    45
  • Joined

  • Last visited

Everything posted by ruphert

  1. ruphert

    Crash on exit (binding wrong?)

    Hey, I'm experiencing a crash in free() on exit. I'm lost, so maybe you can tell me if I did something wrong in the bindings?   struct Tile { b2Fixture* edgeN, *edgeS, *edgeW, *edgeE; u16 blobid1, blobid2; u16 backblobid1, backblobid2; TileType type; u16 flags; u8 support; u8 dirt; u8 light; u8 noise; u8 damage; Tile(); Tile( const TileType t ); Tile( Tile& t ); Tile& operator=(const Tile& t) { type = t.type; support = t.support; dirt = t.dirt; light = t.light; flags = t.flags; noise = t.noise; damage = t.damage; return *this; } bool operator==(const Tile& rhs) { return (type == rhs.type); // legacy } bool operator==(const Tile& rhs) const { return (type == rhs.type); // legacy } enum TileFlags { SPARE_0 = 0x01, BACKGROUND = 0x02, SOLID = 0x04, LADDER = 0x08, LIGHT_PASSES = 0x10, WATER_PASSES = 0x20, FLAMMABLE = 0x40, PLATFORM = 0x80, LIGHT_SOURCE = 0x100, MIRROR = 0x200, FLIP = 0x400, ROTATE = 0x800, SPARE_1 = 0x1000, SPARE_2 = 0x2000, SPARE_3 = 0x4000, SPARE_4 = 0x8000 }; }; The binding: r = engine->RegisterObjectType("Tile", sizeof(Tile), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CA); assert(r >= 0); // Set Vec2f behaviour. // Initialisation and deinitialisation r = engine->RegisterObjectBehaviour("Tile", asBEHAVE_CONSTRUCT, "void f()", asFUNCTIONPR(constructorTile, (void*), void), asCALL_CDECL_OBJLAST); assert(r >= 0); r = engine->RegisterObjectBehaviour("Tile", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(deconstructorTile), asCALL_CDECL_OBJLAST); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "TileType type", asOFFSET(Tile, type)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u8 support", asOFFSET(Tile, support)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u8 dirt", asOFFSET(Tile, dirt)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u8 light", asOFFSET(Tile, light)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u16 flags", asOFFSET(Tile, flags)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u8 damage", asOFFSET(Tile, damage)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u8 noise", asOFFSET(Tile, noise)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u16 blobid1", asOFFSET(Tile, blobid1)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u16 blobid2", asOFFSET(Tile, blobid2)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u16 backblobid1", asOFFSET(Tile, backblobid1)); assert(r >= 0); r = engine->RegisterObjectProperty("Tile", "u16 backblobid2", asOFFSET(Tile, backblobid2)); assert(r >= 0); r = engine->RegisterObjectMethod("Tile", "Tile& opAssign(const Tile &in)", asMETHODPR(Tile, operator=, (const Tile&), Tile&), asCALL_THISCALL); assert(r >= 0); r = engine->SetDefaultNamespace("Tile"); assert( r >= 0 ); r = engine->RegisterEnum("TileFlags"); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "SPARE_0", Tile::SPARE_0); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "SOLID", Tile::SOLID); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "BACKGROUND", Tile::BACKGROUND); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "LADDER", Tile::LADDER); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "LIGHT_PASSES", Tile::LIGHT_PASSES); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "WATER_PASSES", Tile::WATER_PASSES); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "FLAMMABLE", Tile::FLAMMABLE); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "PLATFORM", Tile::PLATFORM); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "LIGHT_SOURCE", Tile::LIGHT_SOURCE); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "MIRROR", Tile::MIRROR); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "FLIP", Tile::FLIP); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "ROTATE", Tile::ROTATE); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "SPARE_1", Tile::SPARE_1); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "SPARE_2", Tile::SPARE_2); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "SPARE_3", Tile::SPARE_3); assert( r >= 0 ); r = engine->RegisterEnumValue("TileFlags", "SPARE_4", Tile::SPARE_4); assert( r >= 0 ); r = engine->SetDefaultNamespace(""); assert( r >= 0 );   And some functions that use it: r = engine->RegisterObjectMethod("CMap", "void server_SetTile(Vec2f pos, const Tile &in tile)", asMETHODPR( CMap, server_SetTile, (Vec2f, const Tile&), void), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod("CMap", "Tile getTile( Vec2f pos ) const", asMETHODPR( CMap, getTile, (Vec2f) const, Tile), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod("CMap", "Tile getTileFromTileSpace( Vec2f pos ) const", asMETHODPR( CMap, getTile_Vec2f, (Vec2f) const, Tile), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod("CMap", "Tile getTile( u32 offset ) const", asMETHODPR( CMap, getTile, (u32) const, Tile), asCALL_THISCALL); assert(r >= 0);
  2. ruphert

    Crash on exit (binding wrong?)

    The crash was unrelated. Thanks for the CRT tip.  Visual Leak Detector is very good too.
  3. ruphert

    Crash on linux (gcc 4.3?)

    Hey, After switching to Angelscript 2.27.1 I get this crash on linux. But it happens only if I compile on my machine with gcc 4.3. On gcc 4.7 it works fine.   The crash happens right after calling a second function, first script whatsoever. Any idea what this is? The array is empty and the index is 1 in this case. KAGdedi: ../../source/as_array.h:158: T& asCArray<T>::operator[](size_t) [with T = asCScriptFunction*]: Assertion `index < length' failed. Program received signal SIGABRT, Aborted. 0xf7fdb425 in __kernel_vsyscall () (gdb) bt #0 0xf7fdb425 in __kernel_vsyscall () #1 0xf7d101df in raise () from /lib/i386-linux-gnu/libc.so.6 #2 0xf7d13825 in abort () from /lib/i386-linux-gnu/libc.so.6 #3 0xf7d09085 in ?? () from /lib/i386-linux-gnu/libc.so.6 #4 0xf7d09137 in __assert_fail () from /lib/i386-linux-gnu/libc.so.6 #5 0xf737929d in asCArray<asCScriptFunction*>::operator[](unsigned int) () from Base/../libJuxta_dedi.so #6 0xf73ce434 in CallSystemFunction(int, asCContext*, void*) () from Base/../libJuxta_dedi.so #7 0xf7372b34 in asCContext::ExecuteNext() () from Base/../libJuxta_dedi.so #8 0xf737044a in asCContext::Execute() () from Base/../libJuxta_dedi.so #9 0xf70b131e in asScript::ExecuteWithDebug (this=0x8225530, ctx=0x81ec0e8) at ../Scripting/asScript.cpp:385 #10 0xf70b1eeb in asScript::executeFunctionByName (this=0x8225530, name=...) at ../Scripting/asScript.cpp:506 #11 0xf70b60a2 in asScriptManager::runScriptFromFile (this=0x80d0e54, fileName=..., entryFunction=..., fileMatch=false) at ../Scripting/asScriptManager.cpp:766 #12 0xf70ac39d in CScript::RunScriptFromFile (this=0x80d0e50, fileName=..., entryFunction=..., fileMatch=<optimized out>) at ../Scripting/Script.cpp:89 #13 0xf6f2b943 in CGame::Run (this=0x8175bd8, argc=1, argv=0xffffd214) at ../Game/GameDLL.cpp:475 #14 0xf6f1620f in GameDLLInit (ie=..., argc=1, argv=0xffffd214) at ../Game/GameDLL.cpp:94 #15 0x0804c078 in CApplication::LoadGameDLL (this=0x80cc088, filename=0x80cc2f4 "Base/../libJuxta_dedi.so", argc=1, argv=0xffffd214) at ../App/main.cpp:346 #16 0x0804e8c5 in CApplication::Run (this=0x80cc088, argc=1, argv=0xffffd214) at ../App/main.cpp:228 #17 0x0804c3ed in main (argc=1, argv=0xffffd214) at ../App/main.cpp:623 (gdb)
  4. ruphert

    Crash on linux (gcc 4.3?)

    No, the memory leak remains. I will need to isolate the problem somehow cause right now there is a 16kb leak on every initialized script.
  5. ruphert

    Crash on linux (gcc 4.3?)

    Its working. The issue was unrelated to gcc. It turns out some old or seemingly random angelscript code was used in creating the lib. A full clean of angelscript and rebuilding again helped.
  6. ruphert

    Angelscript to C++ translator

    I'm sporting the idea of having a Angelscript to C++ automatic translator. I know it's not an easy task and not everything can be translated, however I have an idea how to do it. Is anyone interested working on this with me as a paid job?
  7. ruphert

    Angelscript to C++ translator

    I tried the AOT compiler however it produces hundreds of gigabytes (not joking) of c++ code. You can imagine that is useless.   Most of the code I'd like to translate is pretty straightforward. For example, here you just need to change @ to *. void onTick( CMap@ this ) { // local player check end CBlob@ localBlob = getLocalPlayerBlob(); if (localBlob !is null) { if (!myPlayerGotToTheEnd && (localBlob.getPosition() - endPoint).getLength() < 32.0f) { myPlayerGotToTheEnd = true; Sound::Play("/VehicleCapture"); } } There might be a problem with virtual classes and such. But I purposfully avoid using AS specific things like traits.   The file size of these translations won't be small too, because I imagine all the global vars and functions need to be in one common header attached to every single translated script, however it won't be anywhere near a couple gigs.
  8. ruphert

    Crash on exit (binding wrong?)

    Will upgrade to the latest Angelscript cause that sounds like it might be it.   I use Visual Leak Detector and that was its output.  Will report back.
  9. ruphert

    Crash on exit (binding wrong?)

    Visual Studio 2010 Angelscript 2.26.2   The crash happens on next map (after resources are freed, and only in the release mode). I'm not sure now this is the reason for the crash, so lets leave it. However I have a memory leak (might be related) and I need some help figuring out what causes this. The leak happens on every single script in the game. What do you think it is leaking ? d:\transhuman\kag\3rd\angelscript\sdk\angelscript\source\as_builder.cpp (3529): (Module name unavailable)!asCBuilder::GetParsedFunctionDetails + 0x14 bytes d:\transhuman\kag\3rd\angelscript\sdk\angelscript\source\as_builder.cpp (3595): (Module name unavailable)!asCBuilder::RegisterScriptFunctionFromNode d:\transhuman\kag\3rd\angelscript\sdk\angelscript\source\as_builder.cpp (658): (Module name unavailable)!asCBuilder::RegisterNonTypesFromScript + 0x1E bytes d:\transhuman\kag\3rd\angelscript\sdk\angelscript\source\as_builder.cpp (569): (Module name unavailable)!asCBuilder::ParseScripts d:\transhuman\kag\3rd\angelscript\sdk\angelscript\source\as_builder.cpp (231): (Module name unavailable)!asCBuilder::Build d:\transhuman\kag\3rd\angelscript\sdk\angelscript\source\as_module.cpp (222): (Module name unavailable)!asCModule::Build + 0xB bytes d:\transhuman\kag\trunk\scripting\angelscript\add_on\scriptbuilder\scriptbuilder.cpp (651): (Module name unavailable)!CScriptBuilder::Build + 0x17 bytes d:\transhuman\kag\trunk\scripting\angelscript\add_on\scriptbuilder\scriptbuilder.cpp (143): (Module name unavailable)!CScriptBuilder::BuildModule d:\transhuman\kag\trunk\scripting\asscript.cpp (201): (Module name unavailable)!asScript::loadScript + 0xB bytes d:\transhuman\kag\trunk\scripting\asscriptmanager.cpp (371): (Module name
  10. ruphert

    Recompiling shared classes

    Hey, I need to recompile a script during runtime which has a shared class or shared function. Angelscript doesn't discard those in DiscardModule(). How do I get rid of them at runtime so I can recompile?
  11. ruphert

    JIT compiler crashes

    I'm having trouble running the JIT compiler -> https://github.com/BlindMindStudios/AngelScript-JIT-Compiler   I tried running it with the angelscript version that was last supported by the JIT compiler. I set it up as in the provided example and I finalize pages after script compiles.   It gives either a buffer overrun or heap corruption error on the very first script it does. Showing the code is kind of pointless cause its long and convoluted. If anyone is interested in helping me with this I can provide the source code. But I wonder if I am maybe doing something wrong.   The crashes happen in random location in the jit files: like this http://grab.by/kYPw   I tried running the JIT with some compatibility stuff like this:  jit = new asCJITCompiler(JIT_NO_SCRIPT_CALLS | JIT_NO_SUSPEND | JIT_NO_SWITCHES);    but it also crashes in a different place: http://grab.by/kYPo
  12. ruphert

    JIT compiler crashes

    Thanks, sent you a PM.
  13. ruphert

    JIT compiler crashes

    I made a smaller case and found the issue. The JIT compiler doesn't work with virtual functions. Whenever there was a virtual function binding in my engine it crashed with a heap corruption after that. ThyReaper did you know about this?     I made some benchmarks after I made it work and they were quite disheartening. Running with the JIT compiler is actually SLOWER than without it. Did anyone do benchmarks of their own with JIT on/off?
  14. ruphert

    AngelScript 2.26.2

    No worries, you're doing great. Thanks for this release!
  15. ruphert

    JIT compiler crashes

    The thing is, it's a heap corruption so it happens at random locations. I'll try to track down the line or function though...
  16. ruphert

    JIT compiler crashes

    Visual Studio 2010. It compiles fine, just crashes at run-time
  17. I don't know where to start with this bug, so I'll just describe what happens. I'm using the latest AS but it was like this a couple versions earlier too.   After I load byte code I get all sorts of errors. Mainly I lose function pointers from the cache. I cache functions after loading like this:   cachedFuncs.func_onRender_CRules = mModule->GetFunctionByDecl( "void onRender( CRules@ this )" );    Now some functions lose the pointers and its just garbage. Not immediately but after some time before running the script. But this is not the issue, its just an effect, cause if I dont use the cache there are some other random errors and crashes inside AS code.   I'm not 100% sure but I think the files I see breaking are the ones using an enum. It might be an AS bug not handling these enums properly:   this is the enum that is used in those files:     namespace Hitters { shared enum hits{ hitter_nothing = 0,   //env hitter_fall, hitter_drown, hitter_burn, hitter_crush, hitter_flying,   //common actor hitter_stomp, hitter_suicide,   //builders hitter_hammer, //mason hitter_saw, //carpenter hitter_pick, //peasant   //arrows and similar projectiles hitter_arrow, hitter_ballista,   //cata hitter_cata_stones,   //knight hitter_sword, hitter_shield, hitter_bomb,   //siege hitter_ram,   //traps hitter_spikes,   //barbarian hitter_muscles }; }     its "shared" now but without shared it breaks too.
  18. ruphert

    AngelScript 2.26.0 is out

    It seems the new version doesn't compile on Mac OSX (tested with 2 different systems):   c++ -g -Wall -fPIC -arch i386 -arch x86_64 -o obj/as_atomic.o -c ../../source/as_atomic.cpp ../../source/as_atomic.cpp:149: error: prototype for 'int asCAtomic::atomicDec(int&)' does not match any in class 'asCAtomic' ../../source/as_atomic.cpp:61: error: candidate is: asDWORD asCAtomic::atomicDec() ../../source/as_atomic.cpp:149: error: prototype for 'int asCAtomic::atomicDec(int&)' does not match any in class 'asCAtomic' ../../source/as_atomic.cpp:61: error: candidate is: asDWORD asCAtomic::atomicDec() lipo: can't figure out the architecture type of: /var/tmp//ccdlDTNp.out   -EDIT-   Fixed! Seemed like a typo at line 149 in as_atomic.cpp, should be:   int asAtomicDec(int &value)
  19. Hey, I have a "shared class" and I need to use a function outside the class. The compiler warns me that I must use "shared" for the function too. I believe this is correct? However when these functions are "shared" it seems something isn't freed properly because I get this assert on angelscript release:   GC cannot free an object of type '_builtin_function_', it is kept alive by the application Assertion failed: func->returnType.GetObjectType() != type, file ..\..\source\as_configgroup.cpp, line 191   What am I doing wrong?
  20. Hi I have a problem, I have a client-server game and the server sends bytecode to clients, so that all run the same scripts. However I can't really make it work because my engine relies on script function hooks like: asIScriptFunction *func = mModule->GetFunctionByDecl( "void DoSomething()" ); After loading byte code there are no functions to get :/ How do I solve this?
  21. ruphert

    Running functions after LoadByteCode

    When writing the binary stream, my class didn't increase the buffer pointer while reading and writing. So it was always writing/reading at the same location resulting in something random. So it was wierd there was no error about that.
  22. ruphert

    Running functions after LoadByteCode

    Oh my BinaryStream function was all wrong, my bad. But I got absolutely no errors or warnings about this. The byte code loader should inform that nothing got loaded.
  23. Wouldn't it be handy to have CScriptAny have operator overloads for at least the basic types so you can do: any x = 100; Has anyone done that already?
  24. ruphert

    Any class with operator overloads

    One more thing. I'd like to do this: SomeFunc( { x, y, "test } ); where void SomeFunc( any[]@ ) or void SomeFunc( any[] ) If you know actionscript, I think you know where I'm heading. Anyway I could accomplish this?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!