Just a bot thought!
#1

Hello,

*This is for discussion, there is no pressure on devs, admins, etc. It's just speculation.

I've seen many posts about people saying that there should be bots similar to the ones in single player. In replies to these posts, others have said that it would take too much memory and bandwidth to synchronize the bots amongst the clients.

I can agree with the memory/bandwidth usage problem, but I believe that the process of synchronizing the bots can be modified to take less bandwidth, but it would require a little more calculation, etc.

The general idea that I've seen floating about is that bots would have to be synchronized at all times, for every player. So, what if you didn't synchronize them at all times?

I look at it like this. Other on-line games, with bots roaming about seem to run smoothly, and do have sync, but there is some lag, there will always be lag. After a bit of thinking(and common sense), I realized that these games do not remember the position of every bot on the map, that would be extremely resource heavy.

Instead of remembering the position of every bot, the server uses the position of the players, and some basic spawn areas along the sides of the streets, to decide wherever bots should spawn. With the player location, and the bot spawn areas, the client will create bots at the edge of these areas(VIA a script built into the SA:MP client). So, if the player is in the road standing, not moving whatsoever, bots would only spawn about 20 units away from the player, and would walk towards the other side of the spawn radius, along the pathway determined by the bot paths in the spawn area. If a bot spawned on one side reaches the other side of the spawn area, the bot is deleted, and the client script creates another in it's place, randomly in the same fashion.

At this point, we basically have one player, roaming the map with a simulated population, when in reality, there are only 10 or so client side bots being spawned around him, depending on his position.

If another player was to join the server, he/she would also get their own set of bots. These bots would be created in the same manner as the first players' bots. This would result in 10 bots for each player, but the server would not have to worry about any. At this time, bots are completely client side. These bots have a mini script, built into the client, that basically says, once the bot exceeds the player's view radius, you are destroyed. This prevents the bots from being created over and over. Also, because of this client-side script, the server does not need to worry about the bot's positions.(Yes, client side scripts are possible, but this script should be built into the SA:MP client, that way it cannot be modded, etc)

Now, lets say that these two players meet up. To decrease the amount of bots, both of the player's spawn areas would kind-of merge. So if the players are standing next to each other, instead of having 20 bots for both , they only really need 10, because they are in the same area. As they come closer, their bot spawn radius would change. As it merges, the 20 bots that both players have slowly decreases to 10, and as this happens, bots spawned within both player's spawn radius sync for both players. These synced bots, are now managed by the server. The end result being that both players can see 10 bots, walking the streets, and see them synced correctly.

Of course, the sync would take a little bandwidth, something equal to that of player sync. But the advantage is that if a player is alone, the server doesn't need to worry about syncing that player's bots, because only he/she has to see them.

I hope this post don't tick anyone off, and please don't delete it. I just wanted to post it out there, because it was bugging me.(I felt like I had to post it)

Thanks,

CodeMatrix

Reply


Messages In This Thread
Just a bot thought! - by XPlatform - 06.09.2009, 10:12
Re: Just a bot thought! - by XPlatform - 13.09.2009, 18:43
Re: Just a bot thought! - by Abernethy - 14.09.2009, 07:17
Re: Just a bot thought! - by Littlejth - 20.09.2009, 00:36
Re: Just a bot thought! - by Sam - 23.09.2009, 10:23
Re: Just a bot thought! - by Correlli - 23.09.2009, 16:01
Re: Just a bot thought! - by ғαιιοцт - 23.09.2009, 16:44
Re: Just a bot thought! - by Donny_k - 23.09.2009, 20:40
Re: Just a bot thought! - by ғαιιοцт - 23.09.2009, 20:47
Re: Just a bot thought! - by Donny_k - 23.09.2009, 20:59

Forum Jump:


Users browsing this thread: 2 Guest(s)