Advertisement
Guest User

Untitled

a guest
Mar 31st, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.63 KB | None | 0 0
  1. Uvs#6316
  2.  
  3. Spydy - 02/21/2017
  4. Hi!
  5. Uvs - 02/21/2017
  6. hi
  7. Spydy - 02/21/2017
  8. Can I use the Dota 2 EU Ladder bot for my own Dota 2 league?
  9. Uvs - 02/21/2017
  10. yep, it's fine :wink:
  11. Spydy - 02/21/2017
  12. Thanks a lot! Do you have a moment to help me set it up.
  13. The git readme page was virtually empty
  14. Uvs - 02/21/2017
  15. yes, we can do it :smiley:
  16. Spydy - 02/21/2017
  17. Great!
  18. Uvs - 02/21/2017
  19. yeah... I am too lazy to write docs :smile:
  20. Whole thing is written in django (python web framework). Are you familiar with it?
  21. Spydy - 02/21/2017
  22. Somewhat
  23. In case I need to host it from my own server I got that covered.
  24. But how to get it to work with discord and so on... I'm not entirely sure how to do that.
  25. I've cloned the git respitory, installed python-pip and ran sudo pip -r install requirements.txt so far
  26. Which I'm not sure if it worked, gave a lot of errors.
  27. Uvs - 02/21/2017
  28. There is no connection with discord :frowning: This was supposed to be next feature, but I never started work on it... like on many other things :smiley:
  29. I suggest you to use virtualenv, this way you have per-project environment and don't mess you real one.
  30. to start web server you use 'python manage.py runserver' command from project dir.
  31. Spydy - 02/21/2017
  32. Hmm...
  33. Uvs - 02/21/2017
  34. btw, bot is tightly coupled with other stuff (players database + django layer to access it) so you can't really use it without whole thing
  35. Spydy - 02/21/2017
  36. Yeah it gave a lot of errors when I tried to start it :sweat_smile:
  37. Uvs - 02/21/2017
  38. Then yeah, let's setup virtualenv.
  39. Here's the doc if you not familiar with it: https://virtualenv.pypa.io/en/stable/
  40. Spydy - 02/21/2017
  41. Just installed it
  42. Uvs - 02/21/2017
  43. That will be pretty easy, there's like 1 command only to make it.
  44. And then second command to use it.
  45. Spydy - 02/21/2017
  46. Should I remove the current git folder and re-make it as virtual environment?
  47. Uvs - 02/21/2017
  48. no-no, virtualenv is just a separate folder.
  49. Spydy - 02/21/2017
  50. Oh, ok.
  51. So i'm now in the Dota2-EU-Ladder folder
  52. Uvs - 02/21/2017
  53. it will contain python executable, libs and so on
  54. Spydy - 02/21/2017
  55. do I just write virtualenv venv
  56. Uvs - 02/21/2017
  57. yes :smiley:
  58. This will create virtualenv folder
  59. Spydy - 02/21/2017
  60. done
  61. Uvs - 02/21/2017
  62. And then you write something like 'source venv/bin/activate'
  63. Spydy - 02/21/2017
  64. done
  65. Uvs - 02/21/2017
  66. Now you should be inside virtualenv (do you see it console?). This just means that when you type commands they will use python from virtualenv dir, instead of your system python.
  67. Spydy - 02/21/2017
  68. Yeah, I see that.
  69. Uvs - 02/21/2017
  70. Now you cd to your project dir
  71. Spydy - 02/21/2017
  72. I'm already there.
  73. Uvs - 02/21/2017
  74. nice, now you can try pip install again
  75. This will try to install libs inside virtualenv
  76. Spydy - 02/21/2017
  77. should it be sudo pip install or just regular pip install
  78. Uvs - 02/21/2017
  79. python 2.7 btw
  80. Spydy - 02/21/2017
  81. i guess sudo
  82. Uvs - 02/21/2017
  83. regular I believe (not sure though)
  84. Spydy - 02/21/2017
  85. i try regular first
  86. hmm
  87. compilation terminated.
  88. error: command 'x86_64-linux-gnu-gcc' failed with exit sta tus 1
  89. Failed cleaning build dir for cryptography
  90. Uvs - 02/21/2017
  91. yep, had something like this in the past... will try to remember how I fixed this.
  92. Spydy - 02/21/2017
  93. c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
  94. #include <Python.h>
  95. Uvs - 02/21/2017
  96. Probably did install some package...
  97. Spydy - 02/21/2017
  98. my python version is python 2.7.9
  99. Uvs - 02/21/2017
  100. I remember I fixed some error by updating pip. Not sure if it was this error or another.
  101. Now I regret I didn't write this stuff down during development haha :smile:
  102. ah, this error is fixed by installing python-dev package
  103. Spydy - 02/21/2017
  104. I'll try it
  105. Uvs - 02/21/2017
  106. sudo apt-get install libffi-dev
  107. Spydy - 02/21/2017
  108. alright done, i'll try the pip install again
  109. now it gave a different error
  110. build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory
  111. #include <openssl/opensslv.h>
  112. ^
  113. compilation terminated.
  114. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  115. Oh wait, the old error is still there.
  116. Should I exit the virtual environment before I do the python dev package install?
  117. from sudo apt-get
  118. well it didn't matter
  119. Uvs - 02/21/2017
  120. I guess not. This is the more complete command that should work: sudo apt-get install build-essential libssl-dev libffi-dev python-dev
  121. Spydy - 02/21/2017
  122. I'll run that
  123. Succesfully built cryptography
  124. no errors anymore
  125. it worked
  126. what's next?
  127. Uvs - 02/21/2017
  128. now try 'python manage.py runserver'
  129. Spydy - 02/21/2017
  130. It works
  131. though it warned about unapplied migrations
  132. should i run python manage.py migrate first?
  133. Uvs - 02/21/2017
  134. right, migrations :smiley: This will create tables in database. DB will be empty though, I can give you our old DB to play with if you'll want.
  135. Spydy - 02/21/2017
  136. I'll try to get the website working first.
  137. firewall problems
  138. Uvs - 02/21/2017
  139. Also, you can create accounts for bots. You can make a couple for now, but I suggest to make 10 eventualy, because with 10 you can test more easily balancing functionality, etc. When 1 bot hosts lobby, other 9 + you join as players and you run commands to make sure everything works like you expect :smile: although not sure if you need it
  140. Spydy - 02/21/2017
  141. http://pg029.polygame.fi:8000/
  142. It works!
  143. Uvs - 02/21/2017
  144. wow, nice :smiley:
  145. I created all 10 bot accounts on 1 email. Also you need to login with every one of them on steam (once) and uncheck safety features. This is needed because otherwise steam will occasionally tell your bots 'You are login-in from unusual place so we sent you an email with security code, please enter it'.
  146. Spydy - 02/21/2017
  147. I'm still trying to figure out how to use this.
  148. :sweat_smile:
  149. Uvs - 02/21/2017
  150. Also naming for bots is important. All of them should use same name + number (Spydy1, Spydy2, Spydy3) and likewise for password (paSSw0rd1, paSSw0rd2, paSSw0rd3).
  151. Spydy - 02/21/2017
  152. Alrighty
  153. Uvs - 02/21/2017
  154. After you create bot accounts, you'll have to add these data to env variables.
  155. To avoid setting them every time, I added commands to 'activate' file inside my virtualenv folder (venv/bin/activate for you I guess).
  156. set "BOT_LOGIN=euladder_bot"
  157. set "BOT_PASSWORD=***"
  158. set "LOBBY_PASSWORD=eu"
  159. As you see, we use only main part of name / pass, without number.
  160. Number will be added by launcher script in loop.
  161. After you set this up you can try launch bots with 'python manage.py dota_bot' command. By default it will launch 2 bots that will create lobbies.
  162. You can set number of bots like this 'python manage.py dota_bot -n 1' or ''python manage.py dota_bot --number 1'
  163. There is no way to change lobby name though, it's hardcoded in bot. You'll have to change it in code :smiley:
  164. Now I'll wait for you to catch up before going further.(edited)
  165. Spydy - 02/21/2017
  166. Just a sec
  167. I have like over 20 bots but forgotten which email I registered them with :smile:
  168. Uvs - 02/21/2017
  169. Also note, that you might get into trouble using current dotabuff-like design. I implemented it as a temporary thing until we get our own design, but nobody gave me a new design so we still have it like this. I don't mind, but you might :smiley:
  170. Spydy - 02/21/2017
  171. Nah, this comes to a small local use only.
  172. So nobody will mind.
  173. Uvs - 02/21/2017
  174. nice, I have this point of view too.
  175. Spydy - 02/21/2017
  176. Well I made 3 bots now.
  177. I'll make 7 more later
  178. Instead of trying to remember the password I just made new ones.
  179. Should I add the commands to the beginning of the activate file?
  180. So not inside any function or anything.
  181. Hmm, I try to launch the bots but it says this:
  182. TypeError: Couldn't build proto file into descriptor pool!
  183. Invalid proto descriptor for file "steammessages_base.proto":
  184. CMsgProtoBufHeader.target_job_name: "CMsgProtoBufHeader.target_job_name" is already defined in file "steammessages.proto".
  185. CMsgProtoBufHeader.eresult: "CMsgProtoBufHeader.eresult" is already defined in file "steammessages.proto".
  186. CMsgProtoBufHeader.error_message: "CMsgProtoBufHeader.error_message" is already defined in file "steammessages.proto".
  187. CMsgProtoBufHeader: "CMsgProtoBufHeader" is already defined in file "steammessages.proto".
  188. msgpool_soft_limit: "msgpool_soft_limit" is already defined in file "steammessages.proto".
  189. msgpool_hard_limit: "msgpool_hard_limit" is already defined in file "steammessages.proto".
  190. Uvs - 02/21/2017
  191. hm, not sure about this error, never seen this
  192. Spydy - 02/21/2017
  193. I ran command like this python manage.py dota_bot -n 1
  194. Uvs - 02/21/2017
  195. As about commands, I added them after first 'set bla bla bla'
  196. Spydy - 02/21/2017
  197. Here's the full error, prepare for wall of text.
  198. Oh, discord has 2000 char limit
  199. Well the last part is the only important part I guess.
  200. Uvs - 02/21/2017
  201. This is error inside dota2-python library, but I didn't have that one...
  202. Spydy - 02/21/2017
  203. Strange
  204. Uvs - 02/21/2017
  205. do you use some ide? maybe it updated some packages instead of using versions defined in requrirements.txt
  206. Spydy - 02/21/2017
  207. File "/home/spydy/dota2-eu-ladder/Dota2-EU-Ladder/app/balancer/management/commands/dota_bot.py", line 17, in <module>
  208. from steam.client.builtins.friends import SteamFriendlist
  209. File "/home/spydy/dota2-eu-ladder/Dota2-EU-Ladder/venv/local/lib/python2.7/site-packages/steam/client/init.py", line 27, in <module>
  210. from steam.core.msg import MsgProto
  211. File "/home/spydy/dota2-eu-ladder/Dota2-EU-Ladder/venv/local/lib/python2.7/site-packages/steam/core/msg/init.py", line 4, in <module>
  212. from steam.core.msg.headers import MsgHdr, ExtendedMsgHdr, MsgHdrProtoBuf, GCMsgHdr, GCMsgHdrProto
  213. File "/home/spydy/dota2-eu-ladder/Dota2-EU-Ladder/venv/local/lib/python2.7/site-packages/steam/core/msg/headers.py", line 4, in <module>
  214. from steam.protobufs import steammessages_base_pb2
  215. File "/home/spydy/dota2-eu-ladder/Dota2-EU-Ladder/venv/local/lib/python2.7/site-packages/steam/protobufs/steammessages_base_pb2.py", line 25, in <module>
  216. dependencies=[google_dot_protobuf_dot_descriptorpb2.DESCRIPTOR,])
  217. File "/home/spydy/dota2-eu-ladder/Dota2-EU-Ladder/venv/local/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 824, in new__
  218. return _message.default_pool.AddSerializedFile(serialized_pb)
  219. TypeError: Couldn't build proto file into descriptor pool!
  220. Is what it said before the type-error
  221. No I didn't use any ide
  222. Hmm, i can't see any more SET commands in the venv/bin/activate file
  223. you said you put them after some other commands o
  224. Uvs - 02/21/2017
  225. Then probably python-dota2 requirements defined without version, just to grab newest ones. And newest ones incompatible with old version I use...
  226. uh, right, I am on widows so it's activate.bat for me. For linux this will be different...
  227. not sure exactly how exactly though :stuck_out_tongue:
  228. To fix protobuff error you can try and remove version numbers from requirements.txt for dota2 and steam packages. Then use pip install again. This will install newest versions of these libraries and probably fix this error. But I don't know if those new versions compatible with my code :smile:
  229. Spydy - 02/21/2017
  230. I'll give it a try
  231. uh...
  232. there aren't any steam or dota2 packages in requirements.txt
  233. Spydy - 02/21/2017
  234. https://github.com/UncleVasya/Dota2-EU-Ladder/blob/master/requirements.txt
  235. Uvs - 02/21/2017
  236. aha, I see. I used my fork of dota2 lib
  237. Spydy - 02/21/2017
  238. So how do I fix it?
  239. Uvs - 02/21/2017
  240. In this case you need me to update it, but I don't know when I'll do it, not on this week for sure.
  241. Spydy - 02/21/2017
  242. Oh, alright.
  243. Well I'll wait then.
  244. Spydy - 03/13/2017
  245. Hi
  246. Have you updated the bot yet?
  247. Uvs - 03/13/2017
  248. Hi. I re-installed bot + packages on both my dev machine and server, but it worked fine as it is. Looks like my guess about protobufs update was wrong, and your error is with something else (not sure what though).
  249. Looks like this was a temporary issue that is fixed by package developer: https://github.com/ValvePython/steam/issues/75 You can try to reinstall packages and it might work.
  250. GitHub
  251. SteamClient proto file ยท Issue #75 ยท ValvePython/steam
  252. System: Archlinux Kernel: 4.9.8-1 Python version: 3.6.0 Steam lib version: 0.8.14 Traceback (most recent call last): File "/home/yzinets/Projects/CSGOPolygonAuth/run.py", line 1, in from steam.cli...
  253. Spydy - 03/13/2017
  254. Thanks
  255. Uvs - 03/13/2017
  256. 'reinstall packages' = to activate virtualenv and run 'pip install -r requirements.txt'. If that doesn't help you can try 'pip install -r requirements.txt --no-cache-dir --ignore-installed', but I think first one will do :ok_hand:
  257. Spydy - 03/13/2017
  258. Alright, thanks for the help. I'll check it out once I login to the server next time.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement