Author: Nic Raboy
Implement the Konami Keystroke Cheat Code in a Unity Game
Remember all the cheat codes you could use in old-school games back in the day? Remember the Konami cheat code? Ever wonder how you could add cheat codes to your own games?
Adding cheat codes to your game is a great way to leave your imprint. Think easter eggs, but even more secretive.
In this tutorial we're going to see how to add keystroke driven cheat codes to a game built with Unity and C#. While the Konami cheat code will be the basis of this example, a lot of the logic and ideas can be applied to other aspects of your game.
Read MoreBuilding a Space Shooter Game that Syncs with Unity and MongoDB Realm
When developing a game, in most circumstances you're going to need to store some kind of data. It could be the score, it could be player inventory, it could be where they are located on a map. The possibilities are endless and it's more heavily dependent on the type of game.
Need to sync that data between devices and your remote infrastructure? That is a whole different scenario.
If you managed to catch MongoDB .Live 2021, you'll be familiar that the first stable release of the MongoDB Realm SDK for Unity was made available. This means that you can use Realm in your Unity game to store and sync data with only a few lines of code.
In this tutorial, we're going to build a nifty game that explores some storage and syncing use-cases.
Read MoreInfluence Search Result Ranking with Function Scores in Atlas Search
When it comes to natural language searching, it's useful to know how the order of the results for a query were determined. Exact matches might be obvious, but what about situations where not all the results were exact matches due to a fuzzy parameter, the $near operator, or something else?
This is where the document score becomes relevant.
Every document returned by a $search query in MongoDB Atlas Search is assigned a score based on relevance, and the documents included in a result set are returned in order from highest score to lowest.
You can choose to rely on the scoring that Atlas Search determines based on the query operators, or you can customize its behavior using function scoring and optimize it towards your needs. In this tutorial, we're going to see how the function option in Atlas Search can be used to rank results in an example.
An Introduction to Indexes for MongoDB Atlas Search
Imagine reading a long book like "A Song of Fire and Ice," "The Lord of the Rings," or "Harry Potter." Now imagine that there was a specific detail in one of those books that you needed to revisit. You wouldn't want to search every page in those long books to find what you were looking for. Instead, you'd want to use some sort of book index to help you quickly locate what you were looking for. This same concept of indexing content within a book can be carried to MongoDB Atlas Search with search indexes.
Atlas Search makes it easy to build fast, relevant, full-text search on top of your data in the cloud. It's fully integrated, fully managed, and available with every MongoDB Atlas cluster running MongoDB version 4.2 or higher.
Correctly defining your indexes is important because they are responsible for making sure that you're receiving relevant results when using Atlas Search. There is no one-size-fits-all solution and different indexes will bring you different benefits.
In this tutorial, we're going to get a gentle introduction to creating indexes that will be valuable for various full-text search use cases.
Read MoreSearching on Your Location with Atlas Search and Geospatial Operators
When thinking about full-text search, text and other string data is probably the first thing to come to mind. In fact, if you've been keeping up with my tutorials, you might remember Building an Autocomplete Form Element with Atlas Search and JavaScript or Visually Showing Atlas Search Highlights with JavaScript and HTML, both of which were on text search examples in MongoDB Atlas Search.
Being able to use natural language search on text data is probably one of the most popular use-cases, but there are scenarios where you might need to narrow the results even further.
Let's say you're building a restaurant review application like Yelp or a bed and breakfast booking system like Airbnb. Sure, you'll enter some kind of text criteria for what you're looking for, but there's also a location aspect to it. For example, if you want to find a place to get a cheeseburger within walking distance of your current location, you probably don't want your search results to contain entries from another country. This is an example of a geo search, where you would want to return results based on location coordinates.
In this tutorial, we're going to see how to use Atlas Search and the compound operator to search based on text entered and within a certain geographical area. For the text entered, we'll use the autocomplete operator, and for the geospatial component, we'll use the geoWithin operator.
Read MoreGetting Started with the Realm SDK for Unity
Did you know that MongoDB has a Realm SDK for the Unity game development framework that makes working with game data effortless? The Realm SDK is currently an alpha release, but you can already start using it to build persistence into your cross platform gaming projects.
A few weeks ago I streamed about and wrote about creating an infinite runner type game using Unity and the Realm SDK for Unity. Realm was used for storing the score between scenes and sessions within the game.
There were a lot of deep topics in the infinite runner (think Temple Run or Subway Surfer) example, so I wanted to take a step back. In this tutorial, we're going to spend less time making an interesting game and more time including and using Realm within a Unity project.
Read MoreBuild an Infinite Runner Game with Unity and the Realm Unity SDK
Did you know that MongoDB has a Realm SDK for the Unity game development framework that makes working with game data effortless? It's currently an alpha release, but you can already start using it to build persistence into your cross platform gaming projects.
A popular game template for the past few years has been in infinite runner style games. Games such as Temple Run and Subway Surfers have had many competitors, each with their own spin on the subject. If you're unfamiliar with the infinite runner concept, the idea is that you have a player that can move horizontally to fixed positions. As the game progresses, obstacles and rewards enter the scene. The player must dodge or obtain depending on the object and this happens until the player collides with an obstacle. As time progresses, the game generally speeds up to make things more difficult.
While the game might sound complicated, there's actually a lot of repetition.
In this tutorial, we'll look at how to create our own infinite runner game with Unity and C#. We'll look at important concepts such as object pooling and collision, as well as data persistence using the Realm SDK for Unity.
Read More