<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Andrew Nicholas Ene on Medium]]></title>
        <description><![CDATA[Stories by Andrew Nicholas Ene on Medium]]></description>
        <link>https://medium.com/@andrewnicholasene?source=rss-2991961e55db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wmZYmC-UoR6vFrG5Ls7NpQ.jpeg</url>
            <title>Stories by Andrew Nicholas Ene on Medium</title>
            <link>https://medium.com/@andrewnicholasene?source=rss-2991961e55db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:15:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andrewnicholasene/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Counterware: Building Anti-AI Firewalls]]></title>
            <link>https://medium.com/@andrewnicholasene/counterware-building-anti-ai-firewalls-aacf9cf74872?source=rss-2991961e55db------2</link>
            <guid isPermaLink="false">https://medium.com/p/aacf9cf74872</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[counterware]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[blue-team]]></category>
            <dc:creator><![CDATA[Andrew Nicholas Ene]]></dc:creator>
            <pubDate>Sat, 23 May 2026 12:22:17 GMT</pubDate>
            <atom:updated>2026-05-27T19:27:47.704Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fiGm8HiPDQlT8AiYIV6abQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jersey_photos?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Travis Leery</a> on <a href="https://unsplash.com/photos/a-couple-of-yellow-frogs-sitting-on-top-of-a-green-leaf-X6K-Yt3BO1U?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The golden dart frog is thumb sized but has enough neurotoxin to kill at least 10 humans. It actively signals toxicity with its bright yellow skin.</p><p>What would it take to make a golden dart frog website?<br>Could a website be fundamentally hostile to the bots but friendly to humans at the same time? Would that work?</p><h4>Why bother?</h4><p>The internet is slowly dying. The cause is simple, ensloppification a.k.a. suffocating under a mountain of garbage. This makes me sad because I grew up with it. Bo Burnham sings my theme songs. We had tools for this problem, search engines. They are 90s tech however, woefully out of date in the age of “AI”. There are of course no silicon monkeys running around, only statistical engines and scripts but we shall explore the full delta between humans and bots later.</p><h4>The experiment</h4><p>The problem is structural, producing carton-grade photos and text is becoming trivially cheap. Rational actors do not have a good enough reason to act lawfully so we get a tragedy of the commons. This was breaking news 10 years ago, now it is the new normal.</p><p>Solutions currently proposed are: <br> -Government ID verification &amp; enforcement by multinationals<br> -Banning “the other side” and/or the young<br> -Making the UX so bad with cookie opt outs that you go browse real life instead.</p><p>Some might say “oh, just use robots.txt/llm.txt/ai.txt and put some disallows in there”, they might suggest you are protected by the EU AI Act, Article 53. I tested this assumption and was not satisfied. Anthropic will actually refuse to scrape a website it has memory of me building with Claude. Other companies are not so chill. So despite having all 3 scripts and them being full blanket “no bots” and “please leave if you are a bot” and so on, I managed to scrape my own website via UI. If it is that easy we don’t even have to worry about more sophisticated methods.</p><h4>So what now?</h4><p>So how could we flip the economics without resorting to the above? Here is where the poison comes in. I will try to experiment a bit in public and see how far I can get as blue team and red team in this space. Along the way we can see what is human, what is bot and what is HTTP.</p><p>There is a good thing we are trying to achieve, human only spaces on the internet, but this is gonna be fundamentally non-preachy besides this first post. Let’s have some fun breaking things. Should 404 mean a success on Tuesdays? Does the sitemap need to reflect the codebase? Can we make the bots hallucinate an alternate reality? All these and more are questions I am trying to get to the bottom of. Stick around to find out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aacf9cf74872" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Event Bus Pattern in Unity]]></title>
            <link>https://medium.com/@andrewnicholasene/the-event-bus-pattern-in-unity-0edf57ac7cf7?source=rss-2991961e55db------2</link>
            <guid isPermaLink="false">https://medium.com/p/0edf57ac7cf7</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <dc:creator><![CDATA[Andrew Nicholas Ene]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 10:27:02 GMT</pubDate>
            <atom:updated>2024-12-01T10:27:02.425Z</atom:updated>
            <content:encoded><![CDATA[<h4>Scalable Script Communication for Small to Medium-sized Projects, Part II</h4><h3>What an Event Bus is, and what it is for</h3><p>Let’s say we are remaking Chess in Unity. When a piece is captured we want a lot of different systems to react. We might want to play a sound, tell the GameManager, update the UI and so on. Before we know it our bishop that just captured a pawn needs to know about most of our systems and to call them by name, this needlessly couples our scripts and clogs our code.</p><p>Ideally, the bishop would just send a signal out that it captured a piece and whoever wants to listen will only know about the signal, and can even do so at their own pace. And this is exactly what we will talk about implementing.</p><p>An event Event Bus is a script which has a list of subscribers, ready to receive new events, and a method to publish new events on it. It can be a simple implementation or you can add topics, where specific subscribers are listening to specific channels for events, and even keep an audit history.</p><h3><strong>It is most useful when you need:</strong></h3><ol><li>Responsiveness. As a result of an enemy dying multiple separate systems, such as the AudioManager, the Scoreboard and the LootSystem might need to do something. Foremost, this means that no polling needs to be done in an Update loop to check if the condition has been met. Polling is when you periodically check if a condition has been met. This is slower to react and more performance intensive.</li><li>Loose coupling. To continue the example, the enemy which calls the bus doesn’t know about all these systems by name, it just knows about publishing an event. This also means that the scene will keep working with or without some of the subscribers, giving you the flexibility of removing the Scoreboard entirely without refactoring the enemy.</li><li>Asynchronicity. You don’t always want immediate effects and an event bus is the perfect place to keep a paper trail that can be consulted later by any script that is so interested. What if the LootSystem needs to increase the player’s chance of something being dropped every time they don’t get anything?</li></ol><h3>How to set it up?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cW7ScCwxjlR2kA3aMZ7w2Q.png" /></figure><p>The Bus itself is relatively simple. An implementation like above will serve nicely to get you started. We have a list of subscribers per topic (event type) and 3 methods, so that we can add/remove subscribers from event types and publish different types. Since each topic has it’s own subscriber list, scripts that don’t need to know, won’t be told about an event happening.. The EventBus class is static so as to not have to bother with adding it in the scene, tracking state across scenes and all that, a singleton would work as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*2xFgDE8WPBRgiuwy2oRhrw.png" /></figure><p>In the subscribe method , we check if there is already a list of subscribers for the type of event we want to start listening to, or if we need to initialize a new list, afterwards adding the individual subscriber. All relatively simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*lfJtjLwiNxh_8DtMOE4fag.png" /></figure><p>Unsubscribing, similarly, is straightforward. We should check if the event has a list of subscribers, remove this particular one, and then, if there are none left, remove the empty list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Z5khT6sucRvQrBU6P-WoA.png" /></figure><p>Finally, in publish we go through all the handlers and invoke the event on them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*CP-DnLSF02EJQXOGc-aTkA.png" /></figure><p>Inside of a subscriber, the code could look something like above. Here we are assigning a method to a delegate in OnEnable and removing it OnDisable, to prevent memory leaks. In the OnSomeGameEvent we could access the data of someEvent and use it to determine what to sound to play, then have a deep voiced narrator uttering: “Bishop takes pawn on e5. A calculated move, opening up the diagonal for potential pressure on the opponent’s king”.</p><p>Back in the first picture you can notice that what we have in the event bus is actually a list of delegates, that keep a reference to this method, we are telling the bus what method we want called inside of this script when the event of this type is invoked.</p><h3>Example and Event History</h3><p>What if we need to keep an audit trail? Maybe we want to display a little history of all the moves we have made? Maybe we want the enemy AI to have access to this state so that it can make decisions based on previous patterns, instead of brute forcing calculations. In that case we can add an event history as pictured below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6RvEFX0iboQ6R10Ty3zjw.png" /></figure><p>Here we have two new properties, the history itself and a MaxHistorySize if we want to limit the amount of events we store. The only method then that needs adjusting is the Publish, where we will store the event in the history and clear the oldest if we are above the limit. The Queue data type is perfect here as it is custom tailored for our first in first out needs.</p><h3>Conclusion</h3><p>Event driven architecture can be very powerful and clean, however care should be taken to not overuse it. It is not the case that the looser the coupling the better, sometimes all you want is for script A to call script B but to keep all your references centralized, or to have A and B call C.</p><p>It should also be mentioned that you need to be careful with static classes. They persist across scenes and can retain state when not expected. Moving from scene to scene for example will not reset the state, it has to be manually cleared if necessary.</p><p><a href="https://medium.com/@andrewnicholasene/the-service-locator-pattern-scalable-script-communication-in-unity-for-small-to-medium-sized-e021407d965b">For those times I would recommend the Service Locator pattern that I have described in a previous article.</a></p><p>For more patterns and articles on architecture in Unity, stay tuned. Until then, I wish you a good one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0edf57ac7cf7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Service Locator Pattern in Unity]]></title>
            <link>https://medium.com/@andrewnicholasene/the-service-locator-pattern-scalable-script-communication-in-unity-for-small-to-medium-sized-e021407d965b?source=rss-2991961e55db------2</link>
            <guid isPermaLink="false">https://medium.com/p/e021407d965b</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[unity-engine]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Andrew Nicholas Ene]]></dc:creator>
            <pubDate>Sun, 22 Sep 2024 13:15:02 GMT</pubDate>
            <atom:updated>2024-12-04T22:38:25.757Z</atom:updated>
            <content:encoded><![CDATA[<h4>Scalable Script Communication in for Small to Medium-sized Projects</h4><p>You’re making your game and all is well for a while, you start with just a player controller and move about the screen jumping, dashing or shooting. But then <strong>suddenly you have two scripts that need to talk to each other, you have a dependency.</strong> The enemy AI script needs a reference to the player, the combat manager needs a reference to the scoreboard or the menu needs a reference to the save system.</p><p>You can of course use the inbuilt <em>FindObjectOfType&lt;T&gt;()</em> but this is quite expensive as it combs through the entire scene, you can use the <em>SerializeField</em> attribute but you will have to redo all these references every time you put the scripts anew in a different scene, and making everything a singleton will gradually spaghettify your code as you will lose the ability to trace who is talking to whom and when.</p><h4>No more headaches as your project grows</h4><p>While there is no one way to solve your dependency problems in Unity, there are certainly ways that scale better. And as your project starts spanning months, scalability will begin to matter more and more. S<strong>cript communication is one of the few things that is much better done right straight from the get go.</strong></p><h3><strong>Setting up the Service Locator</strong></h3><p>The service locator pattern is relatively simple, and as a more primitive form of dependency injection will prove quite familiar to software developers dipping their toes into game development. <strong>You set up one script which has a dictionary with all the services you want passed around, which is a Singleton</strong>, your one and only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*eopzpZfo0LG8uqkal84BDw.png" /></figure><p><strong>Because this is a static instance it can be referenced to from anywhere in your code</strong>, across scenes as well which can enable you to split your game into multiple additively loaded scenes. Inside the Service Locator you define the methods listed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*ZYE8PdhNPO6eb4jYUcxj0Q.png" /></figure><p>This setup allows any script to register itself and any script to ask for any other script. The one caveat here is of course that <strong>this only works if the script that is asking for a service, does so after that service has been registered and not before.</strong> In order to ensure the proper timeline is kept we need to keep in mind two things.</p><h4>1. Give the Service Locator a fixed negative time in the Script Execution Order</h4><p>Go into Edit &gt; Project Settings &gt; Script Execution Order and add the Service Locator, placing it at a negative time. The reason for this is that Unity does not guarantee a specific order of execution for scripts not assigned here, and <strong>we need the ServiceLocator to initialize itself before any other script has the chance to call it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*W4yFTxjCDU6PQ1FJjHobbw.png" /></figure><h4>2. Register your dependencies in Awake, Grab them in Start.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i-tf3nUe9ADRfLTzlyw0Ig.png" /></figure><p>Monobehaviours have a specific lifecycle order in which their functions get called, with Awake() being executed before Start(). This is not to be confused with the script execution order which determines the priority between different scripts when deciding <strong>whose </strong>Awake() will run first. In short, we know for sure that <strong>by doing this we will have the service already registered by the time we need it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*REAdBv4qHFSiNuj7KnvxIw.png" /></figure><h3><strong>Conclusion</strong></h3><p>This solution works wonders for smaller projects but you might find the relatively tight coupling limiting. In this circumstance, event driven architecture, where events are published, but if there there is no one to listen to them nothing breaks, might be a better fit for your use case.</p><p>If you need more flexibility in terms of what is injected, when services are initialized, support for interfaces and multiple implementations, you might need to add additional depth to your Service Locator by creating more of a Dependency Injection Framework.</p><p><strong>For these and other patterns, stay tuned. Until then I wish you a good one.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e021407d965b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>