exaV / screeps-kotlin-starter

A starting point for a Screeps AI written in Kotlin
MIT License
46 stars 63 forks source link

Tuning #13

Closed Jordan-Cottle closed 2 years ago

Jordan-Cottle commented 2 years ago

This PR adds a couple of QOL and performance tuning enhancements.

Since we now have multiple rooms in different states, the logic needs to be able to adapt to different circumstances better.

The main change for this is the addition of "priority roles" that the AI will attempt to spawn before filling out the other roles. For now, those are the Harvester and Transporter roles so that a room will harvest energy and move it into the spawners/extensions so that creeps can be spawned at a reasonable rate.

Another change is to allow upgraders and transporters to bail out of the gather energy mode early when no energy can be found, yet they have some in their store. This gets the upgraders out of the way so that other roles can get less contested access to the energy being actively mined. This also means the transporters may move energy that is needed to respawn a harvester into a spawner/extension instead of just complaining that there is no harvester gathering energy.

Jordan-Cottle commented 2 years ago

Shoot, sorry. It's 3am and I forgot to point this to my own main branch instead of pointing it at the upstream one 😅

exaV commented 2 years ago

No worries :) Cool bot you have there, which shard are you playing on?

Btw I saw you tried and reverted the last updates I performed on the starter repo (kotlin 1.6 and deploy task upgrade). Was there anything wrong with the update, or did it break anything on your side?

Jordan-Cottle commented 2 years ago

I've been playing on a friend's private server.

I'm not exactly sure why it broke as I'm VERY new to kotlin (playing screeps to learn kotlin actually) and have basically no knowledge of how gradle works. When I pulled in the update, the deploy task just started failing. I spent an hour or two trying to figure out why (I'm assuming I've got gradle/java installed weird and/or IntelliJ is/was doing some magic to fix/break things), but ultimately decided "I'm here to learn kotlin and play some screeps, not debug gradle" and just hit revert.

If I remember correctly, it was something in the step that actually publishes the script. Something about some class not existing. Wish I had the saved the exact error to share 😅

exaV commented 2 years ago

Okay, let me tell you it was definitely the correct choice to continue hacking away with the old version instead of debugging the build.

I tried the deploy on mac and windows with java 8 and 17 and both worked fine. If you ever try to upgrade again feel free to create an issue with the error you get.