Re: Robocode Tank Royale - Python?
Davide Cappellini <[email protected]> Sun, 29 Sep 2024 01:48:34 -0700 (PDT)
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_193518_2097847491.1727599714333 Content-Type: multipart/alternative; boundary="----=_Part_193519_883367997.1727599714333" ------=_Part_193519_883367997.1727599714333 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Sarb If you are interest in taking the longer path, building your own API in=20 python, I wrote a specific page for your=20 case: https://github.com/robocode-dev/tank-royale/wiki/Tutorial-on-writing-= a-Bot-API-for-Tank-Royale Il giorno mercoled=C3=AC 25 settembre 2024 alle 20:01:50 UTC+2 Sarb ha scri= tto: > Thank you Flemming. > This looks very interesting! Let me read up. > Regards, > 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/tankro= yale/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 classe= s=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/ga= me/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/ga= me >>> >>> If you choose option 1, you should create something similar to *BaseBot= =20 >>> *as a first step (like I did), which handles the basic communication=20 >>> between a 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/tankr= oyale/botapi/package-summary.html> >>> I. >>> And you could use Python.Net <https://pythonnet.github.io/> for with=20 >>> the existing .Net Bot API=20 >>> <https://robocode-dev.github.io/tank-royale/api/dotnet/api/Robocode.Tan= kRoyale.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= =20 >>> a 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 Py= thon=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/8cccd801-edb7-4e42-8e52-0bc7d19f06e2n%40googlegroups.com. ------=_Part_193519_883367997.1727599714333 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Sarb<div><br /></div><div>If you are interest in taking the longer path,= building your own API in python, I wrote a specific page for your case:=C2= =A0https://github.com/robocode-dev/tank-royale/wiki/Tutorial-on-writing-a-B= ot-API-for-Tank-Royale<br /><br /></div><div class=3D"gmail_quote"><div dir= =3D"auto" class=3D"gmail_attr">Il giorno mercoled=C3=AC 25 settembre 2024 a= lle 20:01:50 UTC+2 Sarb ha scritto:<br/></div><blockquote class=3D"gmail_qu= ote" style=3D"margin: 0 0 0 0.8ex; border-left: 1px solid rgb(204, 204, 204= ); padding-left: 1ex;">Thank you Flemming.<div>This looks very interesting!= Let me read up.</div><div>Regards,</div><div>Sarb<br><br></div><div class= =3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">On Tuesday 24 Septe= mber 2024 at 09:24: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);p= adding-left:1ex"><b>Correction:</b><br><a href=3D"https://www.jython.org/" = rel=3D"nofollow" style=3D"color:rgb(26,115,232)" target=3D"_blank" data-saf= eredirecturl=3D"https://www.google.com/url?hl=3Dit&q=3Dhttps://www.jyth= on.org/&source=3Dgmail&ust=3D1727685924245000&usg=3DAOvVaw1I_oy= 4dZxKKygFnN3O5XVq">Jython</a>=C2=A0is a Python implementation for Java, whi= ch can be used for the=C2=A0the existing=C2=A0<a href=3D"https://robocode-d= ev.github.io/tank-royale/api/java/dev/robocode/tankroyale/botapi/package-su= mmary.html" rel=3D"nofollow" style=3D"color:rgb(26,115,232)" target=3D"_bla= nk" data-saferedirecturl=3D"https://www.google.com/url?hl=3Dit&q=3Dhttp= s://robocode-dev.github.io/tank-royale/api/java/dev/robocode/tankroyale/bot= api/package-summary.html&source=3Dgmail&ust=3D1727685924245000&= usg=3DAOvVaw3CUhiZ_OuPtkwXXPXKZFqI">Java Bot API</a>=C2=A0for Robocode Tank= Royale.<br><div class=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_att= r">tirsdag den 24. september 2024 kl. 18.22.22 UTC+2 skrev fnl:<br></div><b= lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 0.8ex;border-left:1px= solid rgb(204,204,204);padding-left:1ex">Hi Sarb,<br><br>Currently, there = are 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= /bot-api/java" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"h= ttps://www.google.com/url?hl=3Dit&q=3Dhttps://github.com/robocode-dev/t= ank-royale/tree/main/bot-api/java&source=3Dgmail&ust=3D172768592424= 5000&usg=3DAOvVaw2MIkoBxAo_unamQBeJ9wuN">https://github.com/robocode-de= v/tank-royale/tree/main/bot-api/java</a><br><b>.Net platform</b>:=C2=A0<a h= ref=3D"https://github.com/robocode-dev/tank-royale/tree/main/bot-api/dotnet= " rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"https://www.go= ogle.com/url?hl=3Dit&q=3Dhttps://github.com/robocode-dev/tank-royale/tr= ee/main/bot-api/dotnet&source=3Dgmail&ust=3D1727685924245000&us= g=3DAOvVaw319uvXRQJC8P2DFaBZUJ8x">https://github.com/robocode-dev/tank-roya= le/tree/main/bot-api/dotnet</a><br><br>And at some point I will introduce a= n 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 have = same classes and methods, but in Python style of course.<br>2) Create your = own version and just use communicate with the server in a more "raw&qu= ot; fashion by communicating over a WebSocket.<br><br>If you choose option = 2, you need to send and receive messages using the <b>protocol </b>describe= d 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-saf= eredirecturl=3D"https://www.google.com/url?hl=3Dit&q=3Dhttps://github.c= om/robocode-dev/tank-royale/blob/main/schema/schemas/game/README.md&sou= rce=3Dgmail&ust=3D1727685924245000&usg=3DAOvVaw37Fg6eyxTN3pcPZjxVTv= Ot">https://github.com/robocode-dev/tank-royale/blob/main/schema/schemas/ga= me/README.md</a><br><br>And the <b>schemas </b>(message formats) are availa= ble here (In <a href=3D"https://json-schema.org/specification" rel=3D"nofol= low" target=3D"_blank" data-saferedirecturl=3D"https://www.google.com/url?h= l=3Dit&q=3Dhttps://json-schema.org/specification&source=3Dgmail&= ;ust=3D1727685924245000&usg=3DAOvVaw21V81ywsLQpjb4aGDZ2M-b">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" data-saferedir= ecturl=3D"https://www.google.com/url?hl=3Dit&q=3Dhttps://github.com/rob= ocode-dev/tank-royale/tree/main/schema/schemas/game&source=3Dgmail&= ust=3D1727685924245000&usg=3DAOvVaw17ur_QKTHkkmRekkbuPevA">https://gith= ub.com/robocode-dev/tank-royale/tree/main/schema/schemas/game</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 communication betwee= n a bot and the server.<br>Later you can create a <b>Bot </b>with more adva= nced methods as step 2.<br><br>Also note that you could use the existing AP= Is as is. For example, we have <a href=3D"https://www.jython.org/" rel=3D"n= ofollow" target=3D"_blank" data-saferedirecturl=3D"https://www.google.com/u= rl?hl=3Dit&q=3Dhttps://www.jython.org/&source=3Dgmail&ust=3D172= 7685924245000&usg=3DAOvVaw1I_oy4dZxKKygFnN3O5XVq">Jython</a>, which is = a Python implementation for the existing=C2=A0<a href=3D"https://robocode-d= ev.github.io/tank-royale/api/java/dev/robocode/tankroyale/botapi/package-su= mmary.html" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"http= s://www.google.com/url?hl=3Dit&q=3Dhttps://robocode-dev.github.io/tank-= royale/api/java/dev/robocode/tankroyale/botapi/package-summary.html&sou= rce=3Dgmail&ust=3D1727685924245000&usg=3DAOvVaw3CUhiZ_OuPtkwXXPXKZF= qI">Java Bot AP</a>I.<div>And you could use <a href=3D"https://pythonnet.gi= thub.io/" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"https:= //www.google.com/url?hl=3Dit&q=3Dhttps://pythonnet.github.io/&sourc= e=3Dgmail&ust=3D1727685924245000&usg=3DAOvVaw12F40jWLq8chJDUJYzBdUl= ">Python.Net</a> for with the existing<a href=3D"https://robocode-dev.githu= b.io/tank-royale/api/dotnet/api/Robocode.TankRoyale.BotApi.html" rel=3D"nof= ollow" target=3D"_blank" data-saferedirecturl=3D"https://www.google.com/url= ?hl=3Dit&q=3Dhttps://robocode-dev.github.io/tank-royale/api/dotnet/api/= Robocode.TankRoyale.BotApi.html&source=3Dgmail&ust=3D17276859242450= 00&usg=3DAOvVaw2GH3ODVZXZ3MopP-7mLgq2"> .Net Bot API</a>.<br><br>I you = want to do a real Python API that are similar to the existing one, I will b= e happy to assist you. =F0=9F=91=8D<br>I guess most 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</div><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" styl= e=3D"margin:0 0 0 0.8ex;border-left:1px solid rgb(204,204,204);padding-left= :1ex">Apologies if this question has already been asked.<div><br></div><div= >I am interested in developing bots in Python. It appears this may be possi= ble with Robocode Tank Royale. How would I go about building a Python bot A= PI? Any pointers or guidance would be greatly appreciated.<div><br></div><d= iv><i>Refs</i>:</div><div><ol><li><a href=3D"https://robocode-dev.github.io= /tank-royale/" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"h= ttps://www.google.com/url?hl=3Dit&q=3Dhttps://robocode-dev.github.io/ta= nk-royale/&source=3Dgmail&ust=3D1727685924245000&usg=3DAOvVaw31= 02w8BmRgWBlH6P8BoJlw">https://robocode-dev.github.io/tank-royale/</a><br></= li></ol></div></div></blockquote></div></blockquote></div></blockquote></di= v></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/8cccd801-edb7-4e42-8e52-0bc7d19f06e2n%40googlegroups.co= m?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid= /robocode/8cccd801-edb7-4e42-8e52-0bc7d19f06e2n%40googlegroups.com</a>.<br = /> ------=_Part_193519_883367997.1727599714333-- ------=_Part_193518_2097847491.1727599714333--