glmcdona / LuxPythonEnvGym

Matching python environment code for Lux AI 2021 Kaggle competition, and a gym interface for RL models.
MIT License
73 stars 38 forks source link

map generation #10

Closed StoneT2000 closed 3 years ago

StoneT2000 commented 3 years ago

Probably the hardest part and I think we may be better off for now to generate seeds and then batch generate maps from the JS engine. Maps generate in about 0.6ms so this won't be a bottleneck ever. Map generation code is a bit complicated and additionally I have 0 confidence we will get the same seeds to generate the same maps unless we just call the JS code.

Let me know your thoughts.

glmcdona commented 3 years ago

Just had a quick look over the code. It's pretty complicated, but I think for myself porting your code directly over would be a bit easier than writing the generate automation + serialize + loader. For me this is easier just because I don't have any experience in compiling and running typescript, and I foresee me spending a an hour or two getting the typescript tooling working. Agreed the same seeds I don't think will generate the same maps since the random implementation is different I think, but I don't think that is a problem for the RL since we aren't trying to overfit to specific maps. ps. good work at your presentation today!

glmcdona commented 3 years ago

Partially implemented in 0030d1e75a30fb7ba1ae153e1e4b28d97f834457. Still have a bit more work to mirror the rest of your code there.

StoneT2000 commented 3 years ago

oh dang ok I was gonna say I could get the map generation working, I know how to write a easy python script to get them, this way you can prioritize other parts of the engine for now

glmcdona commented 3 years ago

Ops, sorry, didn't realize you were offering to take on the task!

StoneT2000 commented 3 years ago

been really busy with other things in Lux and other stuff but I'll have it setup this weekend, for now just use a debug map

glmcdona commented 3 years ago

Thanks, yeah I can tell you've been crazy busy! I finished up the map generation code porting earlier today, and I'm just working through my first test cases right now (and some fixes). I think I'm on track to have most of the game implementation done by Friday, how about we sync up Friday and see if there is a good part left that you'd be up for taking on?

glmcdona commented 3 years ago

Finished map generation with 60eeba380350d2855568e0f4816be91d8205abe2. The unit tests look like they work and the generated maps look good!

Example maps: w,: wood c,: coal u,: uranium Ca: City for team A Wa: Worker for team A Cb: City for team B Wb: Worker for team B

....................................c,c,......u,
..........c,....................................
........c,c,..................u,u,..............
........c,c,..................u,u,..............
................................................
....................w,w,....................w,w,
....................w,w,....................w,w,
................................................
..w,w,..........................................
w,w,................w,..........................
................CaWaw,..........................
....................w,......................u,u,
....................w,......................u,u,
................CbWbw,..........................
w,w,................w,..........................
..w,w,..........................................
................................................
....................w,w,....................w,w,
....................w,w,....................w,w,
................................................
........c,c,..................u,u,..............
........c,c,..................u,u,..............
..........c,....................................
....................................c,c,......u,
....c,c,........w,w,........w,w,........c,c,....
................w,w,w,....w,w,w,................
................................................
................................................
................................................
................................................
........u,............................u,........
......u,u,u,........................u,u,u,......
........u,u,........................u,u,........
................................................
................................................
................................................
c,..............CaWa......CbWb................c,
c,......u,u,....w,w,w,....w,w,w,....u,u,......c,
..........u,........................u,..........
....................w,w,w,w,....................
..................w,w,w,w,w,w,..................
..................w,........w,..................
................w,............w,................
..........w,w,....................w,w,..........
........w,w,w,w,................w,w,w,w,........
........w,............................w,........
................................................
c,............................................c,
..w,w,w,w,....w,w,w,w,..
....w,w,........w,w,....
........w,w,w,w,........
........CaWaWbw,........
........w,w,w,w,........
c,....................c,
c,....................c,
........................
........................
........................
........................
u,........w,w,........u,