Coding for CoH


Bionic_Flea

 

Posted

Does anyone know how many lines of code CoH is made of? Just wondering, I'm learning C++ and was thinking about how many lines of code it must take to run CoH.


Virtue: @Santorican

Dark/Shield Build Thread

 

Posted

No idea for CoH, but another MMO is apparently about 5.5 million lines of code

source


Always remember, we were Heroes.

 

Posted

5.5 million lines!? lol and I thought my little phone book project was long...


Virtue: @Santorican

Dark/Shield Build Thread

 

Posted

Quote:
Originally Posted by Santorican View Post
5.5 million lines!? lol and I thought my little phone book project was long...
And that figure is 2 years old as well... WoW is liable to have grown by quite a bit and it does *not* include art/music assests either (because you cannot really apply a "code line" to a data stream).

Addenum: That number also probably has very strange layouts as well (long running lines for long functions, although breaking them apart would be better) etc etc


 

Posted

At a guess it'll be done across several languages aswell which means building a method of interacting with an 'engine frontend scripty thing' aswell as interface shite... God only knows. More than i'd care to imagine :/


 

Posted

Quote:
Originally Posted by Kindeller View Post
At a guess it'll be done across several languages aswell which means building a method of interacting with an 'engine frontend scripty thing' aswell as interface shite... God only knows. More than i'd care to imagine :/
As well as non-language data input. For example, powers are defined in a spreadsheet. I recall Castle saying his job was (paraphrasing) entirely playing with Excel documents (though, many powers use a pseudo-language thingy for defining stuff like how the power unlocks, or how much resistance the SR passives give you, things like that). Animation sequencers aren't exactly any programming language, either. Then there's the P-strings...

I was recently talking to a friend of mine (previously lead designer at a ~100 person game company, now develops independently for Android), and he mentioned a game company in Houston that was working on an MMO... with 6 employees. I asked him if they were crazy. We laughed. I suppose you could build a really nice MUD/MUSH with 6 people, but you're not going to make a profitable MMO like that.


http://www.fimfiction.net/story/36641/My-Little-Exalt

 

Posted

I used to be a volunteer developer for a text-based game. I don't know know how many lines of code the game had, but it had to be several thousands.

FYI the old Diku MUD codebases are still around and can be downloaded. if you obtain a server it is actually possible to build your own text based game. By complete coincidence, one of the codebases now widely available is "The Forest's Edge," which happens to be the MUD I played back in 1997 or 98.

I don't know what City of Heroes looks like under the hood. I can tell you that the game I worked for had a custom codebase. It was a very nice setup how they had it. The overarching engine was in C++ but the company had invented their own scripting language that compiled in real time without having to take the servers down. When we developed things, we would program it on a live development server and test it in real time, then "roll" the code over to live servers once everything was QAed and ready. The game rarely had downtime at all.

However, text based games have some huge advantages over graphical ones. For one thing, its probably obvious that you can make on the fly changes much faster in a text based game. But the other major advantage is that your code is not reliant on a game client. That means that while you may crash the server, you won't independantly crash the player's game client. Have you ever noticed that everytime CoH makes major changes under the server hood, they make us all update to a new client? That's part of why. They're making sure if they start getting tons of reports about us crashing that we're all on the same version.

In any case, the number of lines of code would be hard to guess because most games break code down into segments. Generally speaking, you have:
- an interface layer that governs loading and saving player data, and logins and logouts
- seperate server code that governs actual gameplay (e.g. resolves combat rolls)
- the player game client, which plays animations and sounds in accordance with what the server tells it is happening, and accepts user commands to pass to the server*
- lists of things: items, spells, etc. sometimes in scripting languages, sometimes xml, sometimes other formats. FYI it is rare for these things to be literally coded in C++ these days. in the old DIKU MUDs I believe they were however. I would have to go back and look.
- instance code, usually in a custom script language, that governs missions/instances

[*Have you ever wondered why when the game starts lagging you start "rubber banding?" It's because a portion of the movement code is faked. The client doesn't literally check up with the server every millisecond to see if you can move to a new location on the map, it just lets you move around based on what it knows about on your local computer. When you start lagging, the client is still letting you move around, but the server isn't getting the information fast enough to check up and make sure you can actually move you to where you're instructing it to go. When it finally does send information back to the client, the client is like "Oops, okay I got THAT one wrong" and warps you to where your character is standing on the server. One way to tell for sure you're lagging is to try clicking a power that should normally fire; powers always require a server okay before activating (in this and any game coded by anyone half competent). Movement, however, is different, because if it asked for a server okay literally the whole time you were pressing the keys, the game would stutter constantly.]

In City of Heroes specifically we can see how the AE code works by going into the CoH folders and reading the script language there. In fact I often edit this code directly because it is faster than using the interface (tho I do use the interface to generate the basic script first). You can also see what I suspect is similar to the script the server feeds the game client during the live game by reading demorecord files.

One thing to keep in mind about all this is that there are also probably code libraries being used by the client or servers our developers did not actually write. For example, mechanics that handle capes and ragdoll effects.


 

Posted

Quote:
Originally Posted by Fleeting Whisper View Post
As well as non-language data input. For example, powers are defined in a spreadsheet. I recall Castle saying his job was (paraphrasing) entirely playing with Excel documents (though, many powers use a pseudo-language thingy for defining stuff like how the power unlocks, or how much resistance the SR passives give you, things like that).

I can't tell you how much I would love to get my hands on that code. I would love to see what goes into building a power and how it compares to other games I've worked with/looked at. I'm sure it falls under the same rules as pigg files, though. If it's not an outright "state secret."


 

Posted

My understanding is that much of CoH is actually a giant Excel spreadsheet of all the powers' effects.

Not a joke.


50s: Inv/SS PB Emp/Dark Grav/FF DM/Regen TA/A Sonic/Elec MA/Regen Fire/Kin Sonic/Rad Ice/Kin Crab Fire/Cold NW Merc/Dark Emp/Sonic Rad/Psy Emp/Ice WP/DB FA/SM

Overlord of Dream Team and Nightmare Squad

 

Posted

Quote:
Originally Posted by Bionic_Flea View Post
My understanding is that much of CoH is actually a giant Excel spreadsheet of all the powers' effects.

Not a joke.

This wouldn't be completely unusual. Ok, well, it would, but only that it's Excel and not XML or a txt of some kind. Though they could be exporting to that format. It's actually a great way to design a spell system, although personally I would really want a script language to help support it. The three spell systems I'm familiar with from other games looked more like:

Custom text based MMO - Each spell had a seperate "script language" file. Each file had standard functions within it to handle common spell logic. E.g. handleRecast, handleCastSelf, handleNoTarget, isCanCast, etc. Not the most elegant thing ever, but it worked, and again, could be published to a server without taking it down.

Neverwinter Nights 1 and 2 on the PC - Each a spell a seperate C++ file. More or less similar to method above, but fewer handlers. However, the game engine did not provide a method to allow you halt a spell before it was cast (e.g. so you could make the spell not expend itself if the target is illegitimate.)

DIKU muds - I should remember but totally don't. I'm going to guess that each spell is hardcoded into C++. I don't remember any external file look ups in standard MUDs, but it's been years since I looked at one. This is actually what may make legacy MUDs an ideal place for a person interested in MMOs to look. Although NWN 1 was an especially great environment for practicing, if its still around.

[EDIT: I totally lied. DIKU MUD and its derivatives are written in C, not C++.]


 

Posted

Quote:
Originally Posted by Fleeting Whisper View Post
I was recently talking to a friend of mine (previously lead designer at a ~100 person game company, now develops independently for Android), and he mentioned a game company in Houston that was working on an MMO... with 6 employees. I asked him if they were crazy. We laughed. I suppose you could build a really nice MUD/MUSH with 6 people, but you're not going to make a profitable MMO like that.
I can think of at least one legitimate MMO with a single-digit developer count that, as far as I know, is profitable. Not large at all, but profitable.


Having Vengeance and Fallout slotted for recharge means never having to say you're sorry.

 

Posted

Quote:
Originally Posted by Kelenar View Post
I can think of at least one legitimate MMO with a single-digit developer count that, as far as I know, is profitable. Not large at all, but profitable.
I could believe a simple F2P, web-based MMO might be able to get away with a few developers but it's safe to say you're not going to run a WoW like that. But anyway in terms of "profitability" if you only have a few people on staff a niche game probably wouldn't have to make all that much money to keep going.


Loth 50 Fire/Rad Controller [1392 Badges] [300 non-AE Souvenirs]
Ryver 50 Ele� Blaster [1392 Badges]
Silandra 50 Peacebringer [1138 Badges] [No Redside Badges]
--{=====> Virtue ♀

 

Posted

Quote:
Originally Posted by Lothic View Post
I could believe a simple F2P, web-based MMO might be able to get away with a few developers but it's safe to say you're not going to run a WoW like that. But anyway in terms of "profitability" if you only have a few people on staff a niche game probably wouldn't have to make all that much money to keep going.
Normal subscription-based MMO with a fairly large, persistent world game with, I think, a nine-dev team and a player base that wasn't even laughably small last time I checked. (I can't find the source I got nine from at the moment, but it's easy to find "It's less than ten guys doing it out of their garage.") And last I heard, they were making money, thanks to self-publishing. Which isn't to say that I'd ever want to try developing a legit MMO with a staff that small, but it's apparently happened.


Having Vengeance and Fallout slotted for recharge means never having to say you're sorry.