View previous topic :: View next topic |
Author |
Message |
skelterjohn
Joined: 10 Mar 2008 Posts: 4
|
Posted: Mon Mar 10, 2008 6:15 pm Post subject: interfacing to C++ for bot coding |
|
|
Hi all,
My question is how feasible is it to take a mod (specifically Battlemech - [url]http://static.condemned.com/bmech.shtml[/url]), and interface it to a C++ code base to do AI. I have a rather large C++ code base for adaptive learning algorithms (I am a grad student at Rutgers University in the Reinforcement Learning lab), and porting it all to .qc is not really an option.
Any tips? I don't have experience in hacking id engines, but I'm willing to put the effort in.
- John |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Mon Mar 10, 2008 6:26 pm Post subject: |
|
|
edit pr_cmds.c
add some new builtins. there should be a list of em at the bottom.
index in that list is the builtin number its going to use.
use the G_* macros to read/write parameters, and return value.
How easy it is really depends on what existing interfaces you already have with your c++ code. Contexts might be tricky. _________________ What's a signature? |
|
Back to top |
|
 |
Labman
Joined: 05 Nov 2004 Posts: 51 Location: Brisbane, Australia
|
Posted: Tue Mar 11, 2008 10:00 am Post subject: |
|
|
Tomaz's globot is an engine side bot written in C, so that might be a good place to start as well.
The Vr2 codebase has it, its not the original one as i've hacked around with it a bit, check out the bot.c, bot_*.c and bot.h files you can download the source and other stuff at entar's site http://entar.quakedev.com/
Also theres nn_main.c which contains an almost finished artificial neural network system for learning. |
|
Back to top |
|
 |
Wazat
Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA
|
Posted: Tue Mar 11, 2008 4:54 pm Post subject: |
|
|
Note that he's pretty keen on having an engine that runs without problems in Linux (he and I have been talking by email). He's able to run Bmech's TomazQuake (the default engine) without problems, so I'm assuming TQ and related engines are are inherently linux compatible unless something has been done to break that compatibility.
He also wants to avoid coding his AI in QC, as the things he's trying to do will not lend themselves well to QC's abilities. He will need true arrays, large processing power, etc. As FrikaC and other bot coders will probably tell you, there's a few nasty limitations that QC requires you to overcome or compensate for, and building the bot in the engine's C code is actually going to be a very good idea. It's especially nice that Tomaz has already provided a basic bot in his code to build off of, so he doesn't have to worry about how to plug into Quake's client system etc.
Unfortunately, Darkplaces might not be an option because I can't get Battlemech's cameras to place nice with it (and he does want to use battlemech as the environment for his bots). However, I'll bet the TomazQuake family will more than serve his needs, so long as it's linux compatible etc.
Thanks for helping him out, everyone! _________________ When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work. |
|
Back to top |
|
 |
leileilol

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Tue Mar 11, 2008 7:09 pm Post subject: |
|
|
Try cl_movement 0? _________________
 |
|
Back to top |
|
 |
xaGe

Joined: 01 Mar 2006 Posts: 329 Location: Upstate, New York
|
Posted: Tue Mar 11, 2008 9:05 pm Post subject: |
|
|
That is needed leileilol, but its more than just that... The game plays fine under the last DP release with the exception of the mech's head movement. It goes from very jerky slow turning to jerky, jittery... Not sure if any setting could be changed to fix that yet?
leileilol wrote: | Try cl_movement 0? |
|
|
Back to top |
|
 |
skelterjohn
Joined: 10 Mar 2008 Posts: 4
|
Posted: Tue Mar 11, 2008 11:31 pm Post subject: |
|
|
So, I have DP built and running the battlemech mod (camera issues aside), but the source is a bit much for me at the moment. Anyone have some tips on what to look for to put in my own hooks? I scanned prvm_cmds.c (since a poster mentioned pr_cmds.c), but not sure what to do there... is there a particular source file that the AI is contained in?
People also mentioned globot as part of the TQ distribution, which I also downloaded (but have not been able to build in linux). I'm having the same trouble there, many source files and none of them are labeled "globot.c" (nor does the word globot appear at any point in the source, so it's possible it just isn't in this dist).
Any help is appreciated!
- John |
|
Back to top |
|
 |
Labman
Joined: 05 Nov 2004 Posts: 51 Location: Brisbane, Australia
|
Posted: Wed Mar 12, 2008 9:30 am Post subject: |
|
|
skelterjohn wrote: | So, I have DP built and running the battlemech mod (camera issues aside), but the source is a bit much for me at the moment. Anyone have some tips on what to look for to put in my own hooks? I scanned prvm_cmds.c (since a poster mentioned pr_cmds.c), but not sure what to do there... is there a particular source file that the AI is contained in?
People also mentioned globot as part of the TQ distribution, which I also downloaded (but have not been able to build in linux). I'm having the same trouble there, many source files and none of them are labeled "globot.c" (nor does the word globot appear at any point in the source, so it's possible it just isn't in this dist).
Any help is appreciated!
- John |
Globot while by Tomaz isn't in any TomazQuake version (afaik). If you really need to be using linux for this, then i would suggest:
1) Finding an engine that compiles on linux already which hopefully works with the mod you have.
2) Having a look here http://www.flyingsaucepan.com/QMB/Code/ for the latest version of the Globot code that i've worked on for the Vr2 engine (which you can get the source for at http://entar.quakedev.com/Vengeance%202-2-6%20source.zip if you need any more files to look. But Vr2 has never been ported to linux so that could be some work which is why i would suggest a different engine) |
|
Back to top |
|
 |
skelterjohn
Joined: 10 Mar 2008 Posts: 4
|
Posted: Wed Mar 12, 2008 6:17 pm Post subject: |
|
|
Thanks, Labman, this is going to be very helpful :)
- John |
|
Back to top |
|
 |
skelterjohn
Joined: 10 Mar 2008 Posts: 4
|
Posted: Thu Jul 24, 2008 6:28 pm Post subject: darkplaces and the turning bug |
|
|
Hey
Any darkplaces code experts in here? No problem getting darkplaces source to build and run battlemech, but there is an issue with the mouse turning the mech (ie, it doesn't). I think the basic issue is the mouse is trying to turn the entity that hovers above the mech rather than the mech itself, and then that this entity gets continuous setangle messages. Anyone know how to figure out which entity to use to control the mech itself?
- John |
|
Back to top |
|
 |
Electro
Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia
|
Posted: Thu Jul 24, 2008 10:14 pm Post subject: |
|
|
it has scarey comments throughout the code!
Code: | //#include "java_vm.h" |
_________________ Unit reporting!
http://www.bendarling.net/ |
|
Back to top |
|
 |
Labman
Joined: 05 Nov 2004 Posts: 51 Location: Brisbane, Australia
|
Posted: Fri Jul 25, 2008 10:50 am Post subject: |
|
|
Electro wrote: | it has scarey comments throughout the code!
Code: | //#include "java_vm.h" |
|
Java hater!!!
I had an interface to call java call from quake and was considering hooking it up so you could call java code from quakeC, but there was too much environment setup fluff to make java work.
Also this is unrelated to the question at hand.
It sounds like you have a camera object which is attached to the mech object that you want to control, there are some camera solutions around but that's not something i have expertise in |
|
Back to top |
|
 |
|