<?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 Aditya Acharya on Medium]]></title>
        <description><![CDATA[Stories by Aditya Acharya on Medium]]></description>
        <link>https://medium.com/@acharya.aditya.2005?source=rss-7c639db4d0a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*o7XUjAhRrGFUYIk0</url>
            <title>Stories by Aditya Acharya on Medium</title>
            <link>https://medium.com/@acharya.aditya.2005?source=rss-7c639db4d0a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 08:51:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@acharya.aditya.2005/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[I Didn't Text You. My Code Did.]]></title>
            <link>https://medium.com/gdg-vit/i-didnt-text-you-my-code-did-496c1c424200?source=rss-7c639db4d0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/496c1c424200</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <dc:creator><![CDATA[Aditya Acharya]]></dc:creator>
            <pubDate>Sun, 28 Sep 2025 10:11:33 GMT</pubDate>
            <atom:updated>2025-09-30T15:56:17.800Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>I Didn’t Text You. My Code Did.</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVRLimSFW3kAzw66SKgkJA.png" /></figure><p>If I had a rupee for every “fr bro” I’ve sent, I’d have enough to buy my own API quota.</p><p>Somewhere between my fourth “lmao fr” of the day and yet another “that’s craaazy bro”, I had a lightbulb moment. I was replying for the sake of replying. Not present. Not engaged. Just… <em>autopiloting</em>.</p><p>And then I had a deeply cursed and beautifully lazy thought: if I’m already replying like a bot, why not build one that actually <em>acts</em> like me? So I did what any self-respecting CS student would do: I automated my own conversations — equal parts code, chaos, and social survival.</p><p>A bot that could read my WhatsApp messages, understand what kind of nonsense I usually reply with, and shoot back something that sounds like me — sarcasm, dry humor, Gen-Z slang and all. Not just any auto-reply bot, one that could keep up the illusion that I was still an active, emotionally available human being online.</p><h3>Building the Bot</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*tDBeqYXwG3jfcOZJ3drbdw.png" /></figure><h4>Browser Automation with Selenium</h4><p>Before I could teach my bot to <em>talk</em> like me, I had to teach it to <em>see, </em>not with literal vision, but with just enough awareness to recognize unread messages and figure out when it was its time to shine. That meant getting it to interact with WhatsApp Web. So, I turned to <a href="https://saucelabs.com/lp-selenium-getting-started?utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=EMEA_Frameworks-Selenium_FY26&amp;utm_content=Site_SeleniumGettingStarted_RequestADemo&amp;utm_term=Velocity&amp;gad_source=1&amp;gad_campaignid=21340982879&amp;gbraid=0AAAAAo2qTxqsiCtd9pOkrcjCdT4dwZJ1l&amp;gclid=Cj0KCQjwkILEBhDeARIsAL--pjzEajGJzVF7y20j4Q70GMT9Y35CHhN_ZBFJar9jBhJ0k4SCTpjMIpEaAkVxEALw_wcB"><strong>Selenium</strong></a><strong>, </strong>the go-to tool when you want to automate anything that happens in a browser. Paired with <a href="https://developer.chrome.com/docs/chromedriver"><strong>ChromeDriver</strong></a>, Selenium let me write a script that could control Chrome: click on chats, read messages, even type and send replies just like a very committed intern with no work-life balance.</p><p><strong>Keeping Myself Logged In<br></strong>One of the first headaches I ran into? WhatsApp Web resets itself every time a new Chrome session starts, meaning I’d have to scan the QR code every time I ran the bot. Absolutely not.</p><pre>#main.py<br>options.add_argument(r&quot;--user-data-dir=C:\Users\Aditya\AppData\Local\Google\Chrome\User Data&quot;)<br>options.add_argument(r&quot;--profile-directory=Default&quot;)</pre><p>This tells Chrome to boot up using my regular browser profile. So now, when the bot opens WhatsApp Web, it skips the QR screen entirely.</p><p><strong>Booting Up WhatsApp Web<br></strong>Now that we had a browser window with my logged-in profile, the bot could go ahead and load up WhatsApp Web:</p><pre>    #main.py<br>    driver = webdriver.Chrome(service=service, options=options)<br>    driver.get(&#39;https://web.whatsapp.com&#39;)<br><br>    print(&quot;Waiting for QR Code scan...&quot;)<br>    while True:<br>        try:<br>            driver.find_element(By.XPATH, &#39;//div[@contenteditable=&quot;true&quot;]&#39;)<br>            break<br>        except:<br>            time.sleep(2)<br><br>    print(&quot;Login successful.&quot;)</pre><p>Of course, just because the page <em>loads</em> doesn’t mean it’s ready. So I added a little loop that waits for the chat input field to appear, a sign that everything’s fully loaded and ready for action. Once this passes, we’re officially in. Welcome to WhatsApp Web.</p><p><strong>Locating Chats in the Sidebar <br></strong>The next move was to scan the sidebar for active chats. WhatsApp renders each conversation preview as a separate div, and luckily, these chat containers come with a nice little attribute: data-testid=&quot;cell-frame-container&quot;<br>Selenium can grab all of them like this:</p><pre>#main.py<br>chat_elements = driver.find_elements(By.XPATH, &#39;//div[@data-testid=&quot;cell-frame-container&quot;]&#39;)</pre><p>Each of these elements represents a chat visible in the left panel — whether it’s your best friend, a dead meme group from 2021, or that one class project group you forgot to leave.</p><p><strong>Whitelisting Chats I Actually Want to Talk To<br></strong>This bot isn’t supposed to respond to <em>everyone</em> (Letting it talk in class groups would be actual career sabotage). So I used a <strong>whitelist</strong>: a simple JSON file where I list only the names of people or groups I want the bot to interact with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*kTQ37ukJ1ryyGDTmn0rq_A.gif" /><figcaption>How my bot would act without a whitelist</figcaption></figure><p>Here’s a snippet of how the logic works:</p><pre>#main.py<br>with open(&quot;whitelist.json&quot;) as f:<br>    whitelist = json.load(f)<br><br>chat_title = chat_element.text.split(&#39;\n&#39;)[0]<br>if chat_title in whitelist:<br>    # this is a chat we care about</pre><p>This way, the bot filters through all open chats and only enters the ones I’ve explicitly allowed.</p><p><strong>Polling for New Messages<br></strong>Once inside a whitelisted chat, the bot needs to check: <em>has anyone said something new?</em> For that, I scan the incoming messages and grab the text of the most recent messages.</p><pre>#main.py<br>messages = driver.find_elements(By.XPATH, &#39;//div[contains(@class, &quot;message-in&quot;)]&#39;)<br>last_n = messages[-n:]<br>        texts = []<br>        for msg in last_n:<br>            spans = msg.find_elements(By.XPATH, &#39;.//span[contains(@class, &quot;selectable-text&quot;)]/span&#39;)<br>            if spans:<br>                texts.append(spans[-1].text)</pre><p>To avoid replying multiple times to the same message, I hash it and store that hash in memory (or a temporary log). That way, if the latest message is the same as before, we skip replying.</p><pre>#main.py<br>msg_hash = hashlib.md5(last_msg.encode()).hexdigest()<br>if msg_hash != last_msg_hash:<br>    # reply and update hash</pre><p>I also keep track of <em>cooldowns, </em>to prevent the bot from replying too frequently in the same chat. Just like me, it needs breaks between bursts of conversation.</p><h4>Personalized Responses using RAG + LLM</h4><p>With messages flowing in from WhatsApp, the next challenge was clear: how do I generate replies that actually sound like <em>me</em>?<br>Cue the<strong> LLM.<br></strong>Whenever the bot detects a new message, it feeds that message to a language model and gets a reply back. Simple enough, right?<strong> </strong>But here’s the problem, out-of-the-box LLMs don’t know how I text. They don’t know that I say “I&#39;m cooked💀” when I’m in trouble or that “fr” is basically my second language. So, I used something called <a href="https://aws.amazon.com/what-is/retrieval-augmented-generation/"><strong>Retrieval-Augmented Generation (RAG)</strong>.</a></p><p><strong>Retrieval-Augmented Generation (RAG)<br></strong>RAG is like open-book exams for LLMs — don’t cram everything in its head, just hand it the right notes when it’s asked a question. Technically, it retrieves relevant context from an external knowledge base and feeds it into the LLM at inference time to generate more accurate, grounded responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zez5YdJIzMfomZxq.png" /><figcaption>Visual breakdown of how RAG works</figcaption></figure><p>So I did this:</p><ol><li>Took a bunch of my past WhatsApp replies.</li><li>Turned them into <strong>embeddings</strong></li><li>Stored them in a database.</li><li>When a new message came in, I searched for the replies that felt <em>closest in meaning</em>.</li><li>Passed those retrieved messages as <strong>context</strong> into the LLM.</li></ol><p>That way, the bot wasn’t just guessing, it was drawing from my actual past replies. My sarcasm, my tone, my Gen-Z energy — baked right in.</p><p><strong>Curating My Past Chat Data<br></strong>To help the bot learn how I actually text, I needed real examples, the kind that <em>sound like me</em>. So I picked a few WhatsApp chats with friends where my usual texting quirks, casual slang, and questionable emoji choices were all on full display.</p><p>I saved each message in a clean JSON format like this:</p><pre>#data/chat_data.json<br>{<br>    &quot;timestamp&quot;: &quot;2025-06-26T16:48:00&quot;,<br>    &quot;speaker&quot;: &quot;Aditya Acharya&quot;,<br>    &quot;text&quot;: &quot;Cooked&quot;,<br>    &quot;source&quot;: &quot;sadhya-chat&quot;<br>}</pre><p>Each entry had:</p><ul><li>a timestamp (for reference),</li><li>a speaker field (so I could filter only my messages later),</li><li>the actual text,</li><li>and a source label to keep track of which conversation it came from.</li></ul><p>Simple, readable, and perfect for feeding into the next steps.</p><p><strong>Chunking My Messages (Because Context Matters)<br></strong>Once I had my chats in a clean JSON format, I needed to <strong>prepare them for search, </strong>because the bot shouldn’t have to scroll through thousands of messages every time. This is where <strong>chunking</strong> and <strong>embedding</strong> come in.</p><p>Large Language Models (and embedding models) don’t process conversations message-by-message , they understand <strong>context</strong> better when you give them <strong>coherent chunks of text</strong>. So I grouped a few messages together into batches of around 500 characters, with a bit of overlap (50 characters) to preserve continuity.</p><p>Here’s how the chunking logic works:</p><pre>#retriever/chunk_chat.py<br>def chunk_messages(messages, chunk_size=500, overlap=50):<br>    chunks = []<br>    current_chunk = &quot;&quot;<br>    chunk_id = 0<br><br>    for msg in messages:<br>        if &quot;speaker&quot; not in msg or &quot;text&quot; not in msg:<br>            continue  # skip incomplete messages<br><br>        msg_text = f&quot;{msg[&#39;speaker&#39;]}: {msg[&#39;text&#39;]}&quot;<br>        if len(current_chunk) + len(msg_text) + 1 &lt;= chunk_size:<br>            current_chunk += msg_text + &quot;\n&quot;<br>        else:<br>            # Save current chunk<br>            chunks.append({<br>                &quot;text&quot;: current_chunk.strip(),<br>                &quot;source&quot;: msg.get(&quot;source&quot;, &quot;unknown&quot;),<br>                &quot;chunk_id&quot;: chunk_id<br>            })<br>            chunk_id += 1<br>            current_chunk = msg_text + &quot;\n&quot;  # start new chunk<br><br>    if current_chunk:<br>        chunks.append({<br>            &quot;text&quot;: current_chunk.strip(),<br>            &quot;source&quot;: messages[-1].get(&quot;source&quot;, &quot;unknown&quot;),<br>            &quot;chunk_id&quot;: chunk_id<br>        })<br><br>    return chunks</pre><p><strong>What this does:</strong></p><ul><li>Combines chat lines from my WhatsApp JSON into compact but coherent blocks.</li><li>Adds a source and chunk_id to keep track of where each chunk came from.</li><li>Ensures no chunk exceeds the size limit, while still preserving conversational flow.</li></ul><p>The final result looked something like:</p><pre>#data/chat_chunks.json<br>{<br>  &quot;text&quot;: &quot;Aditya Acharya: psg absolutely cooking\nAditya Acharya: omh\n... \nMayukh: Fax bro\nAditya Acharya: brooo that fan was in absolute tears lol&quot;,<br>  &quot;chunk_id&quot;: 1,<br>  &quot;source&quot;: &quot;mayukh-chat&quot;<br>}</pre><p><strong>Generating Embeddings — Teaching the Bot What Stuff <em>Means<br></em></strong>Now I had a bunch of chat chunks that look like mini conversation snippets, but just having those chunks sitting in a JSON file doesn’t mean much unless the bot can <em>understand</em> and <em>compare</em> them.</p><p>For this I needed a smarter representation — enter <strong>embeddings</strong>. Embeddings are basically the language of meaning for machine learning models. Instead of storing the text as plain strings, we represent each chunk as a <strong>vector of numbers. </strong>Think of embeddings as a way to map text into a <em>multi-dimensional space</em> where meaning matters more than wording. Two messages that <em>feel</em> the same (even if they use totally different words) will end up close together in this space.</p><p>For example: &quot;bro this lecture is frying my brain&quot; and &quot;my brain&#39;s gone, this class is a crime&quot; might look totally different in terms of words, but their <strong>embeddings</strong> will be pretty close, because semantically, they’re both about academic suffering.</p><p>To create these embeddings, I used a model called <strong>all-MiniLM-L6-v2</strong> from the <strong>SentenceTransformers</strong> library. It&#39;s lightweight, decently accurate, and super fast — perfect for this use case.</p><pre>#retriever/generate_embeddings.py<br>from sentence_transformers import SentenceTransformer<br><br>model = SentenceTransformer(&quot;all-MiniLM-L6-v2&quot;)<br><br>for chunk in chunks:<br>    text = chunk[&quot;text&quot;]<br>    embedding = model.encode(text)<br>    chunk[&quot;embedding&quot;] = embedding.tolist()  # Make it JSON-safe</pre><p>Once encoded, the chunk might look like this:</p><pre>#data/chat_chunks_embedded.json<br>{<br>  &quot;text&quot;: &quot;me after attending one more 8am class: 🧍‍♂️&quot;,<br>  &quot;embedding&quot;: [0.012, -0.233, 0.147, ...]  // vector of meaning<br>}</pre><p>It’s like every message I’ve ever sent is now wearing a GPS tag, floating somewhere in a giant ‘<em>map of meaning</em>’. So when someone sends a new message to the bot, it can:</p><ol><li>Embed that incoming message,</li><li>Compare it to all stored vectors,</li><li>Find the replies I’ve given that <em>feel</em> the most similar.</li></ol><p><strong>Generating Replies — Putting RAG to Work<br></strong>Once the embeddings are all set up, the bot can finally do what it was built for, reply to real-time messages in a way that still sounds like me, not some overly polite robot who uses full stops and capital letters.</p><p>Whenever a new message comes in on WhatsApp, the first thing the bot does is embed it using the same <strong>all-MiniLM-L6-v2</strong> model. This ensures the new message is represented in the exact same <em>multi-dimensional space</em> as the past chunks.</p><pre>#llm.py<br>query_embedding = model.encode(incoming_msg, normalize_embeddings=True)</pre><p>With the new message turned into a vector, the next step is to figure out which of my past replies are most similar in <em>meaning</em> to this one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/0*JxTimta4BCk4vCQ-.jpeg" /><figcaption>Visual representation of semantic matching using cosine similarity</figcaption></figure><p>This is where <a href="https://www.ibm.com/think/topics/cosine-similarity"><strong>cosine similarity</strong></a> comes in. Since all embeddings are just high-dimensional vectors, we calculate the cosine of the angle between the query vector and each stored embedding. A <strong>higher</strong> cosine similarity (closer to 1) means the messages are <strong>semantically closer</strong>.</p><pre>#llm.py<br>def cosine_similarity(a, b):<br>    return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))<br><br># Compute similarity with all stored chunks<br>scored_chunks = []<br>for chunk in stored_chunks:<br>    score = cosine_similarity(query_embedding, chunk[&quot;embedding&quot;])<br>    scored_chunks.append((score, chunk))<br><br># Sort and pick the top few<br>top_chunks = sorted(scored_chunks, key=lambda x: x[0], reverse=True)[:5]</pre><p>Now comes the RAG part. These selected chunks are stitched together to form a <strong>custom prompt</strong> for the LLM. Instead of a generic instruction like <em>“Reply to this casually,”</em> the LLM gets to see a handful of real replies I’ve made in similar contexts. It’s like giving the model a crash course on <em>how I talk</em> every time it sees a new message.</p><pre>#llm.py<br>context = &quot;\n&quot;.join([chunk[&quot;text&quot;] for chunk in top_k_chunks])<br>prompt = f&quot;&quot;&quot;You are Aditya, replying to a WhatsApp message. Use lowercase, keep it short, and don&#39;t use full stops.<br><br>Incoming message: &quot;{incoming_message}&quot;<br><br>Here are some past replies Aditya has given in similar situations:<br>{context}<br><br>Reply in Aditya&#39;s style:&quot;&quot;&quot;</pre><p>This prompt is passed into the language model (in my case, <strong>Gemini</strong>) with a fairly simple role: <em>reply like Aditya would</em>. The magic is that it’s not just guessing based on tone, it’s grounded in actual stuff I’ve said before. Even if the new message is something the bot’s never seen, it can synthesize a reply that fits the same energy and emotional range.</p><pre>#llm.py<br>final_response = gemini.generate(rag_prompt)</pre><p>By now, the bot could take a message, understand it, dig up the most relevant bits of my chat history, and feed them to<strong> Gemini </strong>so it could reply in my style. But here’s the thing, “<em>my style</em>” isn’t just word choice and lowercase text. It’s the mood swings, the deadpan comebacks, and the occasional sarcastic meltdown when Ferrari’s pit crew decides to cosplay as clowns.<br>So I started adding these little <em>personality enhancers</em> — not essential for the core logic, but absolutely necessary if the bot was going to pass for me in an actual conversation.</p><p><strong>Extras That Made the Bot Actually Feel Like Me</strong></p><p>One of the first things I added was <strong>emotional triggers</strong>, certain words that instantly change the tone of my messages. If someone mentions “Ferrari,” “UCL final,” or “last minute clutch,” there’s a noticeable bump in energy (or rage, depending on the outcome).<br>The bot detects these triggers and subtly tweaks its replies — more sarcasm, more energy, maybe even a perfectly placed 💀.</p><pre>HYPE_KEYWORDS = [<br>    &quot;ferrari&quot;, &quot;ucl&quot;, &quot;final&quot;, &quot;heartbreak&quot;, &quot;podium&quot;,<br>    &quot;insane&quot;, &quot;cracked&quot;, &quot;clutch&quot;, &quot;last minute&quot;<br>]<br><br>def is_emotional_trigger(text: str) -&gt; bool:<br>    return any(word in text.lower() for word in HYPE_KEYWORDS)</pre><p>If the trigger is found, the bot adds a note to the system prompt telling Gemini to amp things up. No trigger? Then it keeps things chill and low-effort, like 80% of my actual messages.</p><p>The next upgrade was a <strong>rule-based fallback system</strong> for when the LLM inevitably decides to take a coffee break and returns something unusable.<br>Instead of giving a generic “I don’t know” or a suspiciously polite reply, it falls back to pre-written sarcastic lines for common topics:</p><pre>FALLBACK_RULES = {<br>    &quot;where&quot;: &quot;probably home or dead inside idk&quot;,<br>    &quot;exam&quot;: &quot;pls don’t remind me&quot;,<br>    &quot;race&quot;: &quot;yea hoping ferrari doesn&#39;t fumble for once&quot;,<br>    &quot;college&quot;: &quot;ugh starting soon i think&quot;,<br>    &quot;food&quot;: &quot;starving actually&quot;<br>}<br><br>def rule_based_reply(message: str) -&gt; str:<br>    msg = message.lower()<br>    for keyword, reply in FALLBACK_RULES.items():<br>        if keyword in msg:<br>            return reply<br>    return &quot;lol idk bro&quot;  # generic fallback</pre><p>The nice part about this system is that it doesn’t just make the bot more resilient, it also keeps it sounding <em>on-brand</em> even when the AI goes off-script.</p><p>Finally, there’s a small <strong>reply sanitizer</strong> that keeps the bot’s tone consistent.<br>Even if Gemini tries to sneak in a full stop or starts capitalizing things like it’s writing an email to HR, this step strips it down to lowercase, removes unnecessary punctuation, and keeps it casual.</p><pre>def sanitize_reply(reply: str) -&gt; str:<br>    reply = reply.strip()<br>    reply = re.sub(r&#39;(?&lt;!\w)\.(?!\w)&#39;, &#39;&#39;, reply)  # remove rogue full stops<br>    reply = re.sub(r&#39;\s{2,}&#39;, &#39; &#39;, reply)<br>    return reply.lower()</pre><p>With these add-ons, the bot went from <em>technically functional</em> to <em>dangerously convincing</em>.</p><h4>Letting It Loose</h4><p>The real test wasn’t in the code editor, it was on WhatsApp. I quietly let the bot take over a few conversations, just to see if it could actually pass as me. And honestly? It was <em>pretty </em>good. Most of the time, the replies were so on-brand that even I forgot it wasn’t me typing.<br>Take this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KITfUkuHQRUIer2rjIIo4g.png" /></figure><p>That’s exactly how I’d have replied. My friends didn’t suspect a thing.</p><p>But every now and then, the mask slipped — just enough to make me laugh. Like this gem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fxFY1mmjCjMRZ1WLhAZY4g.png" /></figure><p>Luckily, it happened so rarely that it felt more like an inside joke than a real giveaway. Most of the time, though, the bot blended in seamlessly. It wasn’t just “working”, it was basically living a double life as me, with only the occasional weird slip reminding me there was still an AI behind the curtain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*IBXagxYMLkOTJ6T0MymAcw.png" /></figure><h4>Wrapping It Up</h4><p>Building this bot turned out to be way more than just a “<em>fun side project.</em>” It’s like I managed to bottle up my texting personality into code, powered by a mix of <strong>embeddings</strong>, <strong>RAG</strong>, and some <strong>carefully tuned prompts</strong>. And while it’s far from perfect, it’s already proven it can hold its own in real conversations.</p><p>Of course, there’s still a lot more I could add. Right now, I’ve already integrated a small <strong>CLI control </strong>to toggle the bot on/off (so it doesn’t start roasting people while I’m in class). Down the line, I’d love to refine the emotional trigger system, improve the context window so it <em>remembers longer conversations</em>, and maybe even hook it up with real-time voice input.</p><p>If you want to check out the code, I’ve put it all up on GitHub here: <a href="https://github.com/Aditya-Acharya12/whatsapp-auto-replier"><strong>GitHub Repo Link</strong></a>. Feel free to fork it, play around with the setup, or even make your own personality-driven bot.</p><p>At this point, if you’re texting me, there’s a<strong> 30% chance</strong> it’s not me. And honestly? I’m okay with that.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=496c1c424200" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdg-vit/i-didnt-text-you-my-code-did-496c1c424200">I Didn&#39;t Text You. My Code Did.</a> was originally published in <a href="https://medium.com/gdg-vit">GDG VIT Vellore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tech on the Field: The Real MVP]]></title>
            <link>https://medium.com/gdg-vit/tech-on-the-field-the-real-mvp-232bcd9a2fed?source=rss-7c639db4d0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/232bcd9a2fed</guid>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[cricket]]></category>
            <category><![CDATA[football]]></category>
            <category><![CDATA[f1]]></category>
            <category><![CDATA[football-analytics]]></category>
            <dc:creator><![CDATA[Aditya Acharya]]></dc:creator>
            <pubDate>Fri, 18 Apr 2025 12:16:27 GMT</pubDate>
            <atom:updated>2026-05-31T09:47:08.921Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rp_KRYKS_znjzd9tt3nYw.png" /></figure><h3>Beyond the Human Eye</h3><p>The “<a href="https://www.youtube.com/watch?v=-ccNkksrfls"><strong>Hand of God</strong></a>” is a phrase that instantly conjures up images of controversy and the inherent limitations of human officiating in sports. Did the ball hit Maradona’s hand? Was it <em>divine intervention</em>? Or perhaps just a really good impression of a header?</p><p>These questions sparked endless debate, with no definitive, objective answer. Diego Maradona’s infamous goal in the 1986 World Cup perfectly illustrates the problem: in the heat of the moment, the human eye can miss crucial details, leading to potentially game-changing errors.</p><p>Thankfully, technology offers a less… <em>theological</em> solution. Today, sophisticated systems are revolutionizing fair play, providing objective data and instant replays for greater accuracy. High-speed cameras and sophisticated algorithms analyzing player movements now offer vast data for fairness. Let’s have an in-depth look at some of these technologies that are changing the face of sports officiating.</p><h3>Football’s High-Tech Referee</h3><p>In a sport where a well-timed dive (we’re looking at you,<em> Neymar</em>!) can sway decisions as much as a stunning goal, football officials face a “<em>perfect storm</em>” of subjective rules and theatrical play. The <strong>Video Assistant Referee</strong> <strong>(VAR)</strong> system arrived with the promise of navigating this storm, but has it been smooth sailing?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*6GNh_v9oaBrh_7rBFh3mEA.png" /></figure><h4>Eyes Everywhere</h4><p>At the heart of VAR lies a sophisticated camera infrastructure designed for comprehensive data acquisition. Modern setups utilize a <strong>minimum of 8</strong> high-definition cameras, with top-tier competitions often employing <strong>12 or more </strong>— <em>talk about being watched!</em></p><p>These cameras are strategically positioned around the stadium — along the <em>sidelines</em>, <em>behind each goal</em>, and with specialized <em>offside cameras </em>(because offsides are, let’s face it, a constant source of debate). This “<strong>eyes everywhere</strong>” approach aims to eliminate blind spots and provide the crucial footage for review.</p><p>These cameras capture video at high frame rates of <strong>50 or 60 fps</strong>, with some systems going even higher for detailed slow-motion analysis, and at resolutions of <strong>1080p (Full HD) or 4K (Ultra HD)</strong>, generating a substantial volume of data. To handle this data load, high-bandwidth fiber optic cables transmit the video feeds in real-time to the <strong>VAR Operations Room</strong> (VOR).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OelhBLRgOEYFugoU" /><figcaption>FIFA’s camera setup for the 2018 World Cup</figcaption></figure><h4>Inside the VOR</h4><p>The <strong>VAR Operations Room (VOR)</strong> is the central command center for real-time video analysis and communication. It features multiple high-resolution broadcast monitors providing a comprehensive view of all camera feeds. Here, a team meticulously analyzes the feeds, using specialized software to dissect incidents frame by frame.</p><p>Secure, encrypted audio channels using noise-canceling headsets (so the VARs can <em>focus on the action, not the crowd noise</em>) ensure<strong> clear communication</strong> between the <strong>VAR team</strong> and the <strong>on-field referee</strong>, often via fiber optic links, with backup channels for redundancy — acknowledging that <em>even tech can have an off day.</em></p><p>This highlights the importance of the<strong> human element </strong>in interpreting the information, as seen in the controversy surrounding the disallowed <strong>Luis Diaz goal in the Tottenham vs. Liverpool match</strong>, where human error in applying the VAR protocol significantly undermined confidence in the system’s ability to deliver flawless officiating.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQ1N2shu-h38%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQ1N2shu-h38&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQ1N2shu-h38%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac99ac84177847a37cb38ed4f9cec5bc/href">https://medium.com/media/ac99ac84177847a37cb38ed4f9cec5bc/href</a></iframe><h4>How Replay Software Powers VAR</h4><p>The replay software is crucial for detailed incident analysis. It uses <a href="https://support.3playmedia.com/hc/en-us/articles/227730848-SMPTE-Timecode-Explained"><strong>SMPTE timecode</strong></a><strong> </strong>for frame-accurate synchronization of all camera feeds, allowing simultaneous multi-angle viewing. Smooth slow-motion playback is achieved through <em>frame interpolation</em>.</p><p>Digital zoom, often enhanced with sharpening filters, allows close examination of details. Graphical overlays are a key feature: Offside line technology uses dedicated cameras, image processing, and 3D field reconstruction to determine player and ball positions at the moment of the pass. This is no simple line drawing; it’s complex geometry and <em>computer vision</em> at work.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FC164kYMGV1A%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DC164kYMGV1A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FC164kYMGV1A%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e4cebff90c6b8f39f596c43b1380f9e/href">https://medium.com/media/1e4cebff90c6b8f39f596c43b1380f9e/href</a></iframe><p><strong>Semi-Automated Offside Technology (SAOT)</strong> enhances this with limb tracking and 3D skeletal models for even greater precision. Based on the 3D data, the software generates a<strong> virtual offside line</strong> on the field. This line represents the position of the second-to-last defender (or the ball, if it’s closer to the goal line) at the precise moment the ball is played — meaning the chances of an incorrect offside call are theoretically lower than <em>Tottenham’s chances of winning a major trophy</em>.</p><h3>Cricket DRS 101</h3><p>Cricket umpires face the unenviable task of making calls that are often scrutinized, like a close run-out, even by the players themselves — unless, of course, you’re <em>MS Dhoni</em>, whose Decision Review System (DRS) calls are so plumb that the system is jokingly called the ‘<em>Dhoni Review System</em>’. From predicting the trajectory of a spinning ball to detecting the faintest of edges, these challenges underscore why DRS is a technological necessity.</p><h4>The Science of Ball Tracking</h4><p>Imagine a spinning, dipping delivery hurtling towards the batsman’s pads — a classic LBW scenario. To analyze this, <a href="https://en.wikipedia.org/wiki/Hawk-Eye"><strong>Hawk-Eye</strong></a> uses six to eight high-speed cameras, each operating at over <strong>340 frames per second</strong>. Before each match, a meticulous calibration process using a specialized grid ensures the system’s virtual representation of the pitch is accurate to within <em>millimeters</em>, similar to the precision of a DRS review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*dbO3tzZ2GFQgJOhHwp3aaA.png" /></figure><p>The captured images are then processed using advanced computer vision algorithms, such as <a href="https://thekalmanfilter.com/kalman-filter-explained-simply/"><strong>Kalman</strong></a> and <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC7826670/#sec4-sensors-21-00438"><strong>particle filtering</strong></a>, which track the ball’s movement with exceptional accuracy. A physics-based model, incorporating factors like<em> ball spin</em>, <em>air resistance</em>, and <em>bounce</em>, is used to predict the ball’s trajectory after pitching.</p><p>This predictive modeling involves complex mathematical calculations, including <strong>differential equations</strong> to model the ball’s flight path, and is crucial for LBW decisions. It’s akin to determining if a delivery from Rashid Khan, with his characteristic sharp leg-spin and deceptive googly, aimed at the batsman’s pads, would have resulted in an LBW — a decision that even experienced umpires find challenging.</p><p>For LBW, <a href="https://en.wikipedia.org/wiki/Hawk-Eye"><strong>Hawk-Eye</strong></a> generates a virtual trajectory showing the ball’s predicted path through the stumps, calculating impact point, remaining velocity, and deviation. A ‘<em>zone of uncertainty</em>’ reflects the limitations of these models. This is where <strong>‘Umpire’s Call’ </strong>applies: if the predicted trajectory falls within this zone, the on-field umpire’s decision stands, acknowledging that absolute certainty isn’t always achievable and ensuring the human element remains.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7MfLv9hqYXM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7MfLv9hqYXM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7MfLv9hqYXM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4498f6fd317696d6548e5c0773d95ead/href">https://medium.com/media/4498f6fd317696d6548e5c0773d95ead/href</a></iframe><h4>The Sound of an Edge</h4><p>Imagine trying to hear the faintest nick of a bat’s edge in a stadium full of roaring fans. That’s the essence of the <strong>UltraEdge </strong>challenge. This system uses multiple highly sensitive condenser microphones embedded within the stumps, designed to pick up even the slightest sound amidst the crowd. Think of it as cricket’s audio forensic team, strategically listening for the telltale ‘<em>snick</em>’ that even the sharpest fielder might miss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*WDTACf0pFTzvuM5_.jpg" /><figcaption>UltraEdge is being used to determine if the ball hit Smith’s bat in this LBW review.</figcaption></figure><p>The captured audio signals are then fed into a <strong>digital signal processing (DSP) </strong>system, which uses algorithms like <a href="https://course.ece.cmu.edu/~ece491/lectures/L25/STFT_Notes_ADSP.pdf"><strong>Short-Time Fourier Transform</strong></a> (STFT) to analyze the frequency content of the audio over time. The system identifies distinct spikes or changes in the audio waveform — a unique pattern indicating a potential edge. This processed audio waveform, the ‘<em>snickometer</em>’, is displayed alongside the synchronized video replay, allowing umpires to literally ‘<strong>see</strong>’ the sound.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FaPTQXIxKgVA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DaPTQXIxKgVA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FaPTQXIxKgVA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a43a5e19cb9528c7a1eeb154e4804fa6/href">https://medium.com/media/a43a5e19cb9528c7a1eeb154e4804fa6/href</a></iframe><p>Crucially, the audio signal is time-stamped and synchronized with video footage to sub-millisecond accuracy using <a href="https://support.3playmedia.com/hc/en-us/articles/227730848-SMPTE-Timecode-Explained"><strong>SMPTE timecode</strong></a>, allowing umpires to match the audio spike to the exact video frame of contact.</p><p>Yet, even with this precision, reconciling different technological inputs can be challenging, as seen in the recent <strong>India vs. Australia Test, </strong>where <strong>Yashasvi Jaiswal’s </strong>dismissal sparked controversy. Despite ‘<em>Snicko</em>’ suggesting <strong>no contact</strong>, the third umpire relied on a subtle video deflection, highlighting how subjective judgment can still influence DRS decisions and raise questions about consistency.</p><h3>Beyond the Checkered Flag</h3><p>In the high-speed world of Formula 1, where the timing of a safety car deployment, as seen in the crucial closing laps of the <a href="https://youtu.be/7QJ-N-AQJYc?si=OqWPTlqcow4engRu"><strong>2021 Abu Dhabi Grand Prix </strong></a>(a decision that still keeps Hamilton fans awake at night!), precise timing and tracking are paramount for fair competition.</p><p>The <strong>FIA Race Director System </strong>integrates a network of technologies to ensure every aspect of the race is monitored with unparalleled accuracy.</p><h4>Mapping the Margins</h4><p>Central to the FIA Race Director System’s enforcement of <a href="https://www.motorsport.com/f1/news/what-are-track-limits-f1-how-do-they-work/10554255/"><strong>track limits</strong></a> is the precise integration of GPS data with trackside sensors. Each F1 car is equipped with a <strong>high-precision GPS</strong> unit that, in conjunction with sensors embedded in the track’s <a href="https://www.gpfans.com/us/f1-news/1021752/kerb-riding-f1-explained/#:~:text=In%20F1%2C%20those%20brightly%20coloured,unfair%20advantage%20by%20cutting%20corners."><strong>kerbs</strong></a> and <a href="https://en.wikipedia.org/wiki/Run-off_area#:~:text=A%20run%2Doff%20area%20is,trap%2C%20AstroTurf%2C%20and%20tarmac."><strong>run-off areas</strong></a>, constantly relays the car’s position to race control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*BwjQkvYOGmFZs-ZY.jpg" /><figcaption>An F1 car at the edge of track limits.</figcaption></figure><p>This system allows for the real-time monitoring of a car’s adherence to track boundaries. When a driver exceeds these limits, even by<em> mere centimeters</em>, the system flags the incident.</p><p>This data helps determine if a driver gained an <em>unfair advantage</em>, potentially leading to lap time deletions in qualifying (leaving some Ferrari fans to hope <em>next year</em> will finally be their year!) or race penalties. At circuits like the <strong>Red Bull Ring</strong>, where track limit breaches are common due to corner design, this technology is crucial for consistent and fair rule application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*_rg0QXUQ72bjKG5_X6XToQ.png" /></figure><h4>Timing Loops and Safety Cars</h4><p>The <strong>FIA Race Director System’s timing loops</strong>, embedded in the track’s surface, play a crucial role in the implementation and management of <a href="https://www.motorsport.com/f1/news/f1-safety-car-how-does-it-work/10553952/"><strong>safety car</strong></a> and<strong> </strong><a href="https://www.motorsport.com/f1/news/f1-safety-car-how-does-it-work/10553952/"><strong>virtual safety car (VSC)</strong></a><strong> </strong>periods. These loops, synchronized with the GPS data, provide <em>extremely accurate</em> lap and sector times, allowing race control to precisely determine the gaps between cars.</p><p>When a safety car or VSC is deployed, the system uses this timing data to calculate the ‘<strong>delta time</strong>’ — the time a driver should be maintaining relative to the safety car or VSC leader (a crucial metric, especially if you’re <em>Lando Norris</em> and trying not to let a potential championship slip through your fingers!).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fr7JfBJzUN0U%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dr7JfBJzUN0U&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fr7JfBJzUN0U%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed236393d9fb91eb98883bb44faff48f/href">https://medium.com/media/ed236393d9fb91eb98883bb44faff48f/href</a></iframe><p>The precise timing of safety car procedures, however, as witnessed in the controversial final laps of the <a href="https://youtu.be/77RXPgDr-24?si=Wjwz-yQnbbNC_Q_h"><strong>2021 Abu Dhabi Grand Prix</strong></a>, highlights how the <em>interpretation</em> and <em>application</em> of the data derived from these technologies can lead to significant debate and accusations of inconsistency, ultimately impacting the very integrity of the race and the championship outcome.</p><p>The system’s real-time data also allows for quick and informed decisions regarding driver and marshal safety during these critical phases, ensuring the race can continue safely while maintaining its competitive spirit.</p><h3>The Final Whistle</h3><p>From the contentious “<strong>Hand of God</strong>” incident to the sophisticated algorithms powering <strong>VAR, DRS, and the FIA Race Director System</strong>, the pursuit of fair play in sports has undergone a significant technological evolution, leading to <em>greater accuracy </em>in officiating.</p><p>While debates surrounding marginal decisions and the interpretation of data persist, highlighting the ongoing need for refinement, the <em>future of sports officiating</em> is poised to become even more deeply intertwined with advancements in<strong> artificial intelligence </strong>and<strong> intricate tracking systems</strong>.</p><p>Despite this technological surge, the nuanced interpretation of rules and the inherent understanding of the <em>game’s spirit</em> by human officials will remain <em>indispensable</em>.</p><p>The optimal path forward involves a balanced and <strong>collaborative approach</strong>, leveraging the<strong> precision of technology</strong> to enhance accuracy while steadfastly <strong>preserving the drama, excitement, and fundamental essence</strong> that define the global world of sports. The evolution of fair play technology is an enduring journey, continuously shaping the competitive landscape we cherish.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=232bcd9a2fed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdg-vit/tech-on-the-field-the-real-mvp-232bcd9a2fed">Tech on the Field: The Real MVP</a> was originally published in <a href="https://medium.com/gdg-vit">GDG VIT Vellore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redefining Reality: An XR Guide]]></title>
            <link>https://medium.com/gdg-vit/redefining-reality-an-xr-guide-7f876c89c8ef?source=rss-7c639db4d0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f876c89c8ef</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[extended-reality]]></category>
            <category><![CDATA[xr]]></category>
            <category><![CDATA[augmented-reality]]></category>
            <dc:creator><![CDATA[Aditya Acharya]]></dc:creator>
            <pubDate>Sat, 24 Aug 2024 13:16:36 GMT</pubDate>
            <atom:updated>2024-08-24T13:16:36.713Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*04s50UDFM4jlBANt06pPHA.png" /></figure><blockquote>“Reality is the only thing that’s real.”</blockquote><p>These words echo through the world of <strong>Extended Reality (XR)</strong>, where you have the power to make your own “<em>Ready Player One</em>” adventure a reality! Extended Reality (XR) combines Virtual Reality (VR), Augmented Reality (AR), and Mixed Reality (MR) to blur the boundaries between the physical and digital worlds, where the only limit is your imagination.</p><p>But how do you get started creating your own XR experiences? This blog will guide you through building a basic XR project, perfect for beginners with limited coding experience.</p><h4>What’s Your XR Flavor?</h4><p>XR has a wide spectrum of development paths to dive into.<strong> Virtual Reality (VR) </strong>completely immerses you in a fully digital environment, <strong>Augmented Reality (AR) </strong>overlays digital elements onto the real world, and <strong>Mixed Reality (MR) </strong>blends real and virtual environments to create an interactive experience. We will focus on <strong>AR</strong>, as it is a fantastic starting point for beginners and requires less specialized equipment.</p><h4>The Aim</h4><p>We want to create a simple AR project that displays a 3D model on your phone’s screen when you point the camera at a specific target image. In this case, we will be displaying a 3D model of a dragon upon scanning our target image.</p><h4>Essential Ingredients</h4><p>To get started, we need a few essential tools that will help our vision come to life:</p><ul><li><strong>A Game Engine: </strong>Unity and Unreal Engine are two of the most popular options for XR development. We will use <strong>Unity </strong>for this tutorial, as it is a powerful game engine with a robust XR toolkit, known for being user-friendly and having extensive documentation. <a href="https://unity.com/download">You can head over to Unity’s website and download the latest version.</a></li><li><strong>3D Model</strong>: You can find both free and paid 3D models online on Unity’s asset store, or you can design your 3D model using software like Blender or Autodesk Maya. <a href="https://assetstore.unity.com/packages/3d/characters/creatures/dragon-for-boss-monster-hp-79398">Here’s the 3D Model Asset I used for reference.</a></li><li><strong>Image Target</strong>: This is a flat image that the AR app will recognize to trigger the appearance of the 3D model. <a href="https://3.bp.blogspot.com/-Xr8avJ7c9hI/XDtQEjMbZbI/AAAAAAAAG7Y/AEtOWFfbpocqPI5p_AxQdjEm_yLbYHgwACLcBGAs/s2560/hiccup-2560x2560-night-fury-toothless-how-to-train-your-dragon-3-how-17057.jpg">Here’s The Target Image I used for reference.</a></li></ul><h4>The Recipe</h4><ul><li><strong>Setting up Unity<br></strong>After installing Unity Hub from the above link, scroll down to the bottom, click on Download Archive, and install the latest editor. The editor will appear in your installations on Unity Hub, click on the settings icon and add modules. Install the Android Build Support, OpenJDK, Android SDK, and NDK tools. Next, create a New Project using the 3D core Render pipeline.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*Qhr9jc3fNywfA5X32n4q0A.png" /><figcaption>Modules required to be installed</figcaption></figure><ul><li><strong>Downloading Packages and Importing Assets</strong> <br>Once your newly created project is open, go to Window, click on Package Manager, and install <strong>AR Foundation</strong> and <strong>ARCore XR Plugin</strong>.<br>To import the assets we downloaded earlier, go to Package Manager again, find the downloaded assets, and click on Import.</li><li><strong>Setting up our Project<br></strong>Before we start building our project, we have to ensure the settings enable our project to run smoothly and be compatible with Android devices. Firstly, in the Files tab, click on Build Settings and switch the platform to Android. Following this, click on Player Settings, and in Other options, open the Other Settings section:<br>→Uncheck Auto Graphics API and Multithread Rendering<br>→Remove Vulkan API <br>→Set minimum API level to Android 7.0(API Level 24)<br>→Change Scripting Backend to IL2CPP<br>→Check ARM64 Box<br>Finally, click on XR Plugin Management and choose AR Core. Now with all the boring stuff out of the way, we move on to the fun part, actually building the project.</li><li><strong>Building the AR Scene </strong><br>Unity uses the concept of “<strong>prefabs</strong>” — preconfigured game objects which act as blueprints for game objects. Start by removing the Main Camera and adding the AR Session Origin and AR Session prefabs in the scene. In the AR Session Origin add the AR tracked Image Manager. This component will detect your image in the real world. <br>Create a reference Image Library in your assets under XR and add the imported image. Next add the image library to the serialized library section in the Image Manager in the Inspector Window.<br>Now we have to write a script to instantiate the prefab on tracking our target image. This part may need some basic prior coding experience, but I’ll be there to guide you along the way. To create a script, click on Add Component (in the inspector tab of AR Session Origin) followed by New Script and name it <em>prefabcreator</em>. Now open the file on Visual Studio (your editor).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*bToE-mJe46CeFOuNNbQaMw.png" /><figcaption>Adding a new script from the drop-down menu of the Add Component button.</figcaption></figure><p>We start by adding the package we’ll be using for our code.</p><pre>using UnityEngine.XR.ARFoundation;</pre><p>Next, we declare all our variables inside the class <em>prebafcreator</em>.<br>The <em>dragonPrefab </em>and <em>prefabOffset</em> variables are to work with the components in Unity once we export them. The <em>dragon </em>variable is used to store the instantiated dragon prefab and <em>arTrackedImageManager</em> to store the object for the same.</p><pre>[SerializeField] private GameObject dragonPrefab;<br>[SerializeField] private Vector3 prefabOffset;<br><br>private GameObject dragon;<br>private ARTrackedImageManager arTrackedImageManager;</pre><p>Following that, we create two functions that instantiate our prefab upon tracking our target image. Here the<em> OnEnable()</em> function initiates the Image Manager object and passes the tracked images into another function, <em>OnImageChanged()</em>. In this function, the first time one of the images passed matches our target image, our dragon prefab is instantiated into the scene.</p><pre>private void OnEnable()<br>  {<br>  arTrackedImageManager = gameObject.GetComponent&lt;ARTrackedImageManager&gt;();<br><br>  arTrackedImageManager.trackedImagesChanged += OnImageChanged;<br>  }<br><br>  private void OnImageChanged(ARTrackedImagesChangedEventArgs obj)<br>  {<br>  foreach(ARTrackedImage image in obj.added)<br>  {<br>   dragon = Instantiate(dragonPrefab, image.transform);<br>   dragon.transform.position += prefabOffset;<br>  }<br>  }</pre><ul><li><strong>Placing the 3D Model</strong><br>From the downloaded package choose a 3D model of your choice and drop it into the scene. Now we must position and scale our model carefully to ensure that it looks good on camera. Make the appropriate adjustments to your model (like changing the dimensions and position of the camera) in the inspector window. The 3D model package I have used above comes equipped with some handy animations you can use. I personally just used the take-off and fly-forward animations for my dragon prefab, however, you can get as creative as you want. To apply the animations, go to the Animator window and using the arrows and actions available make your desired animation come to life. You can click on the play button above in your scene window to see the animations in action. Make sure you go to Override in the inspector window of your prefab and click on Apply All before adding to your script. Finally, apply all the changes and add the prefab into your prefab creator script by simply dragging and dropping into the Dragon Prefab.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vmapMmuaQkwlNy-2fFVEtg.png" /><figcaption>My Unity scene with my dragon prefab.</figcaption></figure><ul><li><strong>Building the project on your Android device</strong><br>First, connect your Android Device to your Laptop or PC. Before we can export our project, we have to enable USB Debugging mode on our Android device. To do this, first, you have to open Settings and go to the About Phone Section. Here you have to click on the Build number seven to ten times to enable Developer Mode. Following this, go to the System section of your Settings, click on Developer Options, and enable USB Debugging. <br>After setting up your Android device go to the File section on Unity and click on Build Settings. Choose your connected device in the Run device section and finally click on Build and Run. This process may take some time but trust me, it’s worth the wait. As soon as the exporting process is done the application will open up on your mobile device.</li></ul><h4>The Final Product</h4><p>Voila!!! It is finally ready to run and use. Open the project on your Android device, scan the target image, and bring a dragon into the real world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*k5bjsyYDECYPt3jXHLHmLQ.png" /><figcaption>The dragon just vibing in my room.</figcaption></figure><h4>Taking it to the next level</h4><p>This was just a basic guide to making a simple AR project, now it’s up to you to elevate this project and make it into something spectacular.</p><p>Here are some suggestions for future developments:</p><ul><li><strong>Adding Audio<br></strong> Sound design can make your AR experience feel more authentic and immersive.</li><li><strong>Adding Shadows and Interaction with light<br></strong> To make your AR experience even more immersive, you can add proper shadows and correctly show your object’s behavior with different light sources. You want it to seem like a dragon has appeared in your bedroom.</li><li><strong>Adding different target images<br></strong> You can include different target images that would display unique 3D models. This can help diversify your AR experience.</li><li><strong>Adding a joystick</strong><br>You can add a joystick feature to move your dragon around and add more fun animations to make your AR experience more dynamic.</li></ul><h4><strong>Conclusion</strong></h4><p>At first, creating an XR project from scratch may have seemed like a daunting task, but as you have seen, with the right tools and some creativity, it is very achievable. There are loads of online resources to deepen your XR knowledge and take your projects to another level. You can start with Unity’s AR Foundation Documentation and also use any of the numerous YouTube tutorials available. The potential of XR in creating interactive experiences is massive, the only limit is your imagination.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f876c89c8ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdg-vit/redefining-reality-an-xr-guide-7f876c89c8ef">Redefining Reality: An XR Guide</a> was originally published in <a href="https://medium.com/gdg-vit">GDG VIT Vellore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>