So how do you actually learn how to code for ss13?

How, what and why to code in BYOND.
Post Reply
User avatar
CPTANT
Joined: Mon May 04, 2015 1:31 pm
Byond Username: CPTANT

So how do you actually learn how to code for ss13?

Post by CPTANT » #109684

The wiki guide has some basic guides on how to write code byond code, but no where does it ever say how tg is coded.

What files control what, what things are called when etc.

I just can't make any sense of this huge blob of files and code that is the tg code.

An example on how to actually implement some basic things roughly from start to finish would also make things A LOT easier to understand.
Timberpoes wrote: Tue Feb 14, 2023 3:21 pm The rules exist to create the biggest possible chance of a cool shift of SS13. They don't exist to allow admins to create the most boring interpretation of SS13.
User avatar
Falamazeer
Joined: Sat Oct 18, 2014 12:05 am
Byond Username: Wootanon

Re: So how do you actually learn how to code for ss13?

Post by Falamazeer » #109693

You're basically asking how do I do everything.
I'm no expert but if you search a proc that's being referenced, back to it's source, you'll often find comments explaining it.
Doesn't work everytime but when I'm trying to figure something out that's where I start and sometimes finish.

this also might help, it's where they hide the secret translations for some of their more arcane procs
https://github.com/tgstation/-tg-statio ... /__DEFINES
(There is more like this, basically _define what you're trying to understand and hope for comments)


I dabble, and have never coded anything whatsoever, so take what said here with that in mind.
This is just what I've found in my searches to try to understand a few things better
Ham Sammich, beating a dead horse since 2010.
NikNakFlak wrote:....It's true...that is why I removed my forum avatar
lumipharon wrote:ass parasite was pretty meh when I tried it.
Miauw
Joined: Sat Apr 19, 2014 11:23 am
Byond Username: Miauw62

Re: So how do you actually learn how to code for ss13?

Post by Miauw » #109695

1. find easy-looking bug
2. join #coderbus
3. try to fix bug
4. repeat until you are a god
<wb> For one, the spaghetti is killing me. It's everywhere in food code, and makes it harder to clean those up.
<Tobba> I stared into BYOND and it farted
User avatar
Xhuis
Github User
Joined: Mon May 26, 2014 1:04 pm
Byond Username: Xhuis
Github Username: Xhuis
Location: North Carolina

Re: So how do you actually learn how to code for ss13?

Post by Xhuis » #109699

There's very little documentation on /tg/ code, which means it's pretty hard to learn normally. I taught myself, for instance. BYOND is such a simplistic language that if you've had any experience in code you grasp it very quickly. The issue with an open-source game is that there's very little generalized file structure. For instance, you can find a multitool in /code/game/objects/items/devices, but clothing is stored in an entirely different folder, in /code/modules/clothing. Using CTRL+F and searching included files will be a lifesaver if you're looking for a specific item.

The bad thing about Space Station 13 is that there are a lot of procs unique to it, and it can be hard to absorb. Your early days will consist of a lot of copy-pasting and editing to what you want. It's impossible to memorize so many procs early on unless you're a prodigy. The good thing about it is that /tg/ is an open-source repository, meaning you can look at any of the code and make small edits to help you better understand it. A good place to start is looking around for issues with the Easy Fix label on https://github.com/tgstation/-tg-station/issues. Feel free to join the #coderbus channel on https://rizon.net/chat for any questions you might have.
I'm an ex-coder for /tg/. I made the original versions of clockcult, shadowlings, revenants, His Grace, and other stuff.
I don't play, code, or participate in the community, but I occasionally post dumb stuff in the hut.
Kraso wrote:hi gay
wubli wrote:xhuis you said you were feeling better but every thread you make makes me worry more about your sanity
ExcessiveUseOfCobblestone wrote:Sorry I was making fun of xhuis' """""compromise""""" who insisted that was the correct term to use.
CitrusGender wrote:We've ended up disabling clockcult on sybil and bagil now (terry is having some problems.) We will give Xhuis some time until he wishes to work upon it again. As of now, please use this thread for ideas and not for bickering.
wubli wrote:you are a cultist of the gay
IkeTG wrote:It's a reflection of humanity, like all of man's creation. You cannot divorce this act from yourself, in a way there's a big titty moth inside all of us.
wesoda25 wrote:yeah no one was curious what it was from. Imagine choosing being a degenerate as your forum gimmick, LOL
User avatar
phil235
Joined: Thu Apr 17, 2014 11:39 am
Byond Username: Phil235

Re: So how do you actually learn how to code for ss13?

Post by phil235 » #109719

Here's the basics of how files are organized:
  • -tg-station
    • _maps (where all the maps are)
    • icons (where all the sprites are)
    • config (all the config files, list of admins, game options. If you wanted a different bomb cap for your server, you'd look in there)
    • html
      • changelogs (where you put your changelog when you change the code)
    • sound (all the sound files)
    • code (where all the code is, if you're not editing sprites, sounds or maps this is where all your changes will be)
      • ATMOSPHERICS
      • LINDA (fire code)
      • __DEFINES (where most defines are stored)
      • __HELPERS (helper procs, i.e. useful procs used in lots of places in the code (e.g. math functions)
      • _globalvars (where most globally defined vars are)
      • _onclick (click code)
      • controllers
      • datums (the data types)
      • game
        • area
        • machinery (the machine code, i.e. computers, air alarms, SMES, constructable machines, doors, etc)
        • mecha (mech code)
        • objects (where most /atom/movable/obj types are)
          • effects (foam, smoke, sparks, bloodstains, ...)
          • items (where most /atom/movable/obj/item types are)
          • structures (where most /atom/movable/obj/structure types are, i.e. windows, grille, chair, crate, closet, toilet, mirror, statues, etc)
        • turfs (where all the atom/turf types are, i.e. space turf, wall turfs, floor turfs)
      • modules (this is all the specific code modules, for example mob code, reagent code, clothing code)
        • food&drinks
        • admin
        • client
        • mob (mob code)
        • reagents (reagents code used to handle chemicals and stuff)
        • projectile (projectile code, contains guns and their projectiles)
        • power (code related to electrical power (APC, wires, singularity stuff)

Also, here's all the basic object types:
  • /datum (data stuff)
  • /datum/atom is the ancestor of all mappable objects (you can use /atom instead of /datum/atom)
  • /datum/atom/turf is the "tiles" of the games, basically floors, walls, space, etc (you can use /turf instead of /datum/atom/turf).
    Example: /turf/simulated/wall/mineral/gold
  • /datum/atom/area (area stuff) (you can use /area instead of /datum/atom/area)
    Example: /area/quartermaster/office
  • /datum/atom/movable is the mappable objects capable of motion
  • /datum/atom/movable/mob is "mobile objects", basically living being, ghosts and new players (you can use /mob instead of /datum/atom/movable/mob)
    Example: /mob/living/carbon/human
  • /datum/atom/movable/obj are "objects" (you can use /obj instead of /datum/atom/movable/obj)
    Example: /obj/item/weapon/screwdriver

Those types are native to byond. Now here's the basic ones specific to space station 13:

Obj
  • item
    • weapon
  • effect (sparks, foam, smoke, blood stain)
  • mecha
  • machinery
    • clonepod (cloning pod)
    • vending (vending machines)
    • computer
  • structure
    • window
    • grille
    • closet
      • crate
    • stool
      • bed
        • chair
Mob
  • living
    • carbon
      • monkey
      • human
      • alien (xenomorph, larva)
    • silicon
      • robot (cyborgs)
      • ai
    • simple_animal (mouse, corgi, cult constructs, maintenance drone, space carp, etc)
  • dead
    • observer (ghosts)
Turf
  • space (space tiles)
  • simulated (turf with atmos simulation)
    • floor
      • plating
    • walls
Last edited by phil235 on Tue Aug 04, 2015 9:45 pm, edited 5 times in total.
I'm a tgstation coding maintainer janitor
User avatar
MrStonedOne
Host
Joined: Mon Apr 14, 2014 10:56 pm
Byond Username: MrStonedOne
Github Username: MrStonedOne

Re: So how do you actually learn how to code for ss13?

Post by MrStonedOne » #109753

One should note some things

/obj/ are things that can exist in the world, but not normally be controlled by a player
/mob/ are things that can exist in the world, but can be controlled by a player.

This is the byond distinction, but code exists to allow a mob to possess an obj.

/obj/item <--- this one got me confused for a moment, but items are anything that can be picked up or helded. A syndibeacon is an item, the bomb it spawns when you click on it is not.
Forum/Wiki Administrator, Server host, Database King, Master Coder
MrStonedOne on digg(banned), Steam, IRC, Skype Discord. (!vAKvpFcksg)
Image
NSFW:
Image
Scott
Github User
Joined: Fri Apr 18, 2014 1:50 pm
Byond Username: Xxnoob
Github Username: xxalpha

Re: So how do you actually learn how to code for ss13?

Post by Scott » #109806

Fixing bugs and making minor changes is the best way to get into it.
User avatar
Ricotez
Joined: Thu Apr 17, 2014 9:21 pm
Byond Username: Ricotez
Location: The Netherlands

Re: So how do you actually learn how to code for ss13?

Post by Ricotez » #109986

I recommend learning a few things about object oriented programming principles before you start implementing new stuff. BYOND is quite different from Java and C++ in some regards, but the principles of OOP still apply.

Ideally, learning a new language and its peculiarities should only be a small task. Basic programming skills carry over to any language you work with.
MimicFaux wrote:I remember my first time, full of wonderment and excitement playing this game I had heard so many stories about.
on the arrival shuttle, I saw the iconic toolbox on the ground. I clubbed myself in the head with it trying to figure out the controls.
Setting the tool box, now bloodied, back on the table; I went to heal myself with a medkit. I clubbed myself in the head with that too.
I've come a long ways from asking how to switch hands.
Spoiler:
#coderbus wrote:<MrPerson> How many coders does it take to make a lightbulb? Three, one to make it, one to pull the pull request, and one to fix the bugs
Kor wrote:The lifeweb playerbase is primarily old server 2 players so technically its our cancer that invaded them
peoplearestrange wrote:Scared of shadows whispers in their final breath, "/tg/station... goes on the tabl..."
DemonFiren wrote:Please, an Engineer's first response to a problem is "throw it into the singulo".
tedward1337 wrote:Donald Trump is literally what /pol/ would look like as a person
CrunchyCHEEZIT wrote:why does everything on this server have to be a federal fucking issue.
Saegrimr wrote:One guy was running around popping hand tele portals down in the halls before OPs even showed up and got several stranded out on lavaland.
The HoP just toolboxes someone to death out of nowhere, then gets speared by a chemist who saw him murder a guy, then the chemist gets beaten to death because someone else saw him kill the HoP.
Tele-man somehow dies and gets its looted by an atmos tech who managed to use it to send two nuke ops to lavaland, who were then surrounded by several very angry people from earlier and some extra golems on top of it.
Captain dies, gets cloned/revived, lasers the guy holding the disk into crit to take it back.
Some idiot tries to welderbomb the AI hiding out at mining for no discernible reason.
Two permabans and a dayban, i'm expecting a snarky appeal from one of them soon. What the fuck.
ShadowDimentio wrote:I am the problem
Miauw
Joined: Sat Apr 19, 2014 11:23 am
Byond Username: Miauw62

Re: So how do you actually learn how to code for ss13?

Post by Miauw » #109999

also install notepad++ if you're on windows.
use that to edit the code and to search the code, it's great.
notepad++ has a "define your own language" feature which allows syntax highlighting for arbitrary languages.
here's an XML file for DM:
http://pastebin.com/abzbCU1n
<wb> For one, the spaghetti is killing me. It's everywhere in food code, and makes it harder to clean those up.
<Tobba> I stared into BYOND and it farted
onleavedontatme
Joined: Fri Mar 13, 2015 10:26 pm
Byond Username: KorPhaeron

Re: So how do you actually learn how to code for ss13?

Post by onleavedontatme » #110018

Copy paste shit wildly and pretend you know what you're doing.
User avatar
Not-Dorsidarf
Joined: Fri Apr 18, 2014 4:14 pm
Byond Username: Dorsidwarf
Location: We're all going on an, admin holiday

Re: So how do you actually learn how to code for ss13?

Post by Not-Dorsidarf » #110022

The best way is to start simple. Code some items which are like, reskins or whatever, like a new pet tame goliath for the QM or something.
Then begin working on something new, an idea from the idea forum. Thrash out some pseudocode which looks like it should work according to some similar code you've seen.
Upload it to a piratepad, and post it in #coderbus
The horrified screams of the people within when they see this pseudocode will instruct you on how the system you just mushed works.
Image
Image
kieth4 wrote: infrequently shitting yourself is fine imo
There is a lot of very bizarre nonsense being talked on this forum. I shall now remain silent and logoff until my points are vindicated.
Player who complainted over being killed for looting cap office wrote: Sun Jul 30, 2023 1:33 am Hey there, I'm Virescent, the super evil person who made the stupid appeal and didn't think it through enough. Just came here to say: screech, retards. Screech and writhe like the worms you are. Your pathetic little cries will keep echoing around for a while before quietting down. There is one great outcome from this: I rised up the blood pressure of some of you shitheads and lowered your lifespan. I'm honestly tempted to do this more often just to see you screech and writhe more, but that wouldn't be cool of me. So come on haters, show me some more of your high blood pressure please. 🖕🖕🖕
User avatar
MisterPerson
Board Moderator
Joined: Tue Apr 15, 2014 4:26 pm
Byond Username: MisterPerson

Re: So how do you actually learn how to code for ss13?

Post by MisterPerson » #110036

If you know something you really want to do but don't know how to go about doing it exactly, feel free to ask.

I spent a pretty good length of time just reading and trying to understand everything. It was kinda slow but I had success. I think most people would do better by getting their hands dirty and trying stuff out.
I code for the code project and moderate the code sections of the forums.

Feedback is dumb and it doesn't matter
User avatar
oranges
Code Maintainer
Joined: Tue Apr 15, 2014 9:16 pm
Byond Username: Optimumtact
Github Username: optimumtact
Location: #CHATSHITGETBANGED

Re: So how do you actually learn how to code for ss13?

Post by oranges » #110424

Linked Lists OP

Linked Lists
User avatar
Ricotez
Joined: Thu Apr 17, 2014 9:21 pm
Byond Username: Ricotez
Location: The Netherlands

Re: So how do you actually learn how to code for ss13?

Post by Ricotez » #110477

oranges wrote:Linked Lists OP

Linked Lists
recursive data types in general

just don't overdo it on the complexity
MimicFaux wrote:I remember my first time, full of wonderment and excitement playing this game I had heard so many stories about.
on the arrival shuttle, I saw the iconic toolbox on the ground. I clubbed myself in the head with it trying to figure out the controls.
Setting the tool box, now bloodied, back on the table; I went to heal myself with a medkit. I clubbed myself in the head with that too.
I've come a long ways from asking how to switch hands.
Spoiler:
#coderbus wrote:<MrPerson> How many coders does it take to make a lightbulb? Three, one to make it, one to pull the pull request, and one to fix the bugs
Kor wrote:The lifeweb playerbase is primarily old server 2 players so technically its our cancer that invaded them
peoplearestrange wrote:Scared of shadows whispers in their final breath, "/tg/station... goes on the tabl..."
DemonFiren wrote:Please, an Engineer's first response to a problem is "throw it into the singulo".
tedward1337 wrote:Donald Trump is literally what /pol/ would look like as a person
CrunchyCHEEZIT wrote:why does everything on this server have to be a federal fucking issue.
Saegrimr wrote:One guy was running around popping hand tele portals down in the halls before OPs even showed up and got several stranded out on lavaland.
The HoP just toolboxes someone to death out of nowhere, then gets speared by a chemist who saw him murder a guy, then the chemist gets beaten to death because someone else saw him kill the HoP.
Tele-man somehow dies and gets its looted by an atmos tech who managed to use it to send two nuke ops to lavaland, who were then surrounded by several very angry people from earlier and some extra golems on top of it.
Captain dies, gets cloned/revived, lasers the guy holding the disk into crit to take it back.
Some idiot tries to welderbomb the AI hiding out at mining for no discernible reason.
Two permabans and a dayban, i'm expecting a snarky appeal from one of them soon. What the fuck.
ShadowDimentio wrote:I am the problem
Miauw
Joined: Sat Apr 19, 2014 11:23 am
Byond Username: Miauw62

Re: So how do you actually learn how to code for ss13?

Post by Miauw » #110540

linked lists murder your cache performance bruh

good thing that byond is so shit that it doesnt have any cache performance anyway.

also byond lists are not linked lists, theyre red-black trees.
<wb> For one, the spaghetti is killing me. It's everywhere in food code, and makes it harder to clean those up.
<Tobba> I stared into BYOND and it farted
User avatar
Ricotez
Joined: Thu Apr 17, 2014 9:21 pm
Byond Username: Ricotez
Location: The Netherlands

Re: So how do you actually learn how to code for ss13?

Post by Ricotez » #110548

you can define your own (recursive) data types with /datums so you could totally write linked lists if you'd want to

whether it's a good idea, on the other hand...
MimicFaux wrote:I remember my first time, full of wonderment and excitement playing this game I had heard so many stories about.
on the arrival shuttle, I saw the iconic toolbox on the ground. I clubbed myself in the head with it trying to figure out the controls.
Setting the tool box, now bloodied, back on the table; I went to heal myself with a medkit. I clubbed myself in the head with that too.
I've come a long ways from asking how to switch hands.
Spoiler:
#coderbus wrote:<MrPerson> How many coders does it take to make a lightbulb? Three, one to make it, one to pull the pull request, and one to fix the bugs
Kor wrote:The lifeweb playerbase is primarily old server 2 players so technically its our cancer that invaded them
peoplearestrange wrote:Scared of shadows whispers in their final breath, "/tg/station... goes on the tabl..."
DemonFiren wrote:Please, an Engineer's first response to a problem is "throw it into the singulo".
tedward1337 wrote:Donald Trump is literally what /pol/ would look like as a person
CrunchyCHEEZIT wrote:why does everything on this server have to be a federal fucking issue.
Saegrimr wrote:One guy was running around popping hand tele portals down in the halls before OPs even showed up and got several stranded out on lavaland.
The HoP just toolboxes someone to death out of nowhere, then gets speared by a chemist who saw him murder a guy, then the chemist gets beaten to death because someone else saw him kill the HoP.
Tele-man somehow dies and gets its looted by an atmos tech who managed to use it to send two nuke ops to lavaland, who were then surrounded by several very angry people from earlier and some extra golems on top of it.
Captain dies, gets cloned/revived, lasers the guy holding the disk into crit to take it back.
Some idiot tries to welderbomb the AI hiding out at mining for no discernible reason.
Two permabans and a dayban, i'm expecting a snarky appeal from one of them soon. What the fuck.
ShadowDimentio wrote:I am the problem
Incoming
Github User
Joined: Tue Apr 15, 2014 11:41 pm
Byond Username: Incoming
Github Username: Incoming5643

Re: So how do you actually learn how to code for ss13?

Post by Incoming » #110623

One thing I think it's important to point out is that code readability is all over the place depending on where you look, If you just open a random file and it all seems too complicated don't despair, you may have just gotten unlucky.

I'm gonna pimp out my oldest codebaby on this one:

https://github.com/tgstation/-tg-statio ... atebomb.dm

I wrote most of that code when I still had a pretty tenuous grip on DM so it's written pretty directly, if only because at the time I had no knowledge on how to make it flowery impenetrable garbage.
Developer - Datum Antags: Feburary 2016

Poly the Parrot - All Seeing Bird Transcends Universe, Joins Twitter.

Kofi - Make A Poor Life Choice

Good ideas backed by cruddy code since 2012!
Miauw
Joined: Sat Apr 19, 2014 11:23 am
Byond Username: Miauw62

Re: So how do you actually learn how to code for ss13?

Post by Miauw » #111017

Slot machines are theoretically some of the cleanest code you'll find because I made them while being heavily scrutinized by Gia and Rock, you could try looking at those.
<wb> For one, the spaghetti is killing me. It's everywhere in food code, and makes it harder to clean those up.
<Tobba> I stared into BYOND and it farted
Post Reply

Who is online

Users browsing this forum: DaBoss