{"action":"closed","issue":{"url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/issues/15","repository_url":"https://api.github.com/repos/maine-cyber/mcsc-unisim","labels_url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/issues/15/comments","events_url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/issues/15/events","html_url":"https://github.com/maine-cyber/mcsc-unisim/issues/15","id":165634912,"number":15,"title":"Need an Event Model","user":{"login":"stormecharette","id":18266083,"avatar_url":"https://avatars.githubusercontent.com/u/18266083?v=3","gravatar_id":"","url":"https://api.github.com/users/stormecharette","html_url":"https://github.com/stormecharette","followers_url":"https://api.github.com/users/stormecharette/followers","following_url":"https://api.github.com/users/stormecharette/following{/other_user}","gists_url":"https://api.github.com/users/stormecharette/gists{/gist_id}","starred_url":"https://api.github.com/users/stormecharette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormecharette/subscriptions","organizations_url":"https://api.github.com/users/stormecharette/orgs","repos_url":"https://api.github.com/users/stormecharette/repos","events_url":"https://api.github.com/users/stormecharette/events{/privacy}","received_events_url":"https://api.github.com/users/stormecharette/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/labels/C++","name":"C++","color":"F13E3E"},{"url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/labels/feature","name":"feature","color":"006b75"},{"url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/labels/todo","name":"todo","color":"1d76db"}],"state":"closed","locked":false,"assignee":{"login":"stormecharette","id":18266083,"avatar_url":"https://avatars.githubusercontent.com/u/18266083?v=3","gravatar_id":"","url":"https://api.github.com/users/stormecharette","html_url":"https://github.com/stormecharette","followers_url":"https://api.github.com/users/stormecharette/followers","following_url":"https://api.github.com/users/stormecharette/following{/other_user}","gists_url":"https://api.github.com/users/stormecharette/gists{/gist_id}","starred_url":"https://api.github.com/users/stormecharette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormecharette/subscriptions","organizations_url":"https://api.github.com/users/stormecharette/orgs","repos_url":"https://api.github.com/users/stormecharette/repos","events_url":"https://api.github.com/users/stormecharette/events{/privacy}","received_events_url":"https://api.github.com/users/stormecharette/received_events","type":"User","site_admin":false},"assignees":[{"login":"stormecharette","id":18266083,"avatar_url":"https://avatars.githubusercontent.com/u/18266083?v=3","gravatar_id":"","url":"https://api.github.com/users/stormecharette","html_url":"https://github.com/stormecharette","followers_url":"https://api.github.com/users/stormecharette/followers","following_url":"https://api.github.com/users/stormecharette/following{/other_user}","gists_url":"https://api.github.com/users/stormecharette/gists{/gist_id}","starred_url":"https://api.github.com/users/stormecharette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormecharette/subscriptions","organizations_url":"https://api.github.com/users/stormecharette/orgs","repos_url":"https://api.github.com/users/stormecharette/repos","events_url":"https://api.github.com/users/stormecharette/events{/privacy}","received_events_url":"https://api.github.com/users/stormecharette/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/milestones/4","html_url":"https://github.com/maine-cyber/mcsc-unisim/milestones/Engine%20Event%20Manager%20Subsystem","labels_url":"https://api.github.com/repos/maine-cyber/mcsc-unisim/milestones/4/labels","id":1880994,"number":4,"title":"Engine Event Manager Subsystem","description":"We need to provide a channel for objects to interact with each other in the engine. Our previous project Simutrans used an event queue to accomplish this. We'll try the same thing for now and see how it works. \r\n\r\n---\r\n\r\nEvent systems are really complex and difficult to get right. There are some considerations that aren't immediately obvious--for example, dynamically allocating event objects frequently has a negative impact on performance. Another example, event management with a global event queue brings about all of the typical problems of global objects, resulting in tough bugs.   \r\n\r\nSome inspirational event models we will use to influence some design decisions are: Java Swing GUI toolkit's event system, SFML's event system (they inspired our clock too), and certain parts of the Simutrans event system (though it's not great).  \r\n\r\nLike Swing, we will implement our event system with the observer design pattern (GoF), allowing objects to subscribe to receive events of a certain type. When the event subsystem pops events from its queue, it broadcasts events to any objects subscribed to receive them. The only problem is that this event subsystem is pretty much global (wrapped in sk::Root). We're not sure of another way around that.   \r\n\r\nOne notion we would like to explore is categorizing events into sub-queues. So, instead of subscribing to a master event queue just to receive hardware input events, an object may subscribe to the hardware input event queue. That way, some queues may be serviced by the event manager less frequently, giving us a performance boost.  \r\n\r\nImplementing an event manager subsystem requires at least the following: a memory pool system (allowing subsystems to allocate a memory pool in advance to reduce fragmentation), a custom queue structure for increased performance (we can use std::queue to start), a lightweight event class, abstract base classes for event broadcasters and event listeners, and probably a million more things we haven't thought of yet.  ","creator":{"login":"stormecharette","id":18266083,"avatar_url":"https://avatars.githubusercontent.com/u/18266083?v=3","gravatar_id":"","url":"https://api.github.com/users/stormecharette","html_url":"https://github.com/stormecharette","followers_url":"https://api.github.com/users/stormecharette/followers","following_url":"https://api.github.com/users/stormecharette/following{/other_user}","gists_url":"https://api.github.com/users/stormecharette/gists{/gist_id}","starred_url":"https://api.github.com/users/stormecharette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormecharette/subscriptions","organizations_url":"https://api.github.com/users/stormecharette/orgs","repos_url":"https://api.github.com/users/stormecharette/repos","events_url":"https://api.github.com/users/stormecharette/events{/privacy}","received_events_url":"https://api.github.com/users/stormecharette/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":4,"state":"open","created_at":"2016-07-13T14:34:45Z","updated_at":"2016-07-18T19:58:38Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-07-14T19:05:28Z","updated_at":"2016-07-18T19:58:38Z","closed_at":"2016-07-18T19:58:38Z","body":"We haven't determined yet the extent to which we will use events. \r\n\r\nWill they be used for all inter-object communication? \r\nWill they be used just for hardware events? \r\nWill they be used for JS/C++ IPC?\r\nWill they be used for simulation state?\r\n\r\nAll we know is we need a generic model to start with. The SDL and SFML libraries have nearly identical, very nice implementations that we will base our events off of. They're actually similar to Simutrans too. \r\n\r\nThe browser will do all of the hardware event checking for us, so we may not pass hardware events into our engine at all. But it's important to note that if the interface at least exists, it can be used if the browser implementation is abandoned, without having to refactor engine code. "}}
{"actor":{"display_login":"stormecharette"}}