thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
I forget which chess master said it, but one of them said something like “Two players who play perfectly will always reach a stalemate – it is only when one player makes a mistake that the other can achieve victory”. OK that came out a bit more zen than I heard it but it was something like that :P
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
done! Updated the file. Now you can Ctrl+Click WHILE PAUSED to add a block. If you want to read it specifically, it is marked as ‘3’.
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
I finished putting together a package for all of you developers!
It includes a simulator class with the following features:
- Ability to pause and step forwards 1 frame at a time
- Ability to override bot controls step by step
- A runtime tracer that can be placed where you want
It is optimized for AS3 in CS5 but I’m sure it’ll be simple enough for anyone to adapt it to whatever develop they are using.
Here it is: http://dl.dropbox.com/u/38206940/TronBot.rar
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
FINALLY finished the first version of my bot!
He can locate and track enemy movements as well as avoid most simple traps:
http://dl.dropbox.com/u/38206940/HunterBot.swf
named ‘HunterBot’
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
jonathan: I know it’s easy enough to get around, I’m just saying it would be BETTER if it were… better.
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
figuring out enemy AI isn’t at all difficult. Only took me ~5 minutes to write the code (which will also take into account all possible starting positions).
If you wanted to make this PERFECT then you would change the field array to be [x][y], and change the directions to start with RIGHT=0 and go around clockwise. That would make everything so much simpler to work with.
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
bleh, and just when I finished a work-around to detect the first round… :P
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
oh, also, can you do the thing where it reinstantiates the bot every new game, instead of keeping the same bot instance?
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
Y X Coordinates?!?!?!?!?!!!!!?!??!!!
1) that’s confusing
2) that’s confusing
3) that’s confusing.
please change it to the proper X Y… that’s the standard… or just make it 1d array where 40*y+x will return you the proper value.
Or if you’re not going to do that then at least LET US KNOW cus that would be helpful.
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
ok… I can program the Player1 bot well enough, but I’m having problems with the Player2 bot. It doesn’t seem like it’s reading its own position properly! Please help!
I figured out another problem… it seems like it keeps the same instance between matches so the variables aren’t reset. Is it possible to reinstantiate both bots every time so that any running counters etc. can be returned to 0?
EDIT: Nevermind, it’s not player 2…. it’s both players. It seems like it isn’t reading the walls properly.
It reads the POSITION fine because my Typewriter Bot works fine:
package {
public class Typewriter extends TronBot {
/*********************************
FROM BASE CLASS:
public static const LEFT:int = 0;
public static const RIGHT:int = 2;
public static const UP:int = 1;
public static const DOWN:int = 3;
public var player:int;
**********************************/
public function Typewriter(_player:int = 1){
super(_player);
}
override public function eval(_field:Vector.<Vector.<int>>, _posX:int, _posY:int, _cDir:int):int {
if (player==1){
if (_posY%2==1){
if (_posX==0){
return UP;
}else{
return LEFT;
}
}else{
if (_posX==39){
return UP;
}else{
return RIGHT;
}
}
}else{
if (_posY%2==0){
if (_posX==39){
return DOWN;
}else{
return RIGHT;
}
}else{
if (_posX==0){
return DOWN;
}else{
return LEFT;
}
}
}
}
}
}
but it doesn’t read the walls because my SimpleTron doesn’t work:
package {
public class SimpleTron extends TronBot {
/*********************************
FROM BASE CLASS:
public static const LEFT:int = 0;
public static const RIGHT:int = 2;
public static const UP:int = 1;
public static const DOWN:int = 3;
public var player:int;
**********************************/
public function SimpleTron(_player:int = 1){
super(_player);
}
override public function eval(_field:Vector.<Vector.<int>>, _posX:int, _posY:int, _cDir:int):int {
if ((_posX>0)&&(_field[_posX-1][_posY]==0)){
return LEFT;
}else if ((_posX<39)&&(_field[_posX+1][_posY]==0)){
return RIGHT;
}else if ((_posY>0)&&(_field[_posX][_posY-1]==0)){
return UP;
}else if ((_posY<39)&&(_field[_posX][_posY+1]==0)){
return DOWN;
}
return _cDir;
}
}
}
Unless I’m misunderstanding something in the code…
EDIT: It isn’t my code; I just wrote my own little program to run a test using your paramaters and it runs fine! So unless I’m misunderstanding how your field is set up, something is screwy in your code.
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
wtf? Where is the 0 point of the array? I was assuming it was top left and drawn right and down… is this not true?
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
are we allowed to build other classes to use as assets, or does everything need to be kept in this one class?
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
oh, also, I’m going to write my code specifically for one opponent on an empty board. There’s discussion on FGL of doing multiple opponents and perhaps throwing in obstacles. If this is a possibility I’d like to know from the beginning so I can keep my code a bit more adaptable.
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
Horray! It works! Thanks for the guide.
I’ve already got a bunch of notes written up when this contest was first conceived what, a year ago? I’ll get to work making my bot now :)
I notice there is no deadline posted…
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Bot Battle [#1] : Tron
can you give me an idiot’s guide to packaging my bot? I don’t understand… do I upload a .as file? or a .swf file? do I extend the class or just overwrite it? wtf do I do?
oh, and is there any way to pass in enemy location, or do i have to figure that out myself?
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Barycentric Coordinates?
… what kind of project are you working on that required Barycentric Coordinates? Now I’m curious!
|
|
|
thepeasant
255 posts
|
Topic: Collaborations /
Society Creator - Now Recruiting
dude, that sounds like an awesome concept! I’m not an artist but if I were I would totally join the team!
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Actionscript 3 - CLICK vs. MOUSE_DOWN
actually, ‘click’ is if a mouse up event happens on the same object as the last mouse down event. It has nothing to do with time.
|
|
|
thepeasant
255 posts
|
|
|
|
thepeasant
255 posts
|
|
|
|
thepeasant
255 posts
|
|
|
|
thepeasant
255 posts
|
Topic: Collaborations /
Programmer needed!
Know what… that game is awesome!
I don’t think anyone who wants to remake it will need any of the resources – it’s a pretty simple concept and seeing the AS1 code won’t help any programmers to make an updated version.
I might be interested in coding a simple updated version, if someone out there wants to do the graphics for it?
|
|
|
thepeasant
255 posts
|
Topic: Collaborations /
Let's make an iPhone game!
starfire: I sent you a private message, did you get it?
|
|
|
thepeasant
255 posts
|
Topic: Collaborations /
Story ideas needed!
Main character has a boring 9-5 job and feels trapped and alone, considering suicide.
Main character accidentally kills a person while drunk-driving and doesn’t know how to deal with the grieving family.
Main character dropped LSD and developed skitsofrenia and now has to try and sort out what’s real and what’s not.
Main character gets mistaken for a wanted criminal and now has to decide if he should flee from the law or turn himself in.
Main character gets a job at a pie factory. Hilarity ensues.
|
|
|
thepeasant
255 posts
|
Topic: Game Programming /
Feeling down about programming
I hate the little details and finishing touches. For me, I have oodles of motivation for the tough parts, until I get the basic system done. Then when it’s time to tweak things, build menus, etc. it starts to feel tedious. What I do is just do it. Remind myself that I’ve come too far to just set it aside. Having a partner helps too, because if you know someone’s counting on you it really adds to your motivation.
|