Skip to main content

Learning BYOND, Day 6: Open Heart Surgery

I’m probably going to go back and severely edit those “Learning BYOND” entires. Right now they’re a somewhat rambling collection that probably contain a number of inadvertent lies said out of code-newbie innocence. I’m not sure anyone finds those entries particularly interesting… at the very least, I should throw in some helpful diagrams!

Diagrams like so.
Diagrams like so. Funny enough, knowing how to answer the Pythagorean Theorem is actually quite useful for aspiring BYOND users (although the get_dist() function performs much the same way).

Oh well, this entry will be somewhat more interesting, I hope. Today, I talk about what goes into coding a force that drives a virtual universe.

 The heart of my game is the actionqueue procedure. This is activated when the world first boots up and stays running for the duration. Every second, it cycles through a list of designated “alive” mobs and checks the action queue on each. Each mob in the game can only execute one action per turn. In this way, BYOND’s flexible engine has been shaped into a simulated turn-based roleplaying game engine.

Controlling the use of the actionqueue is tricky because (thanks to the sleep() proc within it) it is waiting while other procedures are occurring at the same time. To protect against the conflicts that may occur, the actionqueue only performs the first action in the queue. No other procedure should manipulate that first action. Otherwise, if the timing is just right (or just wrong) then something’s going to break. If something needs to be inserted before that first action, the actionqueue procedure is the one to handle this.
Sorry Q-Bot, Ive made my own.
Sorry Q-Bot, I've made my own
The actionqueue procedure must be very efficient. I’ve tested that my computer can run about 50,000 lines per second. If I have 50 objects and the ActionQueue wants to go through 1000 lines each, it’ll bog down the server. If, on the other hand, each object only processes 10 lines then I can support up to 5000 idling objects. (Give or take — this is a bit of a shot in the dark.) If the server’s lagging, there will be a visible hitch every second when the actionqueue goes through its list.

How many “living” objects will I need? It’s hard to say. Though my plan is not set in stone, currently I want to do an epic 1000×1000 2d tile-based world. That’s huge – traveling at one second per square, it’ll take about 16 1/2 minutes to cross the length of it. (I’ll probably add quicker means to travel.) 

However, on such a large map, will there will always be something fairly meaningful going on with the players will be in the thick of it? This brings us to the central point: a huge world is pointless in game mechanic terms. Where the player is is not half as important as what I give them to do.

With the implementation of the actionqueue, I’ve harnessed BYOND’s flexible event model into a powerful virtual heart that drives my ideal game. In the coming days, I’ll have to design and implement the virtual soul that engages the player. It’s a pretty tall order – hopefully my 25 years of playing games will grant some insight there.


Popular posts from this blog

Empyrion Vrs Space Engineers: A Different Kind Of Space Race

In my quest for more compelling virtual worlds, I have been watching Empyrion: Galactic Survival a lot this bizarro weekend, mostly via the Angry Joe Show twitch stream.  What I have concluded from my observations is Empyrion is following in Space Engineers' shadow, but it is nevertheless threatening the elder game due to a greater feature set (the modding scene notwithstanding).

Empyrion is made in Unity, whereas Space Engineers is built on a custom engine.  While this does put Empyrion at a disadvantage when it comes to conceptual flexibility, its developers nevertheless have a substantial advantage when it comes to adding features due to a savings of time spent that would have gone into developing their own engine.  Examples include:
Planets.  Empyrion already has planets and space to explore between them, whereas in Space Engineers planets are in the works but still awhile away (so you just have asteroid fields to scavenge).Enemies.  Space Engineers' survival mode boasts onl…

Resonant Induction Really Grinds My Gears... In A Good Way

From about 2pm yesterday until 8pm today, I've been dabbling with my latest custom mod mix for Minecraft 1.6.4, which is this time very much Universal Electricity focused.
Aside from the usual GUI enhancers and Somnia, the primary contenders in this mix were:
Calclavia Core - Of course: this is the base of the Universal Electricity system.Resonant Induction - This seems to be largely focused on increasingly more advanced methods of refining ores divided across 4 ages of technological progression.  It also includes some really cool things such as assembly lines.  I'll primarily be talking about just a few blocks out of this mod today.Atomic Science - A mod dedicated to generating more of those lovely universal electricity volts via the power of splitting the atom.  Build your own nuclear reactor!  Deal with nuclear meltdowns!  You maniac!ICBM - A mod dedicated to generating more destruction using those lovely universal electricity volts (and more than a little gunpowder), it cer…

Sometimes, The Cat Skins You

The formula for cat girls is simple enough: young girls are cute, cats are cute, so young girls who are also cats are cute times two, right?  ... Cat Planet Cuties (a.k.a Asobi ni Iku yo) does not stop there, it includes girls with guns, nudifying weaponry, and even failed romantic comedy that shows lots of skin.  Cat's out of the bag: Cat Planet Cuties is basically straight up wish fulfillment.

The overall plot is pretty simple.  The Catians are a race so advanced that they have not changed in over 70,000 years.  They discover Earth, a planet whose people have uncanny resemblances, right down to speaking the same language!  Desiring an escape from their cultural stagnation, they rename their own planet from Earth to Catia and dispatch a scout to assess the viability of first contact with this new Earth inhabited by humans.  High jinks ensue.

Other than an excuse to see some fun sci-fi devices, the plot sucks. Let me count the ways:
Kio Kakazu - The male center of our harem, a 1…