[Home]PowerUpMod

Robo Home | Changes | Preferences | AllPages

This is a new mod for adding powerups to robocode. The powerups are robots which extend PowerUp?.

You can get all the files here: http://www.robocoderepository.com/BotDetail.jsp?id=1832

It will work without any changes to the normal bots, but it is advisable to make them extend PowerUpRobot? so you don't get PowerUps? in the onScannedRobot() method, and can use onScannedPowerUp?(ScannedPowerUpEvent? e) to find out where they are. You can also use getScannedPowerUpEvents?(). To get a powerup you simply ram them.

There are a few power ups in the zip file, that either give energy, take energy, or take all your energy (so you become disabled). When a powerup is used it jumps to a different (random) position. (i'm not sure what happens if it lands on top of another bot, i should probably test it...)

To make your own powerup simply make a robot that extends PowerUp?. The robot must have "XXX" somewhere in its name (make sure no non-powerup bots have XXX in their names, or other bots will think they are powerups). The first thing in your run() method must be init() (if it isn't the bot will crash). You then need to have a method called doPowerUp?(HitRobotEvent? e). The only thing powerups can do at the moment is change energy with the increaseEnergy() method. It take 2 parameters, the first is the amount of energy to add (to take energy just make it negative), and the second is the HitRobotEvent?, eg. increaseEnergy(20, e);

ToDo?:

  1. Add interesting colours so viewers can easilly pick out the powerups.
  2. Make a better method of recognising powerups than the XXX thing.
  3. Allow powerups to do more than just fiddle with energy. X
  4. Make powerup versions of the rest of the events (eg. onBulletHitPowerUp?())
  5. Make a onGetPowerUp?() method (basically a onHitRobot?() method for powerups);
  6. Make the getPowerUps?() method do more than just return a null vector. (at the moment there are no non-instantaneous powerups, so it isn't needed, but it will be by the next release)
  7. Stop bots losing energy when ramming powerups. X
  8. Stop bots gaining energy when shooting powerups. X
  9. Do number 6 quickly now there is a non-instantaneous powerup.
  10. Make own version of EnergySetter?. X

I recommend all future mods and future versions of existing mods extend PowerUpRobot?, rather than AdvancedRobot or TeamRobot (PowerUpRobot? extends TeamRobot), and have the extra events added to the event handling code, so power ups can be used with them. (no other changes are required)

I've just added another powerup to the zip file, XXXRapidFire?, it doubles your fire speed every time you hit it. I had to modify to PowerUp? class, and the EnergySetter? class. I will make my own version of the EnergySetter? class for the next release so i don't have to modify someone elses work. -- Tango

Comments and Questions

Has anyone had a go at this yet? I'd like some feedback if anyone has time to test it. -- Tango

This weekend I'll be rebuilding Cake to allow it to use both the DeathMatch mod and the PowerUpMod; I'll then see about adding some behaviour to get powerups :). I've been wanting to try this mod since it's been up, but I've been busy lately with midterms and Fractal's new gun. I should some free time soon :D -- Vuen

You don't need to change anything about cake to allow it to use PowerUps?, the changes just allow you to detect them. Are you going to make DeathMatchRobot? extend PowerUpRobot? or do you have some other cunning plan? -- Tango

I think I'll make an interface called CakeI? that contains every method that the rest of my classes need, then make a robot Cake that extends CoopRobot, one CakePW? that extends PowerUpRobot?, and one CakeDM? that extends DeathMatchRobot?, all of them implementing CakeI?. This will allow me to keep the same code and add ifs when I want to handle the game options (using a getGameMode?() method in CakeI?) for all modes of Cake. I'll likely implement the same thing in Fractal soon before it gets too complicated so that I can do this easily with Fractal once it becomes melee. -- Vuen

Sounds very complicated, but it seems like a good idea. You should be able to merge DMR and PUR quite easily. There is very little in PUR, all the complicated bits are in PowerUp?. -- Tango


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited November 12, 2003 18:07 EST by Tango (diff)
Search: