
Hello friends!
Welcome to this week’s Sloth Bytes. I hope you had a silly week.

How Playrix increased developer productivity and code quality with AI-powered Code Reviews
Learn how Korbit AI enabled one of the world’s top gaming companies to accelerate engineering velocity and improve code quality.
The challenges that stem from using manual code review processes or the wrong AI tools
Why AI-powered code review is crucial for improving code quality, reducing reviewer fatigue and maintaining company standards.
How Korbit accelerates the SDLC process for hundreds of enterprises with instant, AI-powered code reviews and powerful insights into the codebase, projects and team.

🦥 How Games Remember Progress

Someone asked to do a game dev topic and I don’t have much game dev experience, so if I get something wrong, let me know!
If you’ve ever played any modern game, you’ve seen the words “saving…” or “auto save” somewhere.
But how the heck does that even work?
What exactly is it saving and when does it know to save?
I was very curious about that and did some research, and it’s a pretty cool concept.
I’ll be writing these examples in python to make it easier to read 😁
What do games save?
Games usually save the state needed to reconstruct meaningful progress, not every transient value currently flying around in memory:
# Usually not useful to persist every transient runtime detail
save_data = {
"player_x": 143.23842,
"player_velocity_x": 0.0023,
"current_animation_frame": 3,
"player_y": -0.4314324,
"time_since_last_blink": 1.34,
# ... hundreds more fields that may not matter after loading
}
# Better: persist the state required to reconstruct progress
save_data = {
"level": 5,
"health": 80,
"inventory": ["sword", "potion"],
"checkpoint": "castle_entrance",
}How do game save?
Games have a lot of different methods to saving:
Method 1: JSON (Text Files)
JSON is easy to implement and useful for many small games, tools, prototypes, and human-readable save/config formats. Larger games may use binary serialization, engine-specific formats, databases, or custom schemas instead.
It works great as a simple save system:
import json
def save_game():
data = {
"level": player.level,
"health": player.health,
"inventory": player.inventory
}
with open("save.json", "w") as f:
json.dump(data, f)
def load_game():
with open("save.json", "r") as f:
data = json.load(f)
player.level = data["level"]
# ... restore rest✅ Human-readable and easy to debug.
❌ Usually more verbose than compact binary formats and easy for players to edit if the save lives on their device.
Important: Encrypting a local save file can discourage casual editing, but it does not make cheating impossible—the game also needs the decryption key. If a value must be trusted for competitive/economic reasons, validate or store authoritative state on a server instead of trusting the client.
Method 2: Binary Files
Binary serialization can reduce parsing overhead and file size for some data models, but the exact savings depend entirely on the format, schema, compression, and data you are storing:
import struct
def save_binary():
with open("save.dat", "wb") as f:
f.write(struct.pack('i', player.level)) # 4 bytes
f.write(struct.pack('f', player.x)) # 4 bytes
f.write(struct.pack('i', len(inventory))) # 4 bytes
for item in inventory:
f.write(struct.pack('i', item.id))
def load_binary():
with open("save.dat", "rb") as f:
player.level = struct.unpack('i', f.read(4))[0]
player.x = struct.unpack('f', f.read(4))[0]
# ... etcThere is no universal “JSON = 200 bytes, binary = 20 bytes” ratio. Binary formats often avoid repeated field names and textual number representations, while compressed JSON can also become surprisingly small. Measure your actual save data before optimizing it.
✅ Can be compact and fast to parse with a well-designed format
❌ Harder to inspect manually and requires careful versioning/schema migration as the game changes
Method 3: Databases
A database can make sense when save data is relational, queryable, shared across many entities, or managed server-side—especially for online games:
import sqlite3
conn = sqlite3.connect('save.db')
c = conn.cursor()
# Save
c.execute("INSERT INTO player VALUES (?, ?, ?)",
(player.level, player.health, player.x))
c.execute("INSERT INTO inventory VALUES (?, ?)",
(item_id, quantity))
conn.commit()✅ Useful for structured relationships, queries, transactions, multiple profiles/entities, and server-authoritative state
❌ More schema/operational complexity than a simple local save file
Platform-Specific
Game engines and distribution platforms provide APIs that can help with persistence, but they solve different pieces of the problem. A settings API is not automatically a full save-game architecture, and cloud sync is not the same thing as serialization.
Unity PlayerPrefs: useful for small preference values such as volume/settings; Unity’s documentation explicitly positions it as simple key-value storage, not a secure general-purpose save format.
Godot: provides file/resource/config APIs you can use to build a save system;
ConfigFileis one option for configuration-like key/value data.Unreal Engine: provides
SaveGame-based APIs for serializing game state into save slots.Steam Cloud: can synchronize files your game already creates across devices. It helps distribute saves; it does not decide what your save format contains.
Fun history note: battery-backed cartridge saves became famous in the 1980s with games such as The Legend of Zelda, while many other games of that era used passwords or codes to represent progress. Save systems evolved differently across platforms rather than flipping from “passwords” to “battery saves” all at once.
Imagine entering a 50-character password to restore your Skyrim character.
If you want to keep learning
Game development for beginners — learn the game loops, engines, scenes, and systems that save files have to plug into.
How cloud file storage works — understand uploads, metadata, replication, and the infrastructure behind cloud saves.
5 free system design resources — go deeper on storage, databases, caching, and scalable application architecture.


Thanks for the feedback! I’ll try to do a easy + hard challenge.



Wow a lot of submissions this week. I guess it was too easy…
Thanks to everyone who submitted!
andregarcia0412, joshymerki, Tajgero, GabrielDornelas, FouadNara, xanerin, graff012, Better-Canada, Cariburi, JamesHarryT, GaLinux, AspenTheRoyal, Fireboy086, mau-estradiote, spenpal, dganesh05, xarop-pa-toss, Franspi-lol, RelyingEarth87, Moizg, and cuisse!
Spiral Matrix
Given a matrix of m * n elements (m rows, n columns), return all elements of the matrix in spiral order.
Examples
spiralOrder([
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
])
output = [1, 2, 3, 6, 9, 8, 7, 4, 5]
spiralOrder([
[1, 2, 3, 4],
[5, 6, 7, 8],
[9,10,11,12]
])
output = [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]How To Submit Answers
Reply with
A link to your solution (github, twitter, personal blog, portfolio, replit, etc)
or if you’re on the web version leave a comment!
If you want to be mentioned here, I’d prefer if you sent a GitHub link or Replit!

New video about useful GitHub Repos!
That’s all from me!
Have a great week, be safe, make good choices, and have fun coding.
If I made a mistake or you have any questions, feel free to comment below or reply to the email!
See you all next week.
What'd you think of today's email?
Want to advertise in Sloth Bytes?
If your company is interested in reaching an audience of developers and programming enthusiasts, you may want to advertise with us here.







