<?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 Chris McEvoy on Medium]]></title>
        <description><![CDATA[Stories by Chris McEvoy on Medium]]></description>
        <link>https://medium.com/@cmcevoy?source=rss-954e7ff4036b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*24v76AImy1Kr5clPOWE7Vg.png</url>
            <title>Stories by Chris McEvoy on Medium</title>
            <link>https://medium.com/@cmcevoy?source=rss-954e7ff4036b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:54:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cmcevoy/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[Introducing the Viper Editor]]></title>
            <link>https://medium.com/velan-studios/introducing-the-viper-editor-a630360a4a5a?source=rss-954e7ff4036b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a630360a4a5a</guid>
            <dc:creator><![CDATA[Chris McEvoy]]></dc:creator>
            <pubDate>Thu, 25 Aug 2022 12:27:53 GMT</pubDate>
            <atom:updated>2022-08-25T12:27:53.808Z</atom:updated>
            <content:encoded><![CDATA[<p>As previously discussed in our <a href="https://medium.com/velan-studios/introducing-viper-273d41b8c507">Introducing Viper</a>, our game engine is built entirely in-house, primarily in the C language. Our editor, in which we assemble and author all the data used by our games, is built on the very same Viper engine. This has given us a lot of flexibility to make unique tools, iterate rapidly, and unlock new possibilities for our games.</p><h3>Project Setup</h3><p>The very first thing is for folks to get set up to work on a Velan project. We have them install a small Launcher application that takes care of things like setting up source control, downloading necessary files, and configuring settings for the specific project that they will be working on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E7MD5OIYohzOW0z9YKLjUQ.png" /><figcaption>Viper’s Launcher application</figcaption></figure><p>Something that we do a little differently here at Velan is that we have everyone, even non-engineers, download and build code and data for their game project locally. This makes it easier to debug issues directly on an individual’s machine if they run into a problem and we can deploy hot fixes and updates very quickly.</p><p>The general workflow cycle for users is to have the Launcher download, update, and build their project. After that they can use the Launcher to run the Editor and/or the Game and changes made to game data via the Editor or an external application are automatically processed and updated on the fly without having to restart the Game for quick iteration.</p><p>The Launcher, Editor, and Game all run using the same underlying Viper engine and data, just with different command line arguments. The majority of our code is written in C, but we also rely on some C++ libraries that we need make C wrappers for.</p><h3>Overview of the Editor</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-TnFIBNyqZUDfEKW95Xvvg.png" /><figcaption>Editing a level in Viper Editor</figcaption></figure><p>One of the chief tasks our users perform in the Viper Editor is the creation of <em>levels</em>. Levels are quite simply a collection of <em>entities</em>, each of which can have a number of <em>components</em> authored in our custom scripting language, VScript. Importantly, levels can contain other levels, which allows us to organize our data and reuse units of content. A level that is nested in another level is colloquially referred to as a <em>prefab</em>. A prefab level is technically the same as any other level, but it’s helpful to have a word to describe a level that is intended to be “stamped out” multiple times.</p><p>Above is an image of the editor while a particular .level file is being edited. The central panel is a 3D viewport that displays all entities in the level (for those that have a <em>model component</em>), as well as various useful visualizations such as wireframes. Panels on the left and right allow browsing entities in the level, and manipulating component data. The bottom panel is the Asset Browser, which allows the user to easily search for and access all of the content in our repository. This layout is largely customizable by the user.</p><p>The editor viewport also includes many graphics-related visualizations to help artists address issues and push the maximum visual quality for our games.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O4I3yga1OZoz_ecHlT_Kbw.png" /><figcaption>Ambient Occlusion visualization in the editor</figcaption></figure><p>We also use visualizations to help analyze content; for example, a skeleton visualization can help make sure that a rig is functioning as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D050GsVyJD06oFOvgkrrUA.png" /></figure><h3>Framework</h3><p>As we discussed before, our engine decouples the functionality of <em>input, simulation, </em>and<em> output</em>, each being a separate system. The editor shares much of this functionality with our games, but performs a lot of unique work at the <em>simulation</em> phase — primarily, this is where we draw the user interface of the editor.</p><p>We use the <a href="https://github.com/ocornut/imgui">Dear ImGui</a> library for our user interface (the same library we use for our in-game debug UI). ImGui has gained a lot of popularity with game developers in recent years, and it’s easy to see why! It’s straightforward for programmers to use and iterate with, offers good performance, and it’s able to work with a variety of backends and platforms. On Windows (which we use for development), our integration of ImGui uses SDL2 as a native window platform, and Vulkan as a rendering backend.</p><p>Our codebase largely embraces the “immediate mode” design pattern, which ImGui is also based on, making it a natural fit.</p><h3>Importing and Authoring Data</h3><p>Data for our games is often created in 3rd party software; for example, an artist might create a texture set in Substance Designer, or model a prop in Maya. The result might be an intermediate format such as .png files (for textures) or .fbx files (for models). When content is exported from a 3rd party application, as long as it’s in a known format, the Viper Editor will be able to import that content into a wrapper format that is usable directly by the engine. The import process occurs automatically when the asset is opened or used in the editor, so we can avoid consuming CPU resources until it’s needed. Once it’s converted to an internal format, that data can be used in the editor.</p><p>To access and organize content, we use the Asset Browser. This panel allows users to view the entire project’s folder structure, search for files by name, browse content with the help of thumbnails, and perform common file operations like renaming or moving.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3-HhKSOgZByMZvM7tJPGYQ.png" /><figcaption>The Asset Browser</figcaption></figure><h3>Type Specific Editors</h3><p>Apart from levels, there are many types of data a user might wish to author — for example, <em>models, materials, and textures.</em> Each data type displays a different interface that is largely generic, however Viper makes it easy to write custom UI code to make editing a specific data type a better experience. For example, here’s an imported texture file, for which we wrote custom ImGui code to display all the mip levels:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rVdLcs-QxKfdh-FIhdUWSg.png" /><figcaption>Editing a texture</figcaption></figure><p>Some data types aren’t imported from external tools, but rather are created internally to help assemble other content. For example, a spreadsheet type that can collect related animation assets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JEd-VomqDf7P8BM1Pje3cA.png" /><figcaption>Editing an animation spreadsheet</figcaption></figure><p>Another unique example is a <em>timeline</em> — this allows for making various data properties change over time through the placement of keyframes, and also has a unique interface with buttons to preview the progression of the timeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OKwERr5tpli2-YXsBXL6qA.png" /><figcaption>A timeline being used to animate UI</figcaption></figure><p>One of the most advanced and fully-featured editors is for the Shader Graph data type. This presents a node-based system to the user that allows them to author a shader using an artist-friendly visual language:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXyvMXgelb1IKs9rof6rLQ.png" /><figcaption>Shader Graph editor</figcaption></figure><h3>Data Overrides</h3><p>One unique challenge we face is creating data for a live service game like Knockout City, which has in-game events during particular calendar times. These events significantly change the overall look and feel of a level.</p><p>In order to make this possible, all data in Viper supports the concept of a <em>layer override.</em> “Layers” correspond to seasonal in-game events. To take a small example, let’s say I’ve made a light source that is a neutral white by default, but I want to make it pink when a certain game event is active. To do so, I simply click the color property of the light source and choose “Add Override,” specifying the new color and the event it corresponds to, like so. Below, I did this for my light source as well as the directional “sun” light for dramatic effect:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4RysWeqAZLeOLXBjJnmwMQ.png" /><figcaption>A white light source as it would be seen when no special events are active</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8GR4veJn01TjrmyPQRiP3w.png" /><figcaption>The same light source with a layer override applied</figcaption></figure><p>In the second image, I told the editor to show me what everything looks like during the special event I selected, so I can easily see my work while iterating. As you can imagine, there are many possibilities with this approach; we can use it to determine whether or not entities are spawned during an event, and we also using it to select optimized content for the many platforms we ship our games on.</p><p>Additionally, we have a similar concept known as <em>prefab overrides</em>. Prefabs are great because they allow creating composite content that can then be reused in multiple locations, and changing the prefab immediately updates all instances. However, sometimes you need an instance to be just a little different. Instead of having to create a brand new prefab, you can use a prefab override. In practice, this works very similarly to layer overrides.</p><h3>Automated Testing</h3><p>It’s important that we keep our tools working correctly and don’t introduce breaking changes that will impact our users. We have some automated tests to verify various functionality throughout our tools to try and prevent this from happening. For example, an automated test might open a file in the editor and perform operations like renaming an entity, and finally take a screenshot of the editor to make sure everything looks the way we’d expect. Another test might render some models with different materials and use a screenshot comparison to make sure that nothing has unexpectedly changed. It’s not possible to make a test that catches every possible failure case, but they’re still a very useful filter for catching issues before they can impact the rest of the team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZwBubZcFKU4XwVj1-F-oLw.gif" /><figcaption>Example of an automated materials test</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a630360a4a5a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/velan-studios/introducing-the-viper-editor-a630360a4a5a">Introducing the Viper Editor</a> was originally published in <a href="https://medium.com/velan-studios">Velan Studios</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Viper]]></title>
            <link>https://medium.com/velan-studios/introducing-viper-273d41b8c507?source=rss-954e7ff4036b------2</link>
            <guid isPermaLink="false">https://medium.com/p/273d41b8c507</guid>
            <dc:creator><![CDATA[Chris McEvoy]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 11:07:34 GMT</pubDate>
            <atom:updated>2022-08-11T13:52:54.144Z</atom:updated>
            <content:encoded><![CDATA[<p>At Velan Studios, we build and maintain our own engine and toolchain called Viper. Viper is the engine behind Knockout City and Mario Kart Live: Home Circuit. It includes standard things you might expect from any game engine such as a level editor, renderer, scripting language, etc. It also has less obvious components like network backend services and even a continuous integration system so Viper can build and test itself.</p><p>In this blog post we’re going to take a whirlwind tour / random walk of some key Viper ideas. But before we jump into that, let’s start with why we decided to build Viper at all.</p><h3>Motivation</h3><p>Early in Velan’s existence we had prototypes for our first two games: Knockout City and Mario Kart Live. True to our mission, each of these games was rather unconventional. Knockout City because it was online competitive dodgeball and Mario Kart Live because it was an RC Car with a webcam strapped atop. Unconventional games bring unique technical challenges, and it became clear to us that the best way we could address those challenges was our own engine.</p><p>We believe owning the underlying technology is critical to a game’s success. On Knockout City that meant we needed to own the code behind throwing and catching fast moving physics objects over the internet as well as network services around matchmaking. On Mario Kart Live that meant owning the technology for low latency computer vision and SLAM (the video pipeline).</p><p>But more than that, philosophically we believe in:</p><ul><li>Removing barriers. As a small-ish team, we should be efficient generalists. We try really hard to make it so that a programmer familiar in one area of our code can be effective in other areas without having to learn some new third party library or language.</li><li>Using different tools to get different results. Our games are shaped by the tools we use to make them. If we want to make games that no one else is making, it helps to use technology that no one else is using.</li></ul><h3>One Big Pile of Code (and Data)</h3><p>Viper, and all the projects that use it, exist in a single Perforce depot. Most developers work directly on the main branch. We have a continuous integration system that builds and tests Viper on each of its 10 supported target platforms whenever a change is introduced.</p><p>By keeping all our code in one place, we avoid release management complexity and make it easier to contemplate sweeping changes to the way Viper works. Fortunately, our games (so far) are small enough that it is practical to sync and build everything together.</p><p>Viper is written primarily in two languages (in roughly equal proportion):</p><ul><li>C for engine, tools, and network services.</li><li>Proprietary scripting language (vscript) for game specific logic.</li></ul><p>We’ll discuss these next.</p><h3>C in Viper</h3><p>When we started working on Viper (5+ years ago), we knew we wanted to use a mature systems language with nearly ubiquitous availability. This led us to seriously consider C++ and C. Ultimately we chose C, specifically C99, as our primary language. We did this for several reasons:</p><ul><li>We wanted to keep the number of language-level concepts to a minimum. For example, C++ classes are an interesting organizational concept, but one that does not really map to the underlying hardware in a meaningful way. In other words, they become a potential source of artificial complexity. To be clear, C is not free of these types of concepts, but it certainly has less than C++.</li><li>We wanted there to be a reasonable correlation between the code on screen and the work that the CPU was doing. Translating C code into (pseudo-)assembly can often be done by inspection. C++ concepts like operator overloading and destructors can hide complexity to make it hard to see what’s happening at a glance.</li><li>C++ is a large language with sometimes uneven support across different implementations. For this reason, it is hard to rely on certain language features (historically that meant things like exception handling and RTTI). C++ and its libraries also frequently allocate memory, a resource that we like to keep under close control. For these reasons, using C++ to develop a game can be an exercise maintaining a list of what C++ features to avoid. We have not had this experience with C.</li><li>We wanted fast compile and link times. Iteration time is quite important in game development. C link times are usually much better than C++, especially in the presence of templates.</li></ul><p>Over 5 years into our experiment in C, I occasionally miss having a destructor run when a variable goes out of scope, or operator overloading so I can more naturally add to vec3s. But overall the experience of staying in C has been pleasant, even freeing. C++ brings along patterns and dogma around the “right way” to do things. It is nice to think about how I want to solve technical problems on their merits without feeling guilty that I am not following some OO principle or expressing my solution in the most “elegant” way possible.</p><p>That’s not to say C++ is bad. It’s a very complex tool that, to use well, requires care. It may also require more braincells than the author typically has available.</p><h3>Script in Viper</h3><p>Early in the development of Knockout City, we decided that we wanted what we call the “simulation” stage of the game to have the following properties:</p><ul><li>Ability to rewind state to past frames</li><li>Deterministic computation</li><li>State easily replicated over the network</li><li>Support for wide parallelism</li></ul><p>The simulation phase owns all game objects and their behaviors. A designer or programmer working on gameplay will be writing the logic to drive game objects. We knew that creating interesting game mechanics was going to be hard enough without having to also think about rewind, determinism, replication, and parallelism (RDRP). To ease the cognitive load, we decided to create a scripting language. Any game object behavior implemented in script gets RDRP “for free.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*bqs-NOKZqiZkPHqZfhn5Ug.png" /></figure><p>As development progressed, we implemented more and more things in script. At this point anything a player sees in our games is implemented in part, in script. This has some interesting benefits.</p><ul><li>Script can be modified while the game is running. Coupled with an ability to pause and rewind the simulation, this is a powerful debugging tool.</li><li>For speed, script can be compiled to C and then linked into a game executable, but script can also be interpreted by our virtual machine. Using the latter, we can make hotfixes to game logic and deploy those fixes into a live game client without having to push a full game patch. If you’ve ever seen the “Updating and Restarting” screen when logging into Knockout City, that’s an example of this hot fix in action. This ability has saved our bacon numerous times on Knockout City.</li></ul><h3>Input, Simulation, and Output</h3><p>In the last section I mentioned the game simulation stage. In a normal game client, we have 3 stages:</p><ul><li>Input stage. Owns window message loop. Reads controller, mouse, keyboard.</li><li>Simulation stage. Consumes data from input stage and from the network. Runs game logic and physics. Able to rewind state and is largely deterministic.</li><li>Output stage. Consumes data from simulation stage. Renders graphics and audio.</li></ul><p>Each stage has an owning thread allowing it to update at a rate largely independent of the other stages. On Knockout City, we vary the simulation rate slightly in response to changing network conditions. But the output stage continues to render at device rate (typically 60Hz) by interpolating simulation data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XgUJZxMFeAVy9ayt7ylr7g.png" /></figure><p>While each stage has an owning thread, 3 threads is not enough parallelism. For that reason, we use a job system to run nearly all compute bound work in Viper. In a typical frame, we will run over 1000 jobs.</p><h3>Apps</h3><p>Our games are typically composed of several distributed cooperating executables or processes. On Knockout City, that includes the game clients, game server, and network services. On Mario Kart Live, that includes the game client on the console and the firmware running on the vehicle.</p><p>During development it can be a hassle to setup and debug in a multi-process environment. This is one of the reasons that Viper introduces the concept of an “app.” An app is an encapsulation of all the elements in a process, but in such a way that we can have multiple apps running side-by-side in a single development process.</p><p>Every Viper thread has an owning app which can be accessed via a thread-local variable. Once the current app is obtained, other engine services can be queried from the app.</p><p>For example, developers working on Knockout City typically run the game with three primary apps in a single Win32 process: network service app (we call this the backend), the game client app, and the game server app. Each of these apps communicates over network sockets, as they would in production. But by running them all in the same process, we get a few benefits:</p><ul><li>Standing up a local development environment is a simple as pressing F5 in Visual Studio.</li><li>Because we are running a single process, it’s easy to debug both sides of a network channel. Just place breakpoints at the sender and receiver.</li></ul><h3>Managing Game Assets</h3><p>Viper uses a few different systems that form the basis of its approach to game assets.</p><ul><li><strong>RTTI</strong>. Viper has a runtime type information system that scrapes specially annotated types in engine header files. This allows the runtime to understand the layout and naming of all serializable data.</li><li><strong>Marshal</strong>. Viper marshalling system is responsible for reading and writing any objects that have associated RTTI. We support JSON and binary file formats.</li><li><strong>Import</strong>. Data produced outside of Viper (for example a texture saved to a TGA file) can only be used by Viper once it is data with RTTI. Viper’s file importers convert external files into Viper objects and then use the marshalling system to write those objects to disk.</li><li><strong>Datad</strong>. Datad is the name of a Viper app (see the previous section) that acts like a file server for Viper data. Other apps connect to datad over network socket and request files. Datad’s job is to return the contents of files to the client. If the client is requesting an imported file, and the import is out-of-date (e.g. the source file is newer), datad will invoke the appropriate importer to bring the file up-to-date before returning its contents. In this way, Viper supports build-on-demand and hot-reload of data for all clients.</li></ul><h3>To the Future and Beyond</h3><p>This concludes our random walk of Viper concepts. In future blog posts, we will delve into some of the many areas of Viper not covered here. Until then.</p><p><em>“It prowls the streets in the pursuit of justice. Its origins are secret, its technology 21st century, its existence officially disavowed, but its presence undeniable. The perfect weapon for an imperfect future — Viper!”</em></p><p>- “Winner Take All.” <em>Viper</em>, Created by Danny Bilson and Paul De Meo, season 2, episode 1, Pet Fly Productions, 1996.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=273d41b8c507" width="1" height="1" alt=""><hr><p><a href="https://medium.com/velan-studios/introducing-viper-273d41b8c507">Introducing Viper</a> was originally published in <a href="https://medium.com/velan-studios">Velan Studios</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>