{"id":202,"date":"2009-03-02T21:14:21","date_gmt":"2009-03-02T21:14:21","guid":{"rendered":"http:\/\/positech.co.uk\/cliffsblog\/?p=202"},"modified":"2009-03-02T21:14:21","modified_gmt":"2009-03-02T21:14:21","slug":"multi-texturing","status":"publish","type":"post","link":"https:\/\/www.positech.co.uk\/cliffsblog\/2009\/03\/02\/multi-texturing\/","title":{"rendered":"Multi-texturing"},"content":{"rendered":"<p>Part of today was spent on the fleet design screen adding pilots as a requirement. This is something I&#8217;ve got from the old travller game. Basically some missions will have a limited number of trained pilots for your ships, thus limiting the number of small fighters that are viable for your fleet.<\/p>\n<p>I also finalised which space backgrounds would go with each mission. Then it was on to some graphical stuff&#8230;<\/p>\n<p>I&#8217;ve added a new weapon, which is an ECM blaster that knocks out the targeting systems of a ship for a few seconds. Ideally you would have a ship that acted as ECM cruiser to knock out the weapons of the enemy cruisers before you sent in your fighters and bombers to blast them to bits :D. As a result, I need a graphical effect on the target ship to show its been zapped.<\/p>\n<p>The existing shield effect isn&#8217;t the same sort of thing, because it&#8217;s a seperate sprite drawn on top which surrounds the ship in a sphere. I needed something that &#8216;hugged&#8217; the outline of the target ship. In a 3D game, you would maybe have an animated texture which you applied to the ships mesh, but these ships are sprites so that won&#8217;t work. The solution has been to layer two textures together and render them in one pass. Basically, I have a generic &#8216;lightning effect&#8217; texture which is drawn on top of the ship, but I tell directx to use the alpha channel from the ships sprite as the alpha, and the color data from the lightning to draw the effect.<\/p>\n<p>That bit was a pain to get right, but once done, I then needed to animate it. That is being done by having two lots of texture coordinates for the effect sprite. I leave the first set (for the ship, used as the alpha mask) at their defaults, and the effect color layer uses the second set. That lets me &#8216;ripple&#8217;, scroll or shake the effect texture, and still have it &#8216;wrap&#8217; closely around the outline of the ship. It works, but I need to program a decent movement effect, and do a proper effect texture. Then I&#8217;ll post screens :D.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part of today was spent on the fleet design screen adding pilots as a requirement. This is something I&#8217;ve got from the old travller game. Basically some missions will have a limited number of trained pilots for your ships, thus limiting the number of small fighters that are viable for your fleet. I also finalised<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; Multi-texturing<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/www.positech.co.uk\/cliffsblog\/2009\/03\/02\/multi-texturing\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105,4],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-gratuitous-space-battles","category-programming"],"_links":{"self":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":0,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/202\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/media?parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/categories?post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/tags?post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}