{"action":"created","issue":{"url":"https://api.github.com/repos/kyranf/robotarmyfactorio/issues/34","repository_url":"https://api.github.com/repos/kyranf/robotarmyfactorio","labels_url":"https://api.github.com/repos/kyranf/robotarmyfactorio/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/kyranf/robotarmyfactorio/issues/34/comments","events_url":"https://api.github.com/repos/kyranf/robotarmyfactorio/issues/34/events","html_url":"https://github.com/kyranf/robotarmyfactorio/issues/34","id":166231405,"number":34,"title":"all squad AI is done at once on n'th tick - need time mux","user":{"login":"kyranf","id":7900774,"avatar_url":"https://avatars.githubusercontent.com/u/7900774?v=3","gravatar_id":"","url":"https://api.github.com/users/kyranf","html_url":"https://github.com/kyranf","followers_url":"https://api.github.com/users/kyranf/followers","following_url":"https://api.github.com/users/kyranf/following{/other_user}","gists_url":"https://api.github.com/users/kyranf/gists{/gist_id}","starred_url":"https://api.github.com/users/kyranf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyranf/subscriptions","organizations_url":"https://api.github.com/users/kyranf/orgs","repos_url":"https://api.github.com/users/kyranf/repos","events_url":"https://api.github.com/users/kyranf/events{/privacy}","received_events_url":"https://api.github.com/users/kyranf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-19T01:53:46Z","updated_at":"2016-08-02T03:27:46Z","closed_at":null,"body":"need to create and maintain a \"task\" list which is a portion of squads in a force.\r\n\r\nevery tick, do at least one squad's AI routines, rather than possibly hundreds of squads all at once on the nth tick. This will definitely fix the lag \"spike\" issues. "},"comment":{"url":"https://api.github.com/repos/kyranf/robotarmyfactorio/issues/comments/236785058","html_url":"https://github.com/kyranf/robotarmyfactorio/issues/34#issuecomment-236785058","issue_url":"https://api.github.com/repos/kyranf/robotarmyfactorio/issues/34","id":236785058,"user":{"login":"kyranf","id":7900774,"avatar_url":"https://avatars.githubusercontent.com/u/7900774?v=3","gravatar_id":"","url":"https://api.github.com/users/kyranf","html_url":"https://github.com/kyranf","followers_url":"https://api.github.com/users/kyranf/followers","following_url":"https://api.github.com/users/kyranf/following{/other_user}","gists_url":"https://api.github.com/users/kyranf/gists{/gist_id}","starred_url":"https://api.github.com/users/kyranf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyranf/subscriptions","organizations_url":"https://api.github.com/users/kyranf/orgs","repos_url":"https://api.github.com/users/kyranf/repos","events_url":"https://api.github.com/users/kyranf/events{/privacy}","received_events_url":"https://api.github.com/users/kyranf/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T03:27:46Z","updated_at":"2016-08-02T03:27:46Z","body":"constantly popping/pushing tasks onto a table like that, as if they were variables on a stack, is not memory effecient.. Or if you mean just keep an N length table but with a tick value for each one, and using a \"sort\" on that element to find the \"oldest\" tick task and only process that this tick is also slow. It also means that as the list progresses in size, the number of tasks = number of ticks before it gets back to task 1. \r\n\r\nPerhaps the task list can just be the last of tasks, their last executed tick, and this is just compared with the current tick count to see if it's time to run them, no matter what tick it is or how many other tasks will end up running on that tick. It's super unlikely that any large number of tasks will end up on any particular tick, but any kind of synchronous spawning like from assemblers might stack the tasks.. \r\n\r\nAs long as the tasks can be organised in a way that doesn't need large re-allocation of table memory, or \"sort\" operations, then it should be fast enough..\r\n\r\nthat's why I was contemplating adding a 60-entry table, with each table being another table of tasks which are actually just the key (squad ID) of the squad whos AI needs to be run on this tick. \r\n\r\nit's ugly and complex but that's what optimisation is all about.. to just \"get something working\" i could totally just store tasks sorted by last tick and use \"sort\" to get the oldest (lowest tick). Perhaps doing that, and getting the length of the task list and just using modulo 60 to get how many tasks in the list to process will ensure all tasks are completed in a 60-tick loop? Oh, the possibilities! Programming is fun isn't it :0"}}
{"actor":{"display_login":"kyranf"}}