Help with modifying the game

108 views
Skip to first unread message

Nathan Dench

unread,
Aug 28, 2012, 8:26:44 PM8/28/12
to robocode-...@googlegroups.com

I'm trying to modify the robocode game for a University assignment and I'm currently stuck so if anyone could help me that would be greatly appreciated. To modify the game I decided to create a new robot type that freezes other robots for a certain amount of turns when it runs into them. I have created a new interface for the freeze robot and altered some of the other code. When the game starts up it goes through all the robots that the user can choose from and creates a RobotPeer for them. And for each RobotPeer they all have a RobotType. If I debug the game here I can check the FreezeRobot that I made that implements the interface and it shows that it has both type FreezeRobot and AdvancedRobot. Which is what I want because if it doesn't implement AdvancedRobot then it can't use any of AdvancedRobot methods. So up till here everything is fine.

Though when I select the FreezeRobot and start a game with it then debug to check the RobotPeer, it is now only an AdvancedRobot. Can someone explain why this is?

In case you are wondering, what I am trying to do is to make edit the RobotPeer code in the checkForRobotCollision method. After it creates a new HitRobotEvent and sends that to the robot, I want to check if the otherRobot is a FreezeRobot and in this case it will change some variable that makes the robot frozen. I haven't worked that part out yet but I need to be able to see if the otherRobot is a FreezeRobot first so hence this post.

If anyone has any advice/tips/help it would be greatly appreciated. 

Thanks

Pavel Šavara

unread,
Aug 29, 2012, 4:06:06 AM8/29/12
to robocode-...@googlegroups.com
Hi Nathan,

I guess that more and more people would be given school task to play
with Robocode engine code and they will come here to discuss it.
The original purpose of this group is to discuss changes in Robocode
engine which are mean to stay, not to be just learning vehicle.
We maintainers are busy guys with families and daily jobs.
We could not replace your teacher without getting significant value
back for the project.

So I propose that
- school assignments could be discussed on this group,
- if there is another student or community member interested in
helping you here.
- topics have to be marked [school] prefix in subject
We maintainers would not invest our precious time unless you finished
something worth of merging into the project.

BTW: welcome to Robocode, I realy mean it :-)

Pavel

Nat Pavasant

unread,
Aug 29, 2012, 4:15:02 AM8/29/12
to robocode-...@googlegroups.com
Nathan:

I am not really sure about this (haven't been using Java for quite a
while), but I think you can check by

try {
FreezeRobot freeze = (FreezeRobot) otherRobot;
} catch (ClassCastException e) {}

Not really sure about it, though.

Pavel:

I completely agree with you; that's why I didn't moderate these kind
of messages.

I proposed that we should create another Robocode group (and deprecate
the yahoo one or sth). For me Google's are much more friendlier than
the Yahoo's, but maybe that is just me.

- Nat


2012/8/29 Pavel Šavara <pavel....@gmail.com>:

Pavel Šavara

unread,
Aug 29, 2012, 4:28:49 AM8/29/12
to robocode-...@googlegroups.com
> I proposed that we should create another Robocode group (and deprecate
> the yahoo one or sth). For me Google's are much more friendlier than
> the Yahoo's, but maybe that is just me.

It's not just you :-)
The google robocode user group already exist
https://groups.google.com/forum/?fromgroups=#!forum/robocode

We just need to update the homepage and wiki.
Flemming, what do you think ?

Flemming N. Larsen

unread,
Aug 29, 2012, 5:08:41 AM8/29/12
to robocode-...@googlegroups.com
Hi guys,

@Nathan: I will have a look on the issue later, when I get time. If you some sources to share with us/me (changed files), this would be great in order to help you out. E.g. share it somewhere on the net or send by mail to fnl (at) users.sourceforge.net? :-)

@Pavel and Nat: Yes, I guess we should deprecate the Yahoo group, and create a new forum, e.g. on Google. Nat, what do you have ind mind? :-)
I will take care of deprecating the Yahoo Group and eventually close it. But I need to tell people where to ask various types of questions. So we might need more groups. Some questions should be for RoboWiki.

@All: Currently, there is no where else to bring this kind of  question, so Nathan did not have much of an option in order to find the proper experts for this question, I guess.
It could also be relevant to this group, if we need to make it easier to implement new rules, robot types etc. - especially after haven moved the sources to GitHub. ;-)

Cheers,
- Flemming

2012/8/29 Pavel Šavara <pavel....@gmail.com>

Nat Pavasant

unread,
Aug 29, 2012, 6:28:43 AM8/29/12
to robocode-...@googlegroups.com
Never knew there is google group backing up all conversation from
Yahoo's; thanks! Yes, I am in flavour of deprecating the Yahoo's and
move to Google's. I think Pavel is writing a robocode contributing
guide, right?

Just found relevant thread on RoboWiki
http://robowiki.net/w/index.php?title=Talk:Main_Page&offset=20120829020017&lqt_mustshow=1509#Modifying_the_Robocode_Game._1503
, though not much are over there.
The Wiki is for discussing Robot's tactics, while this group is for
discussion development of Robocode core. Maybe this kind of question
should be asked in Robocode group, and forwarded to this if needed?
Not really sure about this.

Regarding the move to GitHub as Fnl said before: I really agree that
there should be simple way to implement new rules etc. Not sure if
this is feasible though, but I think allowing external lib to 'hook'
the Robocode engine would be great idea. Like if I want to hook up
battlefield, my own class get like onBattlefieldDraw(Graphics) to
manipulate the display and onRobotMove(sth) for movement blocking
(e.g. adding obstacle to the battlefield) etc. But just my two cents;
haven't really look into Robocode source for like two years already.

- Nat


2012/8/29 Flemming N. Larsen <flemming...@gmail.com>:

Pavel Šavara

unread,
Aug 29, 2012, 8:14:21 AM8/29/12
to robocode-...@googlegroups.com
> I think Pavel is writing a robocode contributing
> guide, right?
I'm not working on it.

Flemming:
the address already exist and you are manager :-)
robo...@googlegroups.com
https://groups.google.com/forum/?fromgroups=#!forum/robocode

Flemming N. Larsen

unread,
Aug 29, 2012, 5:51:38 PM8/29/12
to robocode-...@googlegroups.com
Sorry, I missed the mail with the Google Group for Robocode.
Yes, I believe we should use this one (group), and deprecate the Yahoo Group for Robocode. :-)

I will start this work now.

- Flemming

-----Oprindelig meddelelse-----
Fra: robocode-...@googlegroups.com [mailto:robocode-...@googlegroups.com] På vegne af Pavel Šavara
Sendt: 29. august 2012 14:14
Til: robocode-...@googlegroups.com
Emne: Re: [robocode-developers] [school] Help with modifying the game
Reply all
Reply to author
Forward
0 new messages