NTai XE10.1b - Page 76

NTai XE10.1b

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

At the time I had a working debugger which threw up all manner of errors that I could never have explained without a debugger. Of course having the line numbers helps enormously.
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

Then i guess the only option is to regress the SVN changes until we find the commit that caused this problem...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

That would likely introduce a slew of errors resulting from stl structures and boost::shared_pointer<>
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

Shit

Well i'll see what I can do anyway, can you think of any reasons at all why the bug would just effect mexes? what does NTai do differently when it builds a mex? Anything will help...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Are you sure it just affects mexes?

When it crashed for me that way it was never consistent and it was caused by the stl + boost issue I then solved and committed. =s I'm not sure how a bug I fixed has suddenly popped up again.
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

i can build six solars, no problem. As soon as it finishes a mex BOOM guaranteed. I'll try make a config without mexes and just get the AI to cheat and use makers to confirm this but i'm pretty sure
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I've done some experimenting and with some much needed help from brain damage in the lobby I now have an svn client and a compiled svn folder with an debug build of NTai.so.

He also told me how to debug it but I havent been able to as the svn copy of spring doesn't list ntai in the starting menu and I have to sort out a lua error.

So I'm going to try it again only with 0.75b2 source and copy paste svn NTai into the current build and test it out
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

sounds good, fingers crossed
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Progress!

First run with a stacktrace, not quite sure what the crash is saying, but progress nonetheless:

Code: Select all

bool CUnit::LoadBehaviours(){

	string d = G->Get_mod_tdf()->SGetValueDef("auto","AI\\behaviours\\"+ud->name);

	vector<string> v;

	CTokenizer<CIsComma>::Tokenize(v, d, CIsComma());

	if(!v.empty()){

		for(vector<string>::iterator vi = v.begin(); vi != v.end(); ++vi){

			string s = *vi;

			trim(s);

			tolowercase(s);

			if(s == "none"){

				return true;

			} else if(s == "metalmaker"){

				boost::shared_ptr<IBehaviour> t = boost::shared_ptr<IBehaviour>(new CMetalMakerBehaviour(G, *me));

				behaviours.push_back(t);

				t->Init(t);

			} else if(s == "attacker"){

				boost::shared_ptr<IBehaviour> t = boost::shared_ptr<IBehaviour>(new CAttackBehaviour(G, *me));

				behaviours.push_back(t);

				t->Init(t);

			} else if(s == "auto"){

				if(G->UnitDefHelper->IsAttacker(ud)){
					// THIS LINE BELOW CRASHPOINT
					boost::shared_ptr<IBehaviour> t = boost::shared_ptr<IBehaviour>(new CAttackBehaviour(G, *me));

					behaviours.push_back(t);

					t->Init(t);

				}

				if(G->UnitDefHelper->IsMetalMaker(ud)||(G->UnitDefHelper->IsMex(ud) && ud->onoffable ) ){

					boost::shared_ptr<IBehaviour> t = boost::shared_ptr<IBehaviour>(new CMetalMakerBehaviour(G, *me));

					behaviours.push_back(t);

					t->Init(t);

				}

			}

		}

	}

	return true;

}

Code: Select all

#0  0x00002aaab188f5ae in boost::detail::atomic_increment (pw=0x484962)
    at /usr/include/boost/detail/sp_counted_base_gcc_x86.hpp:66
#1  0x00002aaab188f629 in boost::detail::sp_counted_base::add_ref_copy (this=0x48495a)
    at /usr/include/boost/detail/sp_counted_base_gcc_x86.hpp:133
#2  0x00002aaab188f70e in shared_count (this=0x7fff2f42aa98, r=@0x7fff2f42ad98)
    at /usr/include/boost/detail/shared_count.hpp:170
#3  0x00002aaab188f8eb in shared_ptr (this=0x7fff2f42aa90)
    at /usr/include/boost/shared_ptr.hpp:106
#4  0x00002aaab188c06c in CUnit::LoadBehaviours (this=0xb0a4740)
    at AI/Global/NTai/AI/NTai/Units/CUnit.cpp:291
#5  0x00002aaab188e9a6 in CUnit::RecieveMessage (this=0xb0a4740, message=@0x7fff2f42ad20)
    at AI/Global/NTai/AI/NTai/Units/CUnit.cpp:88
#6  0x00002aaab1919619 in Global::FireEvent (this=0x8ef78b0, message=@0x7fff2f42ad20)
    at AI/Global/NTai/AI/NTai/Core/helper.cpp:1544
#7  0x00002aaab1927ec9 in Global::UnitFinished (this=0x8ef78b0, unit=2)
    at AI/Global/NTai/AI/NTai/Core/helper.cpp:476
#8  0x00002aaab1918365 in CNTai::UnitFinished (this=0x18e30a0, unit=2)
    at AI/Global/NTai/AI/NTai/Core/GlobalAI.cpp:113
#9  0x000000000057a647 in CGlobalAIHandler::UnitFinished (this=0x9acde00, unit=0xaf6e200)
    at rts/ExternalAI/GlobalAIHandler.cpp:201
#10 0x00000000007dfcb5 in CUnit::FinishedBuilding (this=0xaf6e200)
    at rts/Sim/Units/Unit.cpp:1699
#11 0x00000000007f1bc7 in CUnitLoader::LoadUnit (this=0xef4910, name=@0x7fff2f42b340, 
    pos=@0x7fff2f42b330, side=1, build=false, facing=0, builder=0x0)
    at rts/Sim/Units/UnitLoader.cpp:321
#12 0x000000000079a688 in CGlobalAITestScript::Update (this=0xf51ce0)
    at rts/Game/StartScripts/GlobalAITestScript.cpp:57
#13 0x00000000006d97a5 in CGame::SimFrame (this=0x1800f50) at rts/Game/Game.cpp:2322
#14 0x00000000006dff94 in CGame::ClientReadNet (this=0x1800f50) at rts/Game/Game.cpp:2734
#15 0x00000000006e426a in CGame::Update (this=0x1800f50) at rts/Game/Game.cpp:1776
#16 0x00000000006250f9 in SpringApp::Update (this=0x7fff2f42ba10) at rts/System/Main.cpp:838
#17 0x0000000000628e9c in SpringApp::Run (this=0x7fff2f42ba10, argc=1, argv=0x7fff2f42bb88)
    at rts/System/Main.cpp:1023
#18 0x0000000000629024 in Run (argc=1, argv=0x7fff2f42bb88) at rts/System/Main.cpp:1083
#19 0x000000000062924d in main (argc=1, argv=0x7fff2f42bb88, envp=0x7fff2f42bb98)
    at rts/System/Main.cpp:1136
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

got codeblocks working and I have this strange error =s anyone know anything that could help?
/usr/bin/ld: .objs/NTai/Agents/CManufacturer.o: relocation R_X86_64_32 against `vtable for SkyWrite' can not be used when making a shared object; recompile with -fPIC
.objs/NTai/Agents/CManufacturer.o: could not read symbols: Bad value
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

sorry don't have a clue what that can be but could work so far!
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

pretty much what it said - try adding -fPIC to compiler/linker flags...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Maybe I should have tried that earlier, its working now.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

ahk I have a major flawed event system.

I sue Boost::hared_ptr<IModule> for everything. My main event loop iterates voer a set<boost::shared_ptr<IModule> > array firing events, clss are passed pointers to their boost::shared_ptr<IModule> objects in their Init() function so they can register themselves with the event manager. This in combination with various STL containers is leading to the objects beign deleted so when I call that shared_ptr the AI crashes as soon as any reference to the 'me' variable is made or any other object dependant stuff that would be deleted.

I'm currently removing the me reference and its passing to Init and changign vector containers to set cotnainers but I dunno what good that'll do beyond cleaning up.
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

any progress on this AF?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I made a commit recently where the only bug I could see testing was that NTai sent the commander to teh enemy to attack which is easily fixable but I had to go so i never finished the test past 2-3 minutes.

test the latest svn.
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

ok great I'll try test that tonight
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I would put up a bianry but I've only just reinstalled vista, I need to setup my dev environment again and recover the ability to boot into ubuntu
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

OK I built it, had to but the #include assigner.h back into include.h to make it build.

The mex bug is fixed but there is still a crash bug which occurs randomly. Haven't had it occur since I turned uber logging on so can't give more detail than that yet.

the build with logging enabled is available here
Image

if anyone does get a crash then the last portion of the log may help
Last edited by DJ on 17 Oct 2007, 00:20, edited 1 time in total.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

remove assigner.cpp its deadweight. After that you should have no need of the assigner.h #include
Post Reply

Return to “AI”