Author Topic: Getting Oak Bot Tutorial To Work  (Read 3867 times)

Offline Greenwood

  • Newbie
  • *
  • Posts: 30
    • View Profile
  • Rated:
Getting Oak Bot Tutorial To Work
« on: March 21, 2009, 05:00:39 PM »
Hi,

I'm pretty new to programming, but I figured I'd try and see what's involved in getting a bot to work in Quake 2. So anyway I came across this tutorial for making a server side bot, and I compiled it, but it doesn't quite work properly. The bot spawns, but it doesn't spawn on a spawn pad- it just spawns in the middle of nowhere, and then if you shoot it, it dies and comes back in the same place. Anyone know what might be going wrong?

The tutorial is up here:

http://www.quake2.com/dll/

under tutorials/ "Quake II Oak II Tutorial"

The source code for the bot is here: http://www.quake2.com/dll/tutorials/bot/src.zip

That doesn't create a proper bot, just one that spawns like I said. I also had to mess around with it a bit to get it work in the latest version of Quake 2, as I think it was written for an earlier version. Anyway as I said I really don't have a clue what I'm doing but I figured I'd try and learn a bit at a time, if anyone's willing to explain why it's not spawning appropriately.

Thanks.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline [BTF] Reflex

  • Loquaciously Multiloquent Member
  • ****
  • Posts: 5324
  • !
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #1 on: March 22, 2009, 01:09:36 PM »
Not a clue about programing or anything,  dunno if this is the issue.

but alot of maps (even dm maps) have a single player spawn,  that doesn't have a spawn pad.

example would be q2dm1.  Spawn pads are all over the map, but the one single player spawn is in the center of arena.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Sometimes I think it’s a sin when I feel like I’m winnin’ when I’m losin’ again

Offline peewee_RotA

  • Brobdingnagian Member
  • ***
  • Posts: 4152
  • Hi, I'm from the gov'ment and I'm here to help you
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #2 on: March 22, 2009, 02:26:26 PM »
Did you go through all 5 tutorials? The first few are only for making the bot appear in game and be able to be killed, not for it to have any kind of full functionality.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
GOTO ROTAMODS (rocketgib)
GOTO ROTAMAPS (fireworks)
HappyFriar- q2server.fuzzylogicinc.com
 Tune in to the Tastycast!!!!  http://dna.zeliepa.net

Offline Greenwood

  • Newbie
  • *
  • Posts: 30
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #3 on: March 22, 2009, 03:31:08 PM »
Not a clue about programing or anything,  dunno if this is the issue.

but alot of maps (even dm maps) have a single player spawn,  that doesn't have a spawn pad.

example would be q2dm1.  Spawn pads are all over the map, but the one single player spawn is in the center of arena.


Thanks for the idea mate. Yeah I thought about something like this, since I've done some mapping before. I tried it in one of the original game maps (the one the single player game starts in) just now and the results were pretty weird. The bot spawned pretty near to where you start the single player game, knee deep in the floor.

Did you go through all 5 tutorials? The first few are only for making the bot appear in game and be able to be killed, not for it to have any kind of full functionality.

Well if you open up the 5th tutorial, there's a zip of the source code, which seems to include everything from all 5 tutorials. It's the one I mentioned, and it's what I compiled to get the bot running. Well, actually I didn't exactly do that- what happened was, when I tried to compile that and use it with Quake 2, it didn't work. I guessed it might be because it was based on an old version of Quake 2. So what I did was get the source code for the latest version of Quake 2 from id's website, then I copied all the oak bot stuff into the latest id source code, and compiled that to get me a new dll. To my amazement it worked, and it let me spawn bots. In certain maps, anyway. If I try it in Q2DM1, I can't find the bot. If I do it in Q2DM2, it spawns in the water beneath the BFG.

I figured spawning on spawn pads would be included, because that source seems to include everything from all the tutorials. The thing is though, if you look at the code, it includes stuff that seems like it should spawn the bot properly. In oak.c, there's a function SP_oak, which seems to be the function to add a new bot to the game. In that there is the following code:

   // spawn the bot on a spawn spot
   newOak = G_Spawn();
   SelectSpawnPoint (spawn_origin, spawn_angles);
   VectorCopy (spawn_origin, newOak->s.origin);
   newOak->s.origin[2] += 1;   // make sure off ground


