Ticket #45 (new task)

Opened 1 year ago

Last modified 1 month ago

Dodgeball module

Reported by: Maverick Assigned to: Maverick
Priority: normal Component: Bots - Multibot
Version: Latest version from repository Severity: minor
Keywords: Cc:

Description

Dodgeball bot (dodgeball as in strikeball game)

Basically if a player touches the ball (after being shot) after 3 seconds, he's out.

More information and discussion: http://forums.trenchwars.org/showthread.php?t=28041 (TWDev+ only)

Attachments

BallPosition.java (3.7 kB) - added by Maverick on 03/31/08 04:11:43.
Modified BallPosition packet, should be placed in package twcore.core.events.

Change History

08/02/07 11:36:28 changed by Charis

  • owner set to Charis.
  • status changed from new to assigned.

08/02/07 18:58:37 changed by Charis

Note:

Team dodgeball team has sides a horizontal line at X,512 across. Teams speced if they cross that. Arena already created and in twdev. No 1 eliminator. Cant get own team out.

(follow-up: ↓ 4 ) 08/03/07 08:21:27 changed by Maverick

I don't really understand what you're trying to say?

I recommend you to not focus on the map too much. The module is quite simple that should work on any map with a ball - it only spectates a player if he has touched a ball after 3 seconds of it being shot (note; if a player just picked up the ball without it being shot it should't spectate him).

(in reply to: ↑ 3 ) 08/03/07 12:33:27 changed by Charis

Replying to Maverick:

I don't really understand what you're trying to say? I recommend you to not focus on the map too much. The module is quite simple that should work on any map with a ball - it only spectates a player if he has touched a ball after 3 seconds of it being shot (note; if a player just picked up the ball without it being shot it should't spectate him).

It was a note to my self there was some changes to the ticket

12/17/07 16:25:15 changed by milosh

  • owner deleted.
  • status changed from assigned to new.

I've been helping Charis with this project and he has decided it is a little too advanced for him as an initial project. I'm going to put this back up for grabs if anyone wants to take it and find him a more suitable entry project.

02/14/08 01:13:29 changed by milosh

  • owner set to milosh.
  • status changed from new to assigned.

No one has offered to pick this up, so I'll make quick work of it. As I understand it this is what the bot needs to do: *Create two teams of equal player amounts *Shipreset and GO GO GO *Reset the ball game *Spectate players that touch a ball within 3 seconds of it being fired *Spectate players that cross the center line *If a player scores a goal one of their spectated teammates returns into the game *If a team is completely spectated they lose and the game ends

If there's something I've misunderstood or further information that needs to be added please post it here and I will add it to my notes.

(follow-up: ↓ 8 ) 02/14/08 01:14:58 changed by milosh

No one has offered to pick this up, so I'll make quick work of it. As I understand it this is what the bot needs to do: * Create two teams of equal player amounts * Shipreset and GO GO GO *Reset the ball game * Spectate players that touch a ball within 3 seconds of it being fired * Spectate players that cross the center line * If a player scores a goal one of their spectated teammates returns into the game * If a team is completely spectated they lose and the game ends

If there's something I've misunderstood or further information that needs to be added please post it here and I will add it to my notes.

(in reply to: ↑ 7 ) 02/14/08 01:31:42 changed by Maverick

Replying to milosh:

- Create two teams of equal player amounts

No need, host can do this with other utilities if necessary (arena settings are going to be 1 player per frequency).

- Shipreset and GO GO GO
- Reset the ball game
- Spectate players that touch a ball within 3 seconds of it being fired
- Spectate players that cross the center line
- If a player scores a goal one of their spectated teammates returns into the game
- If a team is completely spectated they lose and the game ends


Basically, (as I see it) the module only needs to do basic dodgeball functionality:

  • !enable-like command that enables the bot behaviour (spectates players when they touch the ball within 3 seconds after fire)
  • No need to do anything beyond that imo, no need to spectate players if they cross a line or do anything on a goal. (Scoring goals shouldn't be possible at all.)
  • You can make the bot announce a winner but it's probably better if the host takes care of this (lazy—)
  • You can make the bot center the ball on a command, this can be very helpfull to the hosts. To center the ball, the bot has to pickup the ball and release it at the desired coordinates (default=center).
    You can also make the bot "steal" the ball from a player carrying it by performing a small trick. More info here. (This might require creating a few new packet handlers though.)

Small tip: Try making the module without using TimerTasks. It it's probably far more easier to store the current time in milliseconds and then comparing that stored time to the current time when the ball is picked up again.

02/14/08 01:39:05 changed by milosh

Would this event have multiple balls or just one?

02/14/08 01:42:32 changed by Maverick

It would be best if the module can be made to work with multiple balls by default (it isn't much harder to do). If there is 1 ball used, the bot acts on that 1 ball. If there are multiple, the bot acts on multiple.

02/14/08 01:48:33 changed by milosh

Yes, the difference is in having the bot reset the ball locations. My gut reaction to a solution is to have the bot change everyones frequency/ship and grab/place each ball one by one then change them back to their teams.

02/14/08 02:04:29 changed by Maverick

That's not needed as the bot can "steal" the ball from any player (it actually grabs the ball while the player is holding it). The bot only needs the ball id and then releases it at the desired location after which the bot returns to spectator.

With multiple balls the bot can be made to move a certain ball (by ball id) or all (cycles all available ball ids in the arena).

02/14/08 02:15:49 changed by milosh

Ah, that post threw me off haha. The last post was the only one I needed to read. Thanks for the information.

03/31/08 00:01:43 changed by milosh

I'm stuck on this one… I see packets that update the Ball's position(which is also sent when a player CATCHES a ball) and a packet that would allow a bot to fire a ball. I don't see how I can pinpoint the time when a player fires a ball so as to make it "hot" for a time period. All suggestions are welcome.

03/31/08 04:08:06 changed by anonymous

I've done some research.

The BallPosition packet can be used to determine where the ball is, if it's catched and if it's fired.

It got the following fields (excl. the type byte):

  • Ball ID
  • X Location (pixels, not in tiles)
  • Y Location (pixels, not in tiles)
  • X Velocity
  • Y Velocity
  • Player ID
  • Timestamp

You would assume that as soon as the ball is catched, the player ID changes to the player carrying the ball and as soon as the ball is fired, the player ID is reset to -1. This is correct for the catching part but unfortunately not for the firing part.
When the ball is fired, the player ID remains set to the player ID who last had the ball.

I've checked Mervbot and I found out that you can use the timestamp to check if the ball is carried or not - the timestamp is 0 if it's carried. For the rest it seems the timestamp is the difference between the last change and the current timestamp. However, this doesn't explain the negative number as timestamp once the ball is fired (and the repeating of that negative number).

So this fix this issue, I added a carrier short variable to the BallPosition packet which can be used to see if the ball is carried or not and by whom. By monitoring this variable (and remembering the last carrier) you can determine when the ball is fired and grabbed.

I will commit these changes to the BallPosition packet soon.

03/31/08 04:09:23 changed by Maverick

… or if you really need the change soon, I will attach it to this ticket so you can commit it yourself, milosh.

03/31/08 04:11:43 changed by Maverick

  • attachment BallPosition.java added.

Modified BallPosition packet, should be placed in package twcore.core.events.

04/30/08 16:19:32 changed by milosh

  • component changed from Bots - Other to Bots - Multibot.
  • summary changed from Dodgeball bot to Dodgeball module.

07/19/08 18:07:40 changed by milosh

  • owner changed from milosh to Maverick.
  • status changed from assigned to new.

I had this module nearly finished, but I lost it during some rearranging of files. It looks like MMav has taken up this task, so I'm reassigning the ticket to him.

07/20/08 04:32:35 changed by Maverick

Oh sorry, I didn't know (or forgot) you almost had it completed.
I was bored at work one day and decided to do some work on it.

07/20/08 04:46:46 changed by milosh

Everything worked out for the best since I lost the file; I did have most of it done and working except for the bot setting up the balls in a line though. Thanks for taking up the task in my absence.


Add/Change #45 (Dodgeball module)




Change Properties
Action