Pages: [1]
  Print  
Author Topic: Novice Programmer Wants to Make Bots for OA  (Read 8317 times)
bengreenwood
Nub


Cakes 0
Posts: 9


« on: October 17, 2007, 11:59:21 AM »

Hi.

I started programming with C++ a couple of months ago, and I think it'd be interesting to try making some bots for OA. I have in mind a bunch of original features, for example, the bots would have the ability to like or dislike other bots/ players, so that you would end up with little cliques of them forming, bullying etc. (I have some idea of how to do this because I'm doing a Psychology degree and I'm doing some stuff about how social behaviour evolves at a fundamental level.).

The problem is, I have no knowledge of making programs besides just running and compiling some pretty simple ones in Bloodshed.

So I'm wondering.. to make a bot like I described, do I need to re-compile the entire OA source code every time? Or do I just compile part of it? I heard you can make bots for Quake using Quake C, but isn't that a cut down thing? I mean, I think I'd rather use C++. The kinds of behaviours I want to implement might be pretty complicated, eventually.

Thanks for your help.
Logged
next_ghost
Half-Nub


Cakes 0
Posts: 76


« Reply #1 on: October 18, 2007, 05:42:54 AM »

Make is smart and doesn't recompile files which are already up to date.

No, C is NOT cut down in any way. C++ has some really nice features for abstraction but also gazillion ways to abuse them and make your code a huge piece of bloated crap. All you can do in C++ can also be done in C. You just need better coding skills and a much better coding style than an average C++ newbie who has just learned how to write a class template.

I'd suggest putting your C++ book on the shelf and reading something about plain C (like Kerninghan's and Ritchie's The C Programming Language aka "The C Bible"). C++ is a little different in some subtle things and REALLY different in thinking about your code. Also, without long prior coding experience, expect to see incomprehensible mess instead of game code. Learning to read code takes a while.
Logged
bengreenwood
Nub


Cakes 0
Posts: 9


« Reply #2 on: October 18, 2007, 06:04:05 AM »

Okay, thanks for the response.

But you just said it doesn't recompile everything. So presumably I don't need to read all that much code anyway. I mean.. making a very basic bot isn't that complicated in terms of actually understanding the programming language anyway, right?
Logged
next_ghost
Half-Nub


Cakes 0
Posts: 76


« Reply #3 on: October 18, 2007, 10:53:55 AM »

But you just said it doesn't recompile everything. So presumably I don't need to read all that much code anyway. I mean.. making a very basic bot isn't that complicated in terms of actually understanding the programming language anyway, right?

First, you have to know what you want to do (some general idea, I assume you already have it). Then you have to know how to translate your thoughts into something that can be written in a programming language (algorithm and data abstraction). Then you have to read a lot of code and find out how to fit your algorithm into existing code. How much understanding of programming language you need for the last part depends on how well the existing code is written and how much you have thought the algorithm through. You can do the second part without actually knowing the language but you must understand what can and what cannot be done easily.
« Last Edit: October 18, 2007, 10:56:00 AM by next_ghost » Logged
bengreenwood
Nub


Cakes 0
Posts: 9


« Reply #4 on: October 18, 2007, 12:51:05 PM »

Yeah I know what I want to do. Like I said I've learnt about social behaviour from a fundamental level so I've got a pretty good idea what I want to do with it. There are basically two main layers to the idea.

First, the bot is going to fight in a pretty similar way to other bots. As far as I'm aware this means setting up a series of points that the bot is going to use as a standard route around the level. It will make detours to pick up items/ weapons etc. If it sees other players it will shoot toward them (i.e. at points near them, but with a degree of randomness as to how near, to simulate human error). And so on.

Second is where the social behaviour comes in. Like in a lot of animals, this is going to be based around surprisingly simple instincts. Each of the bots has the same set of instincts. The differences in personality are expressed in the relative weights of these instincts.

For example, say there are 2 types of bot, one called "bully" and the other "bully follower". If one of the other players or bots drops behind the rest in terms of score, bully will identify this player as a victim. What this means is that bully will go after them more, perhaps toying with them, while saying pre-set insults like "player 7, could you be any more useless?". Now if bully follower "sees" bully doing this (it's obviously automatic because it's just a simulation of bully seeing the insult is on the screen), bully follower will also identify player 7 as a victim.

The tendency for hurling insults would also be instinctive, so that if it has a high weight, instincts are thrown with more frequency. Things get interesting when you combine such instincts with group formation instincts, such as "if another player is similar to you, be more likely to copy them & become their ally (which means stop shooting at them & start following them & start shooting at their enemy)". So obviously you would end up with little groups of bots that are allied with each other, etc. Perhaps they could say stuff like "bot 12, let's work together", etc. This could even open the door for deceptive instints, e.g. making allegiances and then splitting up when it's more beneficial.

Also obvious is that bots would need to remember shit between games. Setting the weights of the instincts would not be easy but if I start simple it should be do-able.

Obviously there are dozens of instincts to include, for example, revenge- if someone attacks you, single them out and attack them until they're dead. Again, remember that there would be a weight score so that this would be more likely to be carried out by some bots than others. Maybe the weight system would be executed differently for each instinct- for example for this revenge instinct, the higher the score, the greater the probability the bot will "decide" to keep attacking the revenge-recipient instead of breaking off and doing something more important.

There's a problem if some of the bots start teaming up with each other to win, because it's unfair and that would piss some players off. The thing is though, this is just one aspect of it. You could choose to only include bots who play more fair. Alternately, what I think would be brilliant would be a leaderboard system whereby after each game, the total scores are kept and added up. Basically, if you had some varied and cleverly designed bots, the player or bot at the top of that board would change regularly because they would each have their little group who helps them out- in other words, the skill for the player would be in figuring out how to get bots to work with you.

There could be all kinds of crazy shit, like if you offer to be a bot's ally, it's only willing to join if it's group can beat you up a bit first, like hazing rituals in the army etc.
« Last Edit: October 18, 2007, 12:53:24 PM by bengreenwood » Logged
next_ghost
Half-Nub


Cakes 0
Posts: 76


« Reply #5 on: October 18, 2007, 02:02:11 PM »

Great, you can start working on the algorithm.

Now if bully follower "sees" bully doing this (it's obviously automatic because it's just a simulation of bully seeing the insult is on the screen), bully follower will also identify player 7 as a victim.

And guessing from this, it'll take you about 2 years to really think it through. See you in 2009 then.
Logged
Pages: [1]
  Print  
 
Jump to: