{"id":102,"date":"2026-09-04T20:45:37","date_gmt":"2026-09-04T20:45:37","guid":{"rendered":"https:\/\/robinclapworthy.com\/?p=102"},"modified":"2026-09-04T22:59:23","modified_gmt":"2026-09-04T22:59:23","slug":"i-started-off-wanting-to-recreate-the-huge-explosion-from-the-old-defender-arcade-game","status":"publish","type":"post","link":"https:\/\/robinclapworthy.com\/?p=102","title":{"rendered":"I Accidentally Built a Particle System in FoxPro."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When the player died in Defender, the ship seemed to completely disintegrate. It wasn\u2019t just an explosion graphic being shown for a few frames. Lots of individual pieces flew out across the screen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So I thought I would see if Visual FoxPro could do something similar.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first attempt uses 80 tiny FoxPro shape controls. Each one has its own position, speed, direction, colour and lifespan. FoxPro recalculates and moves all of them every 30 milliseconds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And it works.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a first attempt, it actually looks pretty awesome. Especially when you remember this is Visual FoxPro, a database development language from the 1990s.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What I hadn\u2019t realised when I started is that I wasn\u2019t only creating an explosion.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I had created the beginnings of a particle system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By changing how the particles are launched and moved, the same code could now be used for all sorts of effects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Sparks coming from a damaged ship<\/li>\n\n\n\n<li>Pieces breaking away from the shield<\/li>\n\n\n\n<li>Smoke and glowing embers<\/li>\n\n\n\n<li>Particles spiralling into a portal<\/li>\n\n\n\n<li>A power-up being absorbed by the player<\/li>\n\n\n\n<li>A hyperspace effect<\/li>\n\n\n\n<li>Sparks falling from BARF\u2019s console while he insists everything is working perfectly<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">At some point I may replace the FoxPro shapes with GDI+ drawing, which would allow more particles, transparency and glowing trails.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But for now, Visual FoxPro is happily throwing 80 individually calculated pieces of spaceship across the screen while also running the game.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I only wanted a better explosion.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It appears I may have accidentally built an effects engine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bleedin Nora!<br><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/robinclapworthy.com\/wp-content\/uploads\/2026\/09\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"436\" src=\"https:\/\/robinclapworthy.com\/wp-content\/uploads\/2026\/09\/image-1.png\" alt=\"\" class=\"wp-image-103\" srcset=\"https:\/\/robinclapworthy.com\/wp-content\/uploads\/2026\/09\/image-1.png 457w, https:\/\/robinclapworthy.com\/wp-content\/uploads\/2026\/09\/image-1-300x286.png 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>When the player died in Defender, the ship seemed to completely disintegrate. It wasn\u2019t just an explosion graphic being shown for a few frames. Lots of individual pieces flew out across the screen. So I thought I would see if Visual FoxPro could do something similar. The first attempt uses 80 tiny FoxPro shape controls. &#8230; <a title=\"I Accidentally Built a Particle System in FoxPro.\" class=\"read-more\" href=\"https:\/\/robinclapworthy.com\/?p=102\" aria-label=\"Read more about I Accidentally Built a Particle System in FoxPro.\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-galactic-gladiators"],"_links":{"self":[{"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=102"}],"version-history":[{"count":2,"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":114,"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions\/114"}],"wp:attachment":[{"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robinclapworthy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}