Re: Robocode Tank Royale - Python?
Sarb <[email protected]> Mon, 30 Sep 2024 14:57:14 -0700 (PDT)
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_569060_350520098.1727733434021 Content-Type: multipart/alternative; boundary="----=_Part_569061_1303131124.1727733434021" ------=_Part_569061_1303131124.1727733434021 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Flemming, Perhaps you can help with a follow-up question. To help, I'd like to share= =20 some background of my use case. I am using Robocode to explore AI. Namely RL and Neural Nets. To expedite= =20 training, in the classic Robocode, I rely heavily upon the feature whereby= =20 minimizing the UI greatly speeds up the simulation and hence data=20 collection. Now I could have missed it, but is something similar possible= =20 in Royale? If so, I expect the simulation bottleneck would now be speed of= =20 websocket traffic right? BTW. My motivation for programming the bots in Python is of course to=20 enable use of existing libraries such as PyTorch & Tensorflow. Thank you, Sarb On Tuesday 24 September 2024 at 09:24:59 UTC-7 fnl wrote: > *Correction:* > Jython <https://www.jython.org/> is a Python implementation for Java,=20 > which can be used for the the existing Java Bot API=20 > <https://robocode-dev.github.io/tank-royale/api/java/dev/robocode/tankroy= ale/botapi/package-summary.html> for=20 > Robocode Tank Royale. > tirsdag den 24. september 2024 kl. 18.22.22 UTC+2 skrev fnl: > >> Hi Sarb, >> >> Currently, there are two official bot APIs for Robocode Tank Royale: >> >> *Java platform:*=20 >> https://github.com/robocode-dev/tank-royale/tree/main/bot-api/java >> *.Net platform*:=20 >> https://github.com/robocode-dev/tank-royale/tree/main/bot-api/dotnet >> >> And at some point I will introduce an API for web as well. >> >> If you want to build an API from scratch, you could choose to: >> 1) Create an API very similar to the current APIs that are made very=20 >> similar on purpose. Meaning that your Python API would have same classes= =20 >> and methods, but in Python style of course. >> 2) Create your own version and just use communicate with the server in a= =20 >> more "raw" fashion by communicating over a WebSocket. >> >> If you choose option 2, you need to send and receive messages using the = *protocol=20 >> *described here: >> >> https://github.com/robocode-dev/tank-royale/blob/main/schema/schemas/gam= e/README.md >> >> And the *schemas *(message formats) are available here (In JsonSchema=20 >> <https://json-schema.org/specification>format) >> https://github.com/robocode-dev/tank-royale/tree/main/schema/schemas/gam= e >> >> If you choose option 1, you should create something similar to *BaseBot = *as=20 >> a first step (like I did), which handles the basic communication between= a=20 >> bot and the server. >> Later you can create a *Bot *with more advanced methods as step 2. >> >> Also note that you could use the existing APIs as is. For example, we=20 >> have Jython <https://www.jython.org/>, which is a Python implementation= =20 >> for the existing Java Bot AP=20 >> <https://robocode-dev.github.io/tank-royale/api/java/dev/robocode/tankro= yale/botapi/package-summary.html> >> I. >> And you could use Python.Net <https://pythonnet.github.io/> for with the= =20 >> existing .Net Bot API=20 >> <https://robocode-dev.github.io/tank-royale/api/dotnet/api/Robocode.Tank= Royale.BotApi.html> >> . >> >> I you want to do a real Python API that are similar to the existing one,= =20 >> I will be happy to assist you. =F0=9F=91=8D >> I guess most code from the existing platforms can be translated without = a=20 >> big hassle for Python. I did the same for Java to .Net, and I will do it= =20 >> again later for the coming web API. =F0=9F=98=8A >> >> Best regards, >> - Flemming >> tirsdag den 24. september 2024 kl. 18.00.54 UTC+2 skrev Sarb: >> >>> Apologies if this question has already been asked. >>> >>> I am interested in developing bots in Python. It appears this may be=20 >>> possible with Robocode Tank Royale. How would I go about building a Pyt= hon=20 >>> bot API? Any pointers or guidance would be greatly appreciated. >>> >>> *Refs*: >>> >>> 1. https://robocode-dev.github.io/tank-royale/ >>> =20 >>> --=20 You received this message because you are subscribed to the Google Groups "= Robocode" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/= robocode/a5ddcfef-6691-453e-9ab2-03bce77d8e9en%40googlegroups.com. ------=_Part_569061_1303131124.1727733434021 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Flemming,<br />Perhaps you can help with a follow-up question. To hel= p, I'd like to share some background of my use case.<br />I am using Roboco= de to explore AI. Namely RL and Neural Nets. To expedite training, in the c= lassic Robocode, I rely heavily upon the feature whereby minimizing the UI = greatly speeds up the simulation and hence data collection. Now I could hav= e missed it, but is something similar possible in Royale? If so, I expect t= he simulation bottleneck would now be speed of websocket traffic right?<div= ><br /></div><div>BTW. My motivation for programming the bots in Python is = of course to enable use of existing libraries such as PyTorch & Tensorf= low.<br />Thank you,<br />Sarb<br /><br /></div><div class=3D"gmail_quote">= <div dir=3D"auto" class=3D"gmail_attr">On Tuesday 24 September 2024 at 09:2= 4:59 UTC-7 fnl wrote:<br/></div><blockquote class=3D"gmail_quote" style=3D"= margin: 0 0 0 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-lef= t: 1ex;"><b>Correction:</b><br><a href=3D"https://www.jython.org/" rel=3D"n= ofollow" style=3D"color:rgb(26,115,232)" target=3D"_blank" data-saferedirec= turl=3D"https://www.google.com/url?hl=3Den-GB&q=3Dhttps://www.jython.or= g/&source=3Dgmail&ust=3D1727819249011000&usg=3DAOvVaw1ymllKXUJd= cIYM4s-oAM_b">Jython</a>=C2=A0is a Python implementation for Java, which ca= n be used for the=C2=A0the existing=C2=A0<a href=3D"https://robocode-dev.gi= thub.io/tank-royale/api/java/dev/robocode/tankroyale/botapi/package-summary= .html" rel=3D"nofollow" style=3D"color:rgb(26,115,232)" target=3D"_blank" d= ata-saferedirecturl=3D"https://www.google.com/url?hl=3Den-GB&q=3Dhttps:= //robocode-dev.github.io/tank-royale/api/java/dev/robocode/tankroyale/botap= i/package-summary.html&source=3Dgmail&ust=3D1727819249011000&us= g=3DAOvVaw1sHBaHBcCfGvyzpLq7ZeB-">Java Bot API</a>=C2=A0for Robocode Tank R= oyale.<br><div class=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr"= >tirsdag den 24. september 2024 kl. 18.22.22 UTC+2 skrev fnl:<br></div><blo= ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 0.8ex;border-left:1px s= olid rgb(204,204,204);padding-left:1ex">Hi Sarb,<br><br>Currently, there ar= e two official bot APIs for Robocode Tank Royale:<br><br><b>Java platform:<= /b>=C2=A0<a href=3D"https://github.com/robocode-dev/tank-royale/tree/main/b= ot-api/java" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"htt= ps://www.google.com/url?hl=3Den-GB&q=3Dhttps://github.com/robocode-dev/= tank-royale/tree/main/bot-api/java&source=3Dgmail&ust=3D17278192490= 11000&usg=3DAOvVaw0QP0uFTEBcXsihTHkz1SLk">https://github.com/robocode-d= ev/tank-royale/tree/main/bot-api/java</a><br><b>.Net platform</b>:=C2=A0<a = href=3D"https://github.com/robocode-dev/tank-royale/tree/main/bot-api/dotne= t" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"https://www.g= oogle.com/url?hl=3Den-GB&q=3Dhttps://github.com/robocode-dev/tank-royal= e/tree/main/bot-api/dotnet&source=3Dgmail&ust=3D1727819249011000&am= p;usg=3DAOvVaw0kRKYfBG9EBq7LkNhF9437">https://github.com/robocode-dev/tank-= royale/tree/main/bot-api/dotnet</a><br><br>And at some point I will introdu= ce an API for web as well.<br><br>If you want to build an API from scratch,= you could choose to:<br>1) Create an API very similar to the current APIs = that are made very similar on purpose. Meaning that your Python API would h= ave same classes and methods, but in Python style of course.<br>2) Create y= our own version and just use communicate with the server in a more "ra= w" fashion by communicating over a WebSocket.<br><br>If you choose opt= ion 2, you need to send and receive messages using the <b>protocol </b>desc= ribed here:<br><a href=3D"https://github.com/robocode-dev/tank-royale/blob/= main/schema/schemas/game/README.md" rel=3D"nofollow" target=3D"_blank" data= -saferedirecturl=3D"https://www.google.com/url?hl=3Den-GB&q=3Dhttps://g= ithub.com/robocode-dev/tank-royale/blob/main/schema/schemas/game/README.md&= amp;source=3Dgmail&ust=3D1727819249011000&usg=3DAOvVaw2e9-NbYIsKMQT= WlIrNuFM6">https://github.com/robocode-dev/tank-royale/blob/main/schema/sch= emas/game/README.md</a><br><br>And the <b>schemas </b>(message formats) are= available here (In <a href=3D"https://json-schema.org/specification" rel= =3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"https://www.google.= com/url?hl=3Den-GB&q=3Dhttps://json-schema.org/specification&source= =3Dgmail&ust=3D1727819249011000&usg=3DAOvVaw2exmnl5n9eyTsuiQycN1AZ"= >JsonSchema </a>format)<br><a href=3D"https://github.com/robocode-dev/tank-= royale/tree/main/schema/schemas/game" rel=3D"nofollow" target=3D"_blank" da= ta-saferedirecturl=3D"https://www.google.com/url?hl=3Den-GB&q=3Dhttps:/= /github.com/robocode-dev/tank-royale/tree/main/schema/schemas/game&sour= ce=3Dgmail&ust=3D1727819249011000&usg=3DAOvVaw2M-ThDJ93DEvvjBYUm5wh= v">https://github.com/robocode-dev/tank-royale/tree/main/schema/schemas/gam= e</a><br><br>If you choose option 1, you should create something similar to= <b>BaseBot </b>as a first step (like I did), which handles the basic commu= nication between a bot and the server.<br>Later you can create a <b>Bot </b= >with more advanced methods as step 2.<br><br>Also note that you could use = the existing APIs as is. For example, we have <a href=3D"https://www.jython= .org/" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"https://w= ww.google.com/url?hl=3Den-GB&q=3Dhttps://www.jython.org/&source=3Dg= mail&ust=3D1727819249011000&usg=3DAOvVaw1ymllKXUJdcIYM4s-oAM_b">Jyt= hon</a>, which is a Python implementation for the existing=C2=A0<a href=3D"= https://robocode-dev.github.io/tank-royale/api/java/dev/robocode/tankroyale= /botapi/package-summary.html" rel=3D"nofollow" target=3D"_blank" data-safer= edirecturl=3D"https://www.google.com/url?hl=3Den-GB&q=3Dhttps://robocod= e-dev.github.io/tank-royale/api/java/dev/robocode/tankroyale/botapi/package= -summary.html&source=3Dgmail&ust=3D1727819249011000&usg=3DAOvVa= w1sHBaHBcCfGvyzpLq7ZeB-">Java Bot AP</a>I.<div>And you could use <a href=3D= "https://pythonnet.github.io/" rel=3D"nofollow" target=3D"_blank" data-safe= redirecturl=3D"https://www.google.com/url?hl=3Den-GB&q=3Dhttps://python= net.github.io/&source=3Dgmail&ust=3D1727819249011000&usg=3DAOvV= aw28s8jRD0M58rjnHiH5Z4Nb">Python.Net</a> for with the existing<a href=3D"ht= tps://robocode-dev.github.io/tank-royale/api/dotnet/api/Robocode.TankRoyale= .BotApi.html" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"ht= tps://www.google.com/url?hl=3Den-GB&q=3Dhttps://robocode-dev.github.io/= tank-royale/api/dotnet/api/Robocode.TankRoyale.BotApi.html&source=3Dgma= il&ust=3D1727819249011000&usg=3DAOvVaw31laINJQQAKu0pjcY7mwi_"> .Net= Bot API</a>.<br><br>I you want to do a real Python API that are similar to= the existing one, I will be happy to assist you. =F0=9F=91=8D<br>I guess m= ost code from the existing platforms can be translated without a big hassle= for Python. I did the same for Java to .Net, and I will do it again later = for the coming web API. =F0=9F=98=8A<br><br>Best regards,<br>- Flemming</di= v><div class=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">tirsdag= den 24. september 2024 kl. 18.00.54 UTC+2 skrev Sarb:<br></div><blockquote= class=3D"gmail_quote" style=3D"margin:0 0 0 0.8ex;border-left:1px solid rg= b(204,204,204);padding-left:1ex">Apologies if this question has already bee= n asked.<div><br></div><div>I am interested in developing bots in Python. I= t appears this may be possible with Robocode Tank Royale. How would I go ab= out building a Python bot API? Any pointers or guidance would be greatly ap= preciated.<div><br></div><div><i>Refs</i>:</div><div><ol><li><a href=3D"htt= ps://robocode-dev.github.io/tank-royale/" rel=3D"nofollow" target=3D"_blank= " data-saferedirecturl=3D"https://www.google.com/url?hl=3Den-GB&q=3Dhtt= ps://robocode-dev.github.io/tank-royale/&source=3Dgmail&ust=3D17278= 19249011000&usg=3DAOvVaw2SVHgUgCh3NvsPJSLY4_Qc">https://robocode-dev.gi= thub.io/tank-royale/</a><br></li></ol></div></div></blockquote></div></bloc= kquote></div></blockquote></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;Robocode" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">robocode+u= [email protected]</a>.<br /> To view this discussion on the web visit <a href=3D"https://groups.google.c= om/d/msgid/robocode/a5ddcfef-6691-453e-9ab2-03bce77d8e9en%40googlegroups.co= m?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid= /robocode/a5ddcfef-6691-453e-9ab2-03bce77d8e9en%40googlegroups.com</a>.<br = /> ------=_Part_569061_1303131124.1727733434021-- ------=_Part_569060_350520098.1727733434021--