Botlib in Game VM


I ported the botlib (except the C preprocessor which is also used by Team Arena CGame/UI) into the Game VM. This required the ability to free memory, which was added in Spearmint devil branch and released in Spearmint 0.4. See botlib branch.

I’m planning to move files I had previously ported to Game VM back into the botlib. The main reason I’m holding off merging it into master branch is because BSPC requires parts of the botlib in the engine.

I have a bspc branch with it ported to mint-arena based on the botlib branch but it require a bunch of engine code, including BSP and ZIP loading and the C preprocessor, to be duplicated. :weary:

So I’m still working through how to handle this, but it will happen eventually.


To be honest, I can’t really help you with all this! Currently I also struggling with serious AI (botlib) problems.
So, just a few thoughts:

What I wonder is how the new memory system affects mint-iortcw (AAS Routing)? Maybe I do understand everything wrong, but doesn’t ‘trap_HeapMalloc’ replace’ ‘trap_Alloc’, which in turn replaced ‘GetClearedMemory’ as a similiar function?
Does this mean that the routing table (be_aas_routetable.c) will also move into game? Or is this a completely different story? I think the routing table is also using ‘AAS_RT_GetClearedMemory’!

Well, I assume you know some reasons why it was better to move lot of botlib code into game. For low-skilled programmers like me it’s nearly impossible to understand your code changes. Sometimes I wish the moved AI code back into botlib! But this is only due to lack of skill on my side…, so, I bet you will find a good solution!

Could this freeing of memory also be used to fix the old idtech3 bug where a crash happens if lot of bots/models are removed and another bunch of new bots/models are added afterwards? I think you know what bug I’m talking about (we talked about that bug a long time ago).
You know, if you have many different player models and remove them (e.g.: by a kickall command) and load another bunch of bots with different models the game will crash because assets (skins/textures/sounds) aren’t removed from memory.
Will using ‘trap_HeapFree’ fix this idtech3 bug?


Yes, trap_HeapMalloc replaces trap_Alloc and provides botlib GetMemory / malloc. be_aas_routetable.c will be able to be in the game VM.

trap_HeapFree does not affect renderer never freeing models, images, and skin surfaces.


Oh shit! I thought trap_HeapFree would/could flush the whole memory, even models, images and skins.
Sorry, I’m an idiot, I better continue playing chess instead of talking about programming like a pro!
Anyways, thanks for the clarification!

Do you plan to provide RtCW’s AAS worlds in Spearmint engine? For me it’s hard to do this even now! Not to think about that when be_aas_routetable.c will be in game vm! :worried:


Engine just loads AAS and lets game VM access it. AAS is all moving to game VM.