Skip to main content


Recent Posts

Programming / Re: So I wrote a monad tutorial...
Last post by Fat Cerberus -
Well, I mean, I do expect people reading a monad tutorial to have existing programming background, that goes without saying.  I will say that I think imperative programmers are better equipped to understand them than functional programmers actually, since we're the ones writing all the boilerplate in the first place.  Think of your Link.js library and the problem it solves :)

Programmer-to-programmer: the thing is, the monad concept itself is not actually complicated, people just make it seem that way - sure, individual monad types are complex (promises, e.g.), but the monad interface is ridiculously simple:

Code: [Select]
// entangle/unit/pure/return
let arr = Array.of(1, 2, 3);
let m = new Maybe("foo");
let prom = Promise.resolve(812);

// map
arr = => x * 2);  // we know what this does
m = => s + "bar");  // maybe it has a value, maybe not - it's a no-op if not
prom = prom.then(value => newValue);  // just map to new value, no async shenanigans

// flatmap/chain/bind/thru
prom.then(result => new Promise(...));  // promise chaining
m.thru(value => new Maybe(result)); /* alternatively, Maybe.Empty */);  // maybe it can fail
arr.flatMap(elem => Array.of(...));  // one-to-many mapping

That's it.  If you implement that interface and satisfy the identity laws, it's a monad.  Literally.  That's all that's required.  It doesn't matter what kind of abstraction it's an interface *to* (promises, arrays, maybes, eaty pigs...), you just need to implement the interface.  The main thing is that the pattern this interface represents already exists in "nature"--you have to train yourself to recognize it though, and that's the actual hard part.
Programming / Re: So I wrote a monad tutorial...
Last post by Radnen -
I'm only loosely aware of monads and in theory know what they are. Like I knew that a JS Promise is a monad-like structure, but not exactly as to why.

I'd say I understand Monads a bit better from an imperative context, but I also think your tutorial isn't necessarily the easiest to understand. I think if one has a lot of programming experience, one can follow along, but at the very end of the day monads are complex, and must take a complex chain of thought to understand. And, if anything, actually making a monad and playing around with them interactively is the best way to learn.

But as for me, I will definitely say I came out learning a lot more about them. So, I do think it's effective for more seasoned programmers, Does it break the curse? I dunno, but I'm sure you'll find out someday!
Programming / Re: So I wrote a monad tutorial...
Last post by mezzoEmrys -
I ended up learning about monads by writing them as a useful design pattern, then being told that's what they were. Amusingly enough, I picked up that pattern from writing a lot of Common Lisp. I also tended to explain it to people using the Maybe example, and the Error Wrapper example (Either in your guide), so it's nice to see that played out with all the basic explanations in place too.

The only thing I might recommend doing is bolding "entangle" the first time you use it in the paper, and/or bold "entagled values" when that occurs slightly later. I tend to skim a bit when text starts getting really thick, so having key ideas like that bolded helps readability for people like me.
Programming / So I wrote a monad tutorial...
Last post by Fat Cerberus -
I recently learned what monads are, and predictably, had just as much trouble "getting it" as everyone else.  But they're not actually cursed; it's an extremely simple concept, it's just that everyone either 1) Tries to explain the mathematical background, which is not necessary (You don't need to know anything about set theory to add two numbers!), 2) Uses a bunch of Haskell code which is gibberish to imperative/OOP programmers, or 3) Starts with a box metaphor, which is just in medias res non-sequitur: you have to explain why the boxes are there first!

Long story short, I'm pretty sure I can break the curse.  Here's my monad tutorial:
Libraries / SphereIRC
Last post by Eggbertx -
I'm working on a module for an IRC client class called SphereIRC, and I may eventually start working on a server class as well.

Back in the day I wrote a very simplistic IRC bot for Sphere 1.5. Since Sphere 1.x is long dead and miniSphere has been here for a long time now, I figured I should probably resurrect it (SphereBot, not Sphere 1.x), but early on, I decided to work it into a general purpose IRC module to be integrated into your online game projects instead of a standalone bot.

This is looking really sweet and I"m very happy to see how far Sphere has come with it's new JS and graphics engines. Keep it up! I might even get back into game dev with Sphere again. My girlfriend wants to work on a game with me, haha.
An update before I go to bed tonight
Official version is 0.4.3!

RGB lighting and pointClouds are implemented, next week I hope to have the time an motivation to work on implementing multiple light sources as well as rewrite modelObject to support pointCloud injection and to rewrite how voxelWorlds are rendered. Here are some screenshots. As usual they're hosted from my personal server.

I've noted that lighting doesn't behave entirely correctly so I hope to fix that as well

So, here's an Update after over a year of dead silence. This post isn't going to be focused so much on the game itself but rather the biggest system that I'll be using in this game, it's name is Candle.

Status of the game so far

Candle has made a LOT of progress in terms of functionality since I originally started this thread, It's gone from being a simple vector-based rendering system that could barely render a cube to being able to render 10's of hundreds of TEXTURED polygons at a time. That said, it is still mostly a WIP system that still lacks a lot of features I want (This includes a particle system but that's a pipe dream for now) I think I'm beginning to reach a point where it may be worth writing some documentation for anyone wanting to use it.

As I type this, the current version of Candle is 0.4.1

Here are the systems implemented so far:
  • Out-of-bounds (OOB) culling
  • Backface culling
  • Rabbit-hole based 3d-point aggregation (I think that's the right word)
  • Simple lighting (A single lightsource, rightly named 'sun')
  • Voxel world-type (Basically a scene that only supports voxel geometry)

and this is the current to-do list, priority items for version 0.5 are marked with a #
  • Implementation of a more traditional world-type (aka a scene)
    • This is needed for graphical effects I want to implement, such as particle systems
  • # Distance-sorting for polygons
    • Needed to properly render polygons in the correct order
  • #Rework the system for point aggregation into a separate system, formally known as a pointcloud
    • This is needed to improve the efficiency of voxel rendering, currently points are being calculated many times over when they could just be calculated in one go.
  • #Implement support for multiple light sources of different colors
    • Pretty lights are a must
  • Implement a vector motion system
    • The idea is that by defining a motion vector a model or it's one of it's vertices can be made to move, this is also useful for implementing particle and tesselation systems
Game Development / Re: The Screenshot Thread
Last post by SilicateWielder -
So I picked up my graphics engine again

I've been posting too many screenshots in the discord (Sorry for the spam!), and thought I should share an update regarding the latest version here

Because it's most relevant to what I plan to use this for, I've written a voxel world-type, these can be created dynamically and can also be loaded in parallel provided you have a system in place for selecting which world you want to display. They are inefficient at the moment though due to the inability for models to share a single pointcloud, I plan to fix this for version 0.5

I'm aiming to push a commit to github tomorrow if not tonight, and likely wont be updating this again for about a week or two since that seems to be the frequency at which I get time to work on this

Anyway, screenshot time, because of the forum's image size limit the images are hosted from my personal server.
The terrain is randomly generated using a fractal-based terrain generator that I wrote

This last one uses a lower FOV, the top ones use an FOV that's been cranked way up to create an isometric rendering effect

This is from an experimental version that produced a result I thought was cool.

Hellos and Byes / Re: Happy 2019!
Last post by Fat Cerberus -
Funny enough, when I wrote that "new years pig" comment I didn't actually realize that 2019 is the Year of the Pig according to the Chinese zodiac.  Yay hilarious coincidences!