Skip to content

Instantly share code, notes, and snippets.

View Lokathor's full-sized avatar
🌴
Workin' on Rust Stuff

Lokathor Lokathor

🌴
Workin' on Rust Stuff
View GitHub Profile

Why can’t you use std for game dev?

(I speak as a hobbyist who watches a lot of game dev talks and tinkers with stuff in his garage but who doesn’t work in the AAA space or anything like that)

The short answer is that you can use std for some game dev, but not all of it.

The long answer is that among the many ways to break down and categorize games there's one way to split things that I'll focus on for the moment. While attempting to be charitable to everyone involved, we'll call it "developing a game using an engine" vs "developing a game engine".

If you are developing a game using an engine then the non-rust version of that story is gonna be Unity (C#) or Game Maker (Pythonic scripting lang?) or RPG Maker (Ruby?) or things like that. The rust version of that story is things like Piston or GGEZ. Might be 2d, might be 3d, either way it probably doesn't push the hardware to its limits with complex physics and other background computation. There are plenty of amazing games developed this way, I'm

// Released to the Public Domain via The Unlicense.
//! Holds PRNG related types and operations.
//!
//! We're not using `rand`, because we don't need no instructions to know how to
//! rock.
//!
//! # PCG Stuff
//!
//! The PRNGs here are all generators from the [Permuted Congruential
//! A module for creating collections of mutable references from collection
//! objects. This allows you to edit more than one location within a collection
//! at the same time. This is totally safe to do as long as you don't re-shape
//! the collection while you do it (which the lifetimes ensure). It's basically
//! a generalization of the `split_at_mut` concept.
use std::cell::RefCell;
use std::collections::HashMap;
use std::collections::HashSet;
{-# LANGUAGE Safe #-}
-- this demo is placed into the public domain.
-- base
import Control.Monad (forever)
-- ansi-terminal
import System.Console.ANSI
main = do
@Lokathor
Lokathor / stm-ircbot-demo.hs
Last active April 30, 2017 08:45
A demo of a simple multi-threaded IRC bot in Haskell using stm and async.
{-# LANGUAGE NondecreasingIndentation, OverloadedStrings #-}
-- This demo program is placed into the Public Domain.
module Main where
-- imports are grouped by the package they come from
-- base
import Control.Monad (mapM_, forever)
@Lokathor
Lokathor / async-irc-bot-demo.rs
Last active April 25, 2018 03:23
A demo of an IRC bot that can asynchronously send and receive messages. No need for any fancy external crates or frameworks.
// This demo program is placed into the Public Domain.
use std::net::TcpStream;
use std::io::{Read, Write};
use std::string::String;
use std::thread;
use std::time::Duration;
/// We can expand on this later, but for now we just use an alias.
type IRCMessage = String;