{"id":715,"date":"2012-02-27T20:00:00","date_gmt":"2012-02-27T19:00:00","guid":{"rendered":"http:\/\/shadowcovenant.com\/blog\/2012\/02\/27\/effect-system\/"},"modified":"2012-02-27T20:00:00","modified_gmt":"2012-02-27T19:00:00","slug":"effect-system","status":"publish","type":"post","link":"http:\/\/shadowcovenant.com\/blog\/2012\/02\/27\/effect-system\/","title":{"rendered":"Effect System"},"content":{"rendered":"<p align=\"justify\">Been working on a new Effect System for Spellbook and Grey lately (not much time for it, though)\u2026<\/p>\n<p align=\"justify\">For discussion purposes, an Effect System is a subsystem that will allow me to quickly build and modify effects. Effects in this context are any sequence of visual\/audio items that need to do be done in a sequence to augment the animations of the characters\u2026<\/p>\n<p align=\"justify\">For example, when Grey does a life-shaping spell, he needs to play his animation (with any sound effects needed), turn on two point lights that follow his hands, draw a beam of light from the ground to the sky, etc\u2026 When the effect ends, we need to activate whatever he life-shaped into existence (which can have any number of effects as well).<\/p>\n<p align=\"justify\">I\u2019ve defined some goals for this effect system:<\/p>\n<ol>\n<li>\n<div align=\"justify\">Independent \u2013 The system should be independent of most existing Spellbook systems, specially minimizing dependencies with the animation system (because of a point below).<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Multithreaded \u2013 This system should be able to run in a separate thread, synchronizing only for the rendering parts. I want this so that I can do more complex effects, like physics-based cloth animation, etc, without nuking the frame rate.<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Data-driven \u2013 I should be able to design a whole effect without doing any actual coding. For phase 1, the idea is to have a XML-driven effect, which describes the effect and the changes in properties of the entities that make up the effect, but in the future I want to build a component in SurgeEd that allows me to design the effects in a more user-friendly environment (a Flash-like timeline)<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Jump-to-frame \u2013 Because I want one day to have a decent application to author effects, I need the effects to be capable of jumping to a specific frame (so I can implement the timeline). In most casts, it\u2019s simple enough to do this (because the state is implicit in a formula), but cases with more random components (like particle systems), this might be more complicated.<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Event-tracking \u2013 The effect must be capable of raising events (for example, if the spawn of the creature needs to start at a specific time in the effect)<\/div>\n<\/li>\n<li>Time-scaling \u2013 The effects must be capable of going faster or slower, depending on the instancing of the effect: for example, if the cast time of a fireball is normally 3 seconds and I want it to be done in 2 seconds, the effect must be speeded up.<\/li>\n<li>\n<div align=\"justify\">Hierarchy \u2013 The effects must have components that can aggregate other components (and respect the scaling\/orientation\/position of its parent)<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Object reference \u2013 All effects must have a source object (that will be the target of animation controls, for example)<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Reuse of meshes \u2013 The system must be capable of reusing meshes; for example, if I have the same effect running 10 times, I must be able to use the same mesh for all of them, so I can cut the DIP calls from 10 to 1.<\/div>\n<\/li>\n<\/ol>\n<p align=\"justify\">&#160;<\/p>\n<p align=\"justify\">Of course, some of these will clash with others; for example 9 makes it harder to implement 7, since I have to do all hierarchy calculations in the CPU, instead of going for the GPU.<\/p>\n<p align=\"justify\">Anyway, what I have for now is an Effect System, that manages Effect Instances, which contains Effect Objects. The instance is build from an Effect Declaration, which describes properties and interpolators. The Effect Instance animates the properties using the interpolators (in this context, interpolators are everything from a linear interpolator in which a value goes from A to B in C time, to random interpolators which just assign a random value A to the property). The Effect Objects then use these properties to update a renderable mesh that it requests the Effect System\u2026<\/p>\n<p align=\"justify\">All in all, the system is becoming interesting, with a good decoupling of animation and render tasks (because of 2), and the fact that I treat everything as a function of properties and interpolators helps along with 3.<\/p>\n<p align=\"justify\">Hopefully I\u2019ll have some more on this by the end of the week, on the <a href=\"http:\/\/www.spellcasterstudios.com\/\">Spellcaster Studios<\/a> blog. Any questions\/suggestions, don\u2019t hesitate! <img decoding=\"async\" style=\"border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none\" class=\"wlEmoticon wlEmoticon-smile\" alt=\"Smile\" src=\"http:\/\/shadowcovenant.com\/blog\/wp-content\/uploads\/2012\/02\/wlEmoticon-smile3.png\" \/><\/p>\n<div id=\"tweetbutton715\" class=\"tw_button\" style=\"\"><a href=\"http:\/\/twitter.com\/share?url=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2012%2F02%2F27%2Feffect-system%2F&amp;text=Effect%20System&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2012%2F02%2F27%2Feffect-system%2F\" class=\"twitter-share-button\"  style=\"width:55px;height:22px;background:transparent url('http:\/\/shadowcovenant.com\/blog\/wp-content\/plugins\/wp-tweet-button\/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;\">Tweet<\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>Been working on a new Effect System for Spellbook and Grey lately (not much time for it, though)\u2026 For discussion purposes, an Effect System is a subsystem that will allow me to quickly build and modify effects. Effects in this context are any sequence of visual\/audio items that need to do be done in a [&hellip;]<\/p>\n<div id=\"tweetbutton715\" class=\"tw_button\" style=\"\"><a href=\"http:\/\/twitter.com\/share?url=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2012%2F02%2F27%2Feffect-system%2F&amp;text=Effect%20System&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fshadowcovenant.com%2Fblog%2F2012%2F02%2F27%2Feffect-system%2F\" class=\"twitter-share-button\"  style=\"width:55px;height:22px;background:transparent url('http:\/\/shadowcovenant.com\/blog\/wp-content\/plugins\/wp-tweet-button\/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;\">Tweet<\/a><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,88],"tags":[118,119],"class_list":["post-715","post","type-post","status-publish","format-standard","hentry","category-development","category-grey","tag-effect","tag-system"],"_links":{"self":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/posts\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/comments?post=715"}],"version-history":[{"count":0,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/posts\/715\/revisions"}],"wp:attachment":[{"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/media?parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/categories?post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shadowcovenant.com\/blog\/wp-json\/wp\/v2\/tags?post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}