I get the impression that stuff seems like it's meant to spawn the bot properly, although like I said I don't understand it that well. Thanks for the response, though, I really appreciate your help. I don't suppose you'd have time to take a look at the source zip and see what's wrong in there?
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline Jay Dolan

  • Swanky Member
  • *****
  • Posts: 644
    • View Profile
    • Quetoo.org
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #4 on: March 23, 2009, 06:51:55 PM »
Without setting newOak->think to a proper think() function, and newOak->nextthink = level.time + 0.1, the bot is not going to do anything.  All you've done there is allocated a new entity and moved it to the spawn point.  In fact, with just that code there, the entity has no model, mins, maxs, solid type, etc..  What you have there is probably 20% of what is needed to properly initialize the entity.  Additionally, there is all of the actual AI code.. which I'm assuming is buried somewhere in that tutorial?

Anyway, best of luck -- but learning how to mod Quake2 in 2009 is kind of pointless.  You'd be doing yourself a huge favor by starting with something newer (perhaps not even a Quake engine).

Offline quadz

  • Loquaciously Multiloquent Member
  • ****
  • Posts: 5352
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #5 on: March 23, 2009, 07:42:52 PM »
Anyway, best of luck -- but learning how to mod Quake2 in 2009 is kind of pointless.  You'd be doing yourself a huge favor by starting with something newer (perhaps not even a Quake engine).

...says the author of quetoo and quake2world ?   :evilalien:

  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
"He knew all the tricks, dramatic irony, metaphor, bathos, puns, parody, litotes and... satire. He was vicious."

Offline Jay Dolan

  • Swanky Member
  • *****
  • Posts: 644
    • View Profile
    • Quetoo.org
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #6 on: March 23, 2009, 08:24:56 PM »
Correct -- I started modifying the engine in 2006, and that was still too late.  Unless you want to replace more than half of the code to make it even close to relevant to today's games, file Quake2 in the nostalgia bin and learn a newer code base.

But well played, sir ;)

Offline Greenwood

  • Newbie
  • *
  • Posts: 30
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #7 on: March 24, 2009, 01:13:58 AM »
Basically the whole point of this thing is that I made this chat bot thing a while ago in C++, and I want to integrate it with a bot in a game. To be honest I just decided to use Quake 2 because it seems the easiest way.

I thought about using UT2004, but if I do that, I have to basically write some C++ code to communicate with the game via UDP or TCP, because my chat bot thing is in C++, and you have to write stuff for UT2004 in UnrealScript (obviously you then have the game communicate with the C++ chat bot program via UDP or TCP while it's running). The UnrealScript part seems like it could be pretty simple, but the UDP/ TCP part on the other hand sounds like a nightmare for someone new to programming like me.

Or is that wrong? How had would it be to get a C++ program interacting with UnrealScript via TCP/ UDP?

Thanks for the advice anyway.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline quadz

  • Loquaciously Multiloquent Member
  • ****
  • Posts: 5352
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #8 on: March 24, 2009, 04:53:37 AM »
Basically the whole point of this thing is that I made this chat bot thing a while ago in C++, and I want to integrate it with a bot in a game. To be honest I just decided to use Quake 2 because it seems the easiest way.

Given your stated goal, integrating your C++ chat code with a Q2 bot seems perfectly reasonable to me.

You may want to provde an extern "C" interface to your C++ chat code, unless the Q2 bot code you're working with is also C++.


Regards,

quadz

  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
"He knew all the tricks, dramatic irony, metaphor, bathos, puns, parody, litotes and... satire. He was vicious."

Offline Paril

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #9 on: April 05, 2009, 05:53:55 PM »
Anyway, best of luck -- but learning how to mod Quake2 in 2009 is kind of pointless.  You'd be doing yourself a huge favor by starting with something newer (perhaps not even a Quake engine).

I beg to differ. It's a nice starting point for beginner programmers. I get a lot of requests from people stepping into Quake2 on how to start programming, always wanting to either give back to the community or get started with the language.

In any case, the OAK Bot tutorial was chock full of 3.14-related bugs, you'd be better off downloading ACE source and starting with that.

-Paril
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1366
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #10 on: April 05, 2009, 08:41:18 PM »
I know Paril started programming at a young age in Q2 and he was a "beginner" at the time but I wouldn't say Q2 code is a good way for a raw C beginner programmer to learn to code in C. Quake 2 is NOT a good example of state of the art C programming. It has lots of hacks and certainly some bad practices (like using magic numbers in the function calls and other places) that can drive you to distraction sometimes. They also crammed a lot into the header files here and there instead of creating new headers to be included for interfacing to more modular translation units. The published tutorials continued the bad habits by inserting mod code into the headers willy-nilly as they added features and weapons.

For example, if you are creating a new weapon, it would be better to create new_weapon.h and new_weapon.c and put the prototypes and constants it needs in the header and the functions in the .C file and then include the header in g_local.h than it would be to scatter function prototypes and constants throughout g_local.h and q_shared.h as shown in the online tutorials. The orginal coders seldom properly documented what they were doing and why. The result is you get to stare at the code sometimes wondering WTFWTT. One of my favorite untangles of inscrutable magic was the CreateStatusBar function and all the magic numbers that were used instead of the almost-properly-already-defined STAT_* constants and the resulting conflicts between DM and CTF modes. Yes, Q2 is a fine example of C code. It is also sometimes a fine example of what NOT to do.

It can be a fun way to learn how to code Windows DLL's for portability to Linux shared libraries. :)
« Last Edit: April 06, 2009, 05:56:31 AM by QwazyWabbit »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline Paril

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #11 on: April 06, 2009, 04:47:12 PM »
Of course Quake2 on it's own isn't the best way to learn C, but it's probably one of the best ways to start learning from the ground up of how ID Software does things. Personally, Quake was the project that got me started, and I've helped a few get started with it as well, but of course it's not ALL Quake2, reading tutorials and references is a big part of learning it.

Also, about Quake2 being bad in it's "design areas", I agree, but that's what CleanCode will be made for ;)

