Welcome to the Cheesiest Blog on the Web

Any comments or questions regarding the content on this blog can be addressed to timothyjsharpe@yahoo.com

Wednesday, November 17, 2010

Build Your Own Net Dream

Another paper I wrote, this time for a Computer Languages class. It has to do with BYOND or "Build Your Own Net Dream", an interesting language for creating online games. Thought it was interesting enough to post on this Blog. If you're interested in learning to program (especially games), its an easy language to pick up and there are plenty of games to try to play and an active community there.

BYOND!
Many young computer programmers, myself included, were brought into the computer world by video games. In today's society, video games are everywhere. In many cases, it is more than simply a hobby. They inspire us, and expand our imagination and give us a sense of fulfillment. Many young people, myself included, have dreamed about creating their own games and rushed into computer programming to fulfill that dream. Finally, reality settles in on these young programmers as they realize that in order to build an online game in a reasonable time and with enough of an audience, they'll need to hire a team of programmers, advertisers, and pay for many other expenses. And so the dream is shattered. But what if there is another way? That is what BYOND seeks out to be, to allow dreamers like myself create games, it allows users to Build Your Own Net Dream. 
 
So what exactly is BYOND? Quite simply, BYOND refers to the virtual machine that runs programs in the language Dream Maker. Dream Maker is an extremely specialized computer language specifically designed for online gaming. Dreamers no longer have to worry about coding all of the nuances regarding their game, and can instead focus on the exciting things, players, objects, actions! BYOND has everything you need to run an online game (at peak efficiency, no less) already programmed in. Of course, this is a major help to anyone who wants to create an online game, that's what a specialized language is used for. Of course, if one wants to create something other than an online game, Dream Maker is surely not the language one would choose. Dream Maker uses an object-oriented paradigm. In fact, Dream Maker is interesting because it is the ultimate object-oriented language since Dream Maker is, at its core, exactly what object-oriented programming attempts to be: A group of objects interacting with eachother in a world.

The BYOND system was created by Dan and Tom from “Dantom” in 1994. Originally, they were going to create their own online game but came to a conclusion: Many large companies who want to create online games have infinitely more staff and funding than they do. So, in order to compete with such larger companies, they decided to “Let the players do the programming for them”, and BYOND was born. They were able to convert their game into what BYOND is today, where players can code their own independent game for the BYOND virtual machine, and have free advertising and people playing from the main BYOND website (or hub). BYOND is written in C, so Dream Maker is considered a C-like language and is actually a child of the C language.

Syntactically, however, Dream Maker is very different than other C-like languages in a lot of ways. They did this because the most important goals of the Dream Maker language was: to make it very simple so people with very little programming experience could pick it up, and to make it specifically have online game creation in mind. Displaying messages to players is very easy in Dream Maker, and it uses the “<<” operator to display messages. To display a message in code, one writes it in “auidence << message” format. For example, world << “Hello, world” would display “Hello, world” to all of the players in the game world. Also, while in many C-like languages applying non-literals into a message could be an annoying and confusing process, Dream Maker easily allows users to insert non-literals in brackets and BYOND will automatically interpret them as non-literals. Non-literals can either be variables, math, or a combination of both. Speaking of math, BYOND supports all common math operations (+, -, /, *) and also has many built-in Math procedures. 
 

Of course, what really makes the BYOND world come together are atoms, or instances of something that exists in your world. Atoms are broken up into four categories: area, turf, obj (objects), and mob (mobile objects). Area is the lowest level atom, and is simply space that can contain other atoms. Turf is intended to be a graphical representation of the ground, and contains objects and mobile objects. Turf is mainly used for graphical representation of the ground where objects reside, and how the ground would interact with those objects. Objs, or objects, are objects that can be interacted with in the world. Objects can surf a bunch of uses including equipment, obstacles, or even decoration. Finally, mobs, or mobile objects, are any object that moves including players and NPCs. Mobs are interesting because, by default, every player is given a mob that he or she can use to interact with the game-world. They are also unique because each mob has a built in procedure, Login() (which can be overwritten) that is called each time an instance of the mob is created. Each and every atom has certain variables that can be set that dictate how it interacts with the world. These include but aren't limited to: icon, density, name, desc (description), visibility, luminosity, loc (location), and opacity. Objects and Mobile objects also have additional properties such as gender, dir (direction), contents, key (username), and sight. 

What is truly unique about the Dream Maker syntax is the “Code Tree” concept. With it, users can easily code and understand relationships between atoms. The basic premise of the code tree is a few things. First of all, end statements are marked by the end of a line, not a semi-colon in most C-like languages (although a semi-colon can still be used). Secondly, indentation is used to determine what is a subset of what instead of curly brackets ({}). This gives you code that looks like this:

obj
   treasure
   gold
   silver
   crystal

As you can see, it is easy to understand that “gold”, “silver” and “crystal” are types of “treasure” which, in turn, is a type of “obj”. The Code Tree allows coders to easily state such relationships.

The next question is, if we have all of these atoms in a Dream Maker application, how do they interact with one another? That is where verbs come in. Verbs, in short, are procedures that can be applied to itself or have another atom apply to it. Verbs are one of the most exciting things about a BYOND game, and is what makes everything you could want to do possible. Here is an example about how BYOND verbs work:

mob
  verb

invisible()
   visible = 0

This is an example of a verb that any mobile object can use on itself that would make it turn invisible. Verbs of an atom can also be applied by another atom. In such a case, they have to be activated from a source atom, and would look something like this:

