Skip to main content

Learning BYOND, Day 4: Early Vestiges Of Awesome

Am I really only on day 4? The human brain is a remarkable device – that which seems hopelessly impossible to understand yesterday is implicitly understood and being done today. Where is the tangible difference? In the individual’s perspective, it is as though a part of reality was completely redefined, and yet there’s no artifacts to be found to mark the change.

I didn’t keep a running tab of everything I figured out today, so there will be no categorized list of minor newbie tips. Sorry, I was just having too much fun. However, I can remember a few interesting things that happened in my coding exploits today that might prove enlightening.

Bloat

As I wrote yesterday, I’m just comfortable enough writing code now to be dangerous. Consequently, I’ve been coding pretty comfortably. When you type 100 WPM, that stuff adds up pretty quick. Looking at the directory now, my code is up to about 41 kilobytes (over 40000 keystrokes) of raw text now. My code probably more than doubled in size this day alone.

I’ve broken off parts of my source code into other source files named after the particularly meaty object or global procedure definitions I moved there. That’s a good practice to adapt in order to quickly leap to the code you want to access. BYOND handles all the code file inclusions automatically: if it’s checked on the left of the dream maker’s file list, it’ll be compiled and accessible. (Of course, it’d be a bad idea to split an object or procedure in mid-definition since you can’t be sure in which order those files will be assembled.)

All this bloat is just that: Little (if any) of the code I wrote today is permanent. In fact, I’ll probably regret my amateur code later and want to completely re-write it when practice brings with it new standards of coding elegance. Oh well, such is the business of programming. At least, that’s the kind attitude a fledging programmer needs to not regret another day of his life down the bit bucket. (Oh well, how else would I have spent that time? Spamming a forum mostly filled with people half my age, probably.)

Hints of reward

With size, my code is also growing more capable. All those happy little digital souls living in my program now have brand new arms and legs with which they run amok all about my virtual world, gnashing and tearing, raping and pillaging. I do hope to teach them subtlety some day, but I can only code an ideal virtual world one line at a time.

As of today, my little robot mobs can now have special items I created – “robot interfaces” – installed into them by player characters who are carrying these interfaces. Each robot interface carries verbs that allow the players who can see them to control the robot they are installed in. So far, only two interfaces work: “follow me” and “wait,” but the basic framework is in place to allow players to install and use as many as I feel like creating. In a way, my coding more robotic interfaces would be not unlike a fantasy RPG developer coding more magic spells for wizards to cast.

The interfaces work via a rather crude hack where anyone in the world can use the verbs attached to them. That would simply not do – anyone could hack your robots and use them against you – however I’ve yet to figure out BYOND sufficiently to configure a better ‘set src’ setting to allow an item in another mob’s inventory to be accessible by the player.

For the time being, access can be controlled by who is capable of viewing the items in that robot’s inventory. The only way you can see the robot’s inventory is to see the robot’s inventory panel. Though it feels sloppy to not rely on the standard “set src” verb restriction, it works. It’s almost a very clever workaround, as the verb-enabled objects merge together on the robot’s inventory list to form a dynamic right-click menu.

Another bit of progress today is making some rudimentary use of clicking the mouse in the game via the Click() procedure that can be redefined on any visible object that’s placable in the game world. One elegant-feeling trick is to hook up the mouse click procedure to swap of the client.statobj variable. This enables players to see the stat panels of something else – just be sure to have coded the neccessary access restrictions in place to prevent the statobj from being assigned to anything you don’t want the players to view. A Click() procedure is also good to put on usable items to call a default verb that activates when the item is clicked on.

Trouble Ahead: Finding The Way

Considering the difficulty I’m having with figuring out a way players can input waypoints, I might just settle for the “follow me” and “wait” robot interfaces along with a third that orders the robot to go to somewhere easily in view. Players could tow around their robots and deploy them that way, and the game will be completely playable.

That’s a cop out, however. Next on the agenda will be creating a much better way to handle waypoint travel.

Part of the reason why is because I wasted about 3-4 hours trying to paint my player character’s assigned waypoints with the image() procedure. Because my current waypoint system is so kludgey, that turned out to be several times harder than it should have been.

(It might have helped if I had some previous experience with BYOND’s Image object handling – I’ve got the theory down, but there’s a remarkable difference between understanding the theory and having the experience of actually doing.)

The much-maligned short path to knowledge: RTFM

If I wasn’t having so much fun playing with my code today, I might have taken a better look at the DM Guide PDF. I’m only up to about chapter 7 now, having skimmed ahead for occasional things as I need it. Reading through my printed out PDF file and defacing it with a pencil seems to produce excellent rules in fostering better understanding. If I actually read it from cover to cover this way, it would probably be the shortest path to neigh complete understanding of the BYOND coding environment.

Alternately, I should probably consider getting my hands on some more example code. Seeing the way things are written by experienced BYOND programmers may prove enlightening, at least once I know enough about the why of it to understand why the code turned out elegant the way it was done.

Comments

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…