ID:2790042
 
Are you wanting to become a BYOND developer? Look no further because it's all down-hill from here.

At each step will be a URL to an image, the image could contain further information in the comments of the code. Comments are anything after the // characters, it will be in a gray color.

Step 1: --- https://i.imgur.com/fKxFLD3.png
  • Open up DreamMaker
  • Give your project a name and where it will be located in your files.
  • Pat yourself on the back, your game is already 50% done.


Step 2: --- https://i.imgur.com/G2Hk0D6.png
  • F1 is your friend, if you need to know how something works, go there first.
  • Whole step dedicated to this button right here.


Step 3: --- https://i.imgur.com/mwbZz5G.png
  • This is how you compile your code.
  • You can click it as much as you want nothing will happen.


Step 4: --- https://i.imgur.com/2pt3XM8.png ---https://i.imgur.com/434tHZa.png
  • This is how you send people files to play/host your game.


Step 5: --- https://imgur.com/a/aP6Cz6N
  • This is how you run your compiled code, after hitting compile.


Step 6: --- https://i.imgur.com/RtJW38l.png
  • Think of people and how family trees work, even genetics, same thing here.
  • mob/npc will inherit from mob, so will mob/npc/zombie
  • Things defined under mob/npc won't be inherited by mob
  • Things defined under mob/npc/zombie won't be inherited by mob/npc
  • icon and icon_state is a built-in variable for anything that can be placed on the map and shown.
  • The Default BYOND type hierarchy is as follow
  • atom(/turf) -> atom/movable(/mob,/obj)
  • A wall is dense, you can't walk through a wall if you're also dense.(Unless you're a ghost!)
  • I forgot to mention, by default mobs are dense
  • loc references the current turf at which your mob resides


Step 7: --- https://i.imgur.com/bJJQU4x.png --- https://i.imgur.com/XjstrhS.png
  • You'll want to create a map.dmm file (.dmm means map file)
  • You'll want to create a mobs.dmi and tiles.dmi (.dmi means icon file)
  • Make sure to give them the correct icon_states in the icon files


Step 8: --- https://i.imgur.com/VEVapIU.png
  • Click Compile
  • Click Run
  • The default movement system uses the arrow keys.


Step 9: --- ???
  • I suggest learning about things in this order.
  • Type Inheritance
  • turfs, mobs, objs
  • Return values, Arguments
  • locate(), switch(), if(), else, else if()
  • lists, var list/l = list("A","B","C",new/obj,333)
  • overlays/underlays/vis_contents
  • animate()
  • client.screen
Procs
  • proc/A()
    return 123
  • Calling A will return 123
  • proc/A(a=321)
    return 123 + a
  • You're now creating arguments for the proc.
  • By calling A() with no argument, it will default to 321
  • var i = A() // i = 444
    
  • var i = A(3) // i = 126
    
  • proc/ExampleFunction(a,b,c)
    return list(a,b,c)
  • The above example is a proc that takes 3 arguments.
  • This proc will return a list, which contains said objects.
  • If any arguments are not given, it will result in a null value in the list and arguments.
  • mob/Login()
    var list/l = list(7,3,9,2,1,5)

    SortSmall2Big(l)

    for(var/i in l)
    world << i

    proc/SortSmall2Big(list/l) //This is a global proc, this can be called anywhere.
    var len = l.len // lists have a variable called len, it states the current length of the list.
    for(var/a = 1 to len) // Loop from 1 to the lists length
    for(var/b = 1 to len) // Do it again, but cooler.
    if(l[a] < l[b]) // Compare, is 9 > 3? Swap them!
    l.Swap(a,b) // Swapping the positions. This is a built-in function for lists.
Type Inheritance
  • mob/npc/var/tmp
    list/traits

    mob/npc/kyle
    name = "Kyle"
    traits = list("Strong","Lazy")
  • We've defined a mob named Kyle under mob/npc
  • mob/npc/proc/GetTrait(position)
    if(position > traits.len || 1 > position){return null}
    return traits[position]
  • The proc GetTrait() will grab the trait at whatever position you pass into the argument.
  • mob/Login()
    var mob/npc/kyle/k = new // We create a variable that points to mob/npc/kyle
    // and give it the name k and create it via new
    world << k.GetTrait(1) // Outputs "Strong" via k's proc GetTrait()
    world << k.GetTrait(2) // Outputs "Lazy" via k's proc GetTrait()

    var mob/npc/d = new // can even create the base type and dynamically create things at run-time/compile-time.
    d.name = "Koz"
    d.traits = list("Lazy","Lazi but with an i")

    world << d.GetTrait(1) // Outputs "Lazy" via d's proc GetTrait()
    world << d.GetTrait(2) // Outputs "Lazi but with an i" via d's proc GetTrait()


    // Below won't work.
    // the variable name is defined under atom so it's inherited by everything.
    // the variables traits however only exists under /mob/npc, not /mob.
    // the same issue with the proc GetTrait(), it only exists under /mob/npc.
    // the code below will throw an error because of it at compile-time.
    var mob/m = new
    m.name = "Sugma"
    m.traits = list("Basket","Ballz")
    world << "[m.name] [m.GetTrait(2)]"
  • There's also datums, which are like the opposite of atom.
  • color
    var r = 255
    var g = 255
    var b = 255

    mob/Login()
    var color/c = new
    world << "RGB: ([c.r],[c.g],[c.b])"
  • You use datums to encapsulate data, they can't be placed on the map and are purely data.
I'll be updating this as time goes on, for now I leave you with a invite to another BYOND-related discord :D

https://discord.gg/GbnfdfVaUc

You can suggest further information and/or examples that would help others benefit from witnessing what true code looks like.

Login to reply.