object/torch/verb/extinguish()
   set src in view(1)
   luminosity = 0

Verbs have two built in atom variables, usr and src. Users, or usr, is the atom that uses the verb, and sources, or src, is the atom that the verb is applied to. In a verb like invisible, the usr and the src is the same. But with a verb like extinguish, the player is applying the verb to the torch. The keyword “set src” allows you to set the conditions of the user in relation to the source. Normally, verb users will always be mobs (mostly player mobs). In this example, the usr must be in a range of 1 in order to extinguish the lamp. This is a necessity since you do not want players to be able to extinguish a lamp from the other side of the world! Finally, the existence of parenthesis have probably told you that verbs can take arguments. Arguments for verbs must have a declared type, since verbs are directly called by players and there may be malicious players out there who may try and make a verb call using an argument that is invalid. Therefore, one can use the “as” operator to declare input types and can use them as one would expect:

mob/verb/extinguish(msg as message)
   world() << “[key] says: [message]”

There is also proc, or procedures in Dream Maker. Procedures are a lot like verbs except that they cannot be called directly from the players. Procedures are designed mainly to make things easier on the programmer so they can condense long redundant code simply by making a procedure for it. Procedures can either be global or owned by an atom. Global procedures can be accessed anywhere in your code, while procedures owned by atoms can only be used by an atom that possesses the procedure. There are two main differences between procedures and verbs besides the fact that procedures cannot be called by players. First of all, since procedures are not directly accessed by players, you do not need to declare an input type for arguments. Secondly, procedures can return values by using “return”. Procedures without a “return” command will always return null. Here is a sample procedure and a verb that uses that procedure:

mob
var/life = 100
proc/Damage(D)
  life = life - D
  if (life < 0)
     view() << “[src] dies!”
     del src
verb/attack() //and counter-attack!
   set src in view(1)
   Damage(5)
   usr.Damage(5)

Last but certainly not least, like all good programming language, there are var, or variables. Like procedures, they can either be global or owned by an atom. Global variables are static, while variables owned by atoms are not so each instance of a particular atom type will not necessarily have the same value in a variable. Dream Maker variables do not have bindings, so the variable type does not need to be declared and can change depending on what you set it to. This can be both a good or bad thing. On one hand, there are times where you would want the type of a variable to change. On the other, the compiler will not be able to check if the operations you apply to the variable are possible so it makes debugging tricky. 

A sample game written in BYOND.
Now that I have explained the basic syntax of Dream Maker, we can go into the implementation. As I briefly went over earlier, BYOND uses a virtual machine to run Dream Maker applications. This includes a client that is only minority editable for all Dream Maker applications. The virtual machine has several benefits. First of all, this allows the programmers not to worry about the user's hardware when coding, Dream Maker applications will run at peak efficiency at any machine that supports a BYOND virtual machine. Also, the BYOND virtual machine provides a safeguard against malicious programmers. Since Dream Maker applications don't access any part of the user's computer directly, it is very hard to write Dream Maker applications with malicious intent. Finally, the BYOND virtual machine has an anti-crashing feature built in. Normally for most languages, when an error occurs, the entire program will crash. In the case of online games, this would cause the entire game world to crash. Instead, whenever there is an error, the BYOND virtual machine will automatically crash only the verb or procedure that caused the error. Unfortunately, these benefits do not come at no cost. Virtual Machines are slower than directly compiling into assembly language, but this is becoming less and less of an issue as computers are built faster and faster.

Dream Maker is a specialized language, which also comes with its advantages and disadvantages. The most obvious advantage to specialized languages is programming efficiency. Since BYOND does most of the hard work for you, you can create an online game much quicker in Dream Maker than you could in C, for example. Further, because Dream Maker is a language with online gaming in mind, it comes with many powerful features designed for online gaming. To make things even easier, BYOND comes with a pre-built client so programmers can focus on the interesting parts of their games. The disadvantage of a specialized language is that it is limited. If you wanted to build your own client for your game, it is not supported (although you can minority edit the client). Further, Dream Maker is useless if you want to make anything besides an online game.

All things considered, Dream Maker is an interesting computer language for what it does, build online games, online worlds, online communities. Because of its simple design, it is easy to learn even by first-time programmers and can even act as a first-time language that introduces the object-oriented paradigm to novice programmers. It has a large community so new features, support, and games are coming out all the time. There are over 500 games currently on the BYOND hub ranging from a simple game of Checkers, all the way to complete MMORPGs, so there is something for everybody. BYOND is an interesting thing to check out and try whether you are a programmer looking to create an online game, or a player trying to find new online games to try!

Bibliography
  1. ?, D. a., & ?, T. (2009, December 11). DM Guide. BYOND - Make & Play Online Multiplayer Games. Retrieved December 11, 2009, from http://www.byond.com/docs/guide/
  2. ?, T. (n.d.). DM Compared to Other Languages. BYOND - Make & Play Online Multiplayer Games. Retrieved December 11, 2009, from http://www.byond.com/docs/guide/app1.html
  3. ?, D., & ?, T. (n.d.). About Dantom. Dantom. Retrieved December 11, 2009, from http://www.dantom.com/about.html
  4. Hayden, R., Söderlund, A., & Tellefsen, G. (n.d.). BYOND game system. DDT Games. Retrieved December 11, 2009, from http://www.deadron.com/Games/BYOND.html
  5. Rcet. (n.d.). BYOND Coding Tutorial. Rcet's Projects. Retrieved December 11, 2009, from http://www.angelfire.com/games4/byond/

No comments:

Post a Comment