-Paril
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline Greenwood

  • Newbie
  • *
  • Posts: 30
    • View Profile
  • Rated:
Re: Getting Oak Bot Tutorial To Work
« Reply #12 on: April 29, 2009, 10:30:44 AM »
Thanks for the responses to this thread, guys. Based on what I've read here (and the time it took me to do even simple things with the Oak bot) I think I'm just going to focus on getting the basics of C++ down for the time being. Also thanks for the suggestion about the Ace bot, Paril. I noticed a few problems with the Oak bot tutorial that I figured were due to it being written for an earlier version.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

 

El Box de Shoutamente

Last 10 Shouts:

 

Costigan_Q2

Today at 07:35:35 AM
Members
Total Members: 2921
Latest: provider

Date Registered : March 20, 2024

*laughs in slow clapping*
 

RyU

September 03, 2024, 05:15:49 PM
And wow Derrick is still playing lol
 

RyU

September 03, 2024, 05:15:15 PM
Just know yesterday is gone and soon tomorrow will be gone too  :)
 

Lejionator

August 08, 2024, 07:28:01 PM
It's tiem to QuakeCon!!!  ;)

https://www.youtube.com/watch?v=ThQd_UJaTys
 

ImperiusDamian

July 26, 2024, 09:34:53 PM
In nomine Quake II et Id Software et Spiritus John Carmack, Amen.
 

QuakeDuke

July 26, 2024, 05:10:30 PM
Hey, shout, summertime blues
Jump up and down in you blue suede shoes
Hey, did you rock and roll? Rock on!!  ...QD
 

Yotematoi

July 24, 2024, 01:31:20 PM
Ayer me mato 5 veces para robarme en la vida real hará lo mismo? [img]<iframe src="https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fzoloyoze.torito%2Fposts%2Fpfbid0wXU2VgS7atesBcSoMz5BWMJCJajeZFVT6GzSU6TtpJGddN9kLTvWNgcZaskkbKFQl&amp;show_text=true&amp;width=500
https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fzoloyoze.torito%2Fposts%2Fpfbid0wXU2VgS7atesBcSoMz5BWMJCJajeZFVT6GzSU6TtpJGddN9kLTvWNgcZaskkbKFQl&show_text=true&width=500" width="500"
 

Yotematoi

July 24, 2024, 01:25:59 PM
hi ya está la basura de Martin, se cambió el nombre es un ladron estupido, asi llegó a 10000[img]<iframe src="https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fzoloyoze.torito%2Fposts%2Fpfbid03hZrkDUBJPZKCuFgy5hRUy831ekKJYVRzC7ajXaKQbJ6xcPgKftLukUDfovFyEq3l&amp;show_text
https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fzoloyoze.torito%2Fposts%2Fpfbid03hZrkDUBJPZKCuFgy5hRUy831ekKJYVRzC7ajXaKQbJ6xcPgKftLukUDfovFyEq3l&show_text
 

Yotematoi

July 24, 2024, 01:25:59 PM
hi ya está la basura de Martin, se cambió el nombre es un ladron estupido, asi llegó a 10000[img]<iframe src="https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fzoloyoze.torito%2Fposts%2Fpfbid03hZrkDUBJPZKCuFgy5hRUy831ekKJYVRzC7ajXaKQbJ6xcPgKftLukUDfovFyEq3l&amp;show_text
https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fzoloyoze.torito%2Fposts%2Fpfbid03hZrkDUBJPZKCuFgy5hRUy831ekKJYVRzC7ajXaKQbJ6xcPgKftLukUDfovFyEq3l&show_text

Show 50 latest
Welcome, Guest. Please login or register.
September 21, 2024, 03:48:54 PM

Login with username, password and session length