Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / just curious, how long is your code??

Author
Message
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 20th Jun 2007 18:34
The last game I worked on, which was a mobile game, had a menu system, of which the core was about 10,000 lines of code, then there was extra menu stuff, networking stuff, and the actual game code, including an animation engine. I have no idea how much code it was in total, but it was a lot

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 20th Jun 2007 18:37 Edited at: 20th Jun 2007 18:39
Quote: "You guys obviously don't code too efficiently."

This is the second time someone has made this type of comment. You obviously have no idea what you're talking about. It's insulting and ignorant. I was pretty nice to Pricey about it, but it's really tiresome.

Quote: "Was everything hardcoded?"

No

Quote: "Lots of empty space?"

No

Quote: "Too many comments?"

No

It's big because it's a big game. If there are 25,000 lines of code and it runs well, then do you think it's coded inefficiently? What games have you made?


Come see the WIP!
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 20th Jun 2007 18:40 Edited at: 20th Jun 2007 18:43
No, I don't mean it in a nasty way. I'm completely serious; what is the bulk of the code? I quite simply can't understand how Dark Basic code can be that big and not be inefficient in some way!


Since the other one was scaring you guys so much...
MikeB
17
Years of Service
User Offline
Joined: 5th Apr 2007
Location: My Computer, Shropshire, England
Posted: 20th Jun 2007 18:41
Well I remember cash saying that his variable declerations were over 1500 lines.... *dies*

E.D.


Shame I can't change my name
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 20th Jun 2007 18:48
It's AI, I think - the minute you start coding proper AI into a game it just baloons out of all proportion. My AI tends to be 'have to do' stuff so it's not such a big concern, but even if you use DarkAI, it's still a big chunk of code in most big projects.

That's the way I see it anyway, Cash and Hex might know better, maybe they could have a look and give us an idea of what elements take up the most code, might be interesting to compare different types of game with how much code goes where.


Good guy, Good guy, Wan...
Nack
21
Years of Service
User Offline
Joined: 29th Jul 2003
Location:
Posted: 20th Jun 2007 18:49
Quote: "I quite simply can't understand how Dark Basic code can be that big and not be inefficient in some way!"
Its simply a big game, doesnt mean its not efficient. some aspect must be that huge, some ingame function, database management, OO scripting...those can easily take majority of the code. Long line of codes doesnt mean its not efficient. It mite be true for amataur programmer, but definately not for experiences ones.


Beta Level out! Check it out. =]
http://s7.invisionfree.com/NacksBunkie/
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 20th Jun 2007 18:50
Smash Bros Clone AI - just under 200 lines in total. It is kinda rubbish, though, as you have to split the level into chunks yourself. But, it is incredibly fast.


Since the other one was scaring you guys so much...
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 20th Jun 2007 18:52 Edited at: 20th Jun 2007 18:56
Well, sorry I took it that way then. It did come across that way when I read it though.

I don't really know what to tell you, it's all part of the game. Some of it is loading code that only gets run once. Some of it runs every single loop. A lot of it runs whenever I need it to - the spellcasting system, the conversation system, the object dragging system, the inventory management system, explosions, the combat system, code to create and manage the particles and animations, AI, code to make items float on the water, code to generate debris when objects are destroyed, code to manage the animals, more code to manage the RTS style entities in the game. The list goes on and on and on.

Around 1700 lines of code deal with variables, types, and creating the arrays in the game.

5100 lines of code deal specifically with characters - animation, creation, combat, etc.

Items take up a big chunk of code as well, since most things in the game are classified as items.

There are just a ton of systems that have to work together. Using less code would just be impossible.


Come see the WIP!
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 20th Jun 2007 18:59
I understand, and wasn't talking about your game. There's reason. I wouldn't have thought that Call of the Dragon would be that big, though. It is a real suprise. Sorry about being a little offensive. My hayfever is killing me, and making me feel bad. I'm not good at being fair....


Since the other one was scaring you guys so much...
David R
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: 3.14
Posted: 20th Jun 2007 22:45
Quote: "I can't remember how many lines of code my Dreamcast emulator had, but it was around 15mb of pure C code for the processor core."


Must be nasty to debug a seggy out of that codebase

My own stuff is fairly puny at the moment. 7137 for the engine that will power my game, so far at least. Most of it is missing really, and the game itself currently stands at one line of code...


09-f9-11-02-9d-74-e3-5b-d8-41-56-c5-63-56-88-c0
Matt Rock
19
Years of Service
User Offline
Joined: 5th Mar 2005
Location: Binghamton NY USA
Posted: 21st Jun 2007 06:09 Edited at: 21st Jun 2007 06:25
Varies from game to game:

Cheney Hunter: 845 lines of code... counting rem statements! Pretty short, huh? And Hobgoblin is making the sequel right now in Flash, I'm wondering which will be shorter, hehe

Eternal Equinox: 15,997 lines - because we were somewhat pressed into a sooner release date, we had to cut exactly 16,213 lines from it, which had to do with Raider's Ridge (9,641 lines) because it was too confusing to navigate through, and then the "after the game is beat" code (6,572 lines), which let the player continue after saving the village. Neither will make it into version 1.1 (probably the only upgrade the game will ever get or even need), but maybe when we release Eternal Equinox II next year, I'll release a "Director's Cut" of EE1 with the missing Raider's Ridge events and missions.

Project Sewer Rat: Excluding the FPSC code and fpi scripts, we've already written 4,867 lines to ammend to the FPSC code, and it'll probably end up with around 7,000 lines total.

Project Domesticated Ferret: 806 lines so far, not counting scripts, but all we've got done so far is the temporary frontend and gui layout

Eternal Equinox II: 2,019 lines of code so far, but it's nowhere near finished. We're using a brand new scripting language that we created from scratch, and a whole new engine also written from scratch, so EE2 is taking a while to get wheels under it.

I don't know why I just went off on a tangent about every game currently in development, lol, just got captivated by looking into each project's progress .

Edit:
Quote: "A rather long text adventure probably"

I've kind of made myself into the TGC text adventure guru, lol. Taking into consideration that EE is 1/5th that size and has 20+ hours of playing time wrapped into it, I couldn't begin to imagine what 200k lines of code would create. Well, I already know that it's Playbasic, but 200k lines in an IF title would be... I dunno. To quote Stephen Colbert, "would you call that a great IF game, or the greatest IF game?"

Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 21st Jun 2007 14:02
Handling around 65000 lines of DGDK code over here. Of course I have comments etc.
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 21st Jun 2007 22:53
@Matt Rock - Are you hard-coding all the text into your source file? That's an awful lot of code for a text adventure.

Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 21st Jun 2007 23:58 Edited at: 21st Jun 2007 23:59
Previously, I was referring to http://www.PlayBasic.com - If you include the IDE, docs, example pack and builder tools - it'd be more like the 400K lines ball park.

Thesius XII is the largest one[/url], which is to be expected - it's assembly.

Largest DB project would be Shamus-The shadow case which was written for some TGC compo in 15 days and plays like it too - But ya get that!

heartbone
22
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 22nd Jun 2007 00:19
15068 lines including about 100-200 blank lines.

Why did the forum software spit out
TURN YOUR CAPS LOCK OFF
When I tried to post only the number 15068?

If it's going to be rude, it should be accurate.
My caps lock was already off dummy.

I'm unique, just like everybody else.
The ARRAYinator
19
Years of Service
User Offline
Joined: 13th Aug 2005
Location:
Posted: 22nd Jun 2007 02:04
Gamescape is 6000+ lines in use at the moment which is not including all the little demo programs I made that have functions that need to be implemented which is probaly another few thousand.

Matt Rock
19
Years of Service
User Offline
Joined: 5th Mar 2005
Location: Binghamton NY USA
Posted: 22nd Jun 2007 03:17
Quote: "Are you hard-coding all the text into your source file? That's an awful lot of code for a text adventure."

Unfortunately for my tired fingers, I did (well, most of it). At first, EE was going to be a tiny game with what I was estimating would be about 5k lines of code. It would have taken me a fairly long time to implement a system of using text files instead of writing out text commands, and knowing me, by the time I'd worked it out I'd probably end up not being in the mood to write the actual text of the game. And that's fine and dandy with 5k lines of code... but somewhere around the Port of Hymns I lost control and started adding all sorts of people and places to visit. So in the end, what was going to be a tiny island with one village ended up being a massive island with the village of Equinox, the Port of Hymns, the Bridge of Ancients, Hap, etc. And by that time, it was too late to go back and fix the mistake of hardcoding everything. But eh, even though it was harder to do this way, I still think EE rocks . It would be a lesser game if I did it the proper way, that or it never would have gotten finished. And I'll bet no one understands that but me, lol.

hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 22nd Jun 2007 11:35 Edited at: 22nd Jun 2007 11:46
Quote: "You guys obviously don't code too efficiently."


A couple of years ago I would have said the exact same thing! But now I beg to differ. Unfortunately I can't release the code for public viewing for obvious reasons so I won't be able to back up this claim.

Quote: "25000 lines of code? How did you amass that much? Was everything hardcoded? Lots of empty space? Too many comments?"


I know efficiency plays a huge role but the size of the code is bound to grow as the game gets bigger and as you put more functionality into it. You should check it out; it's a really complex game with a lot of depth behind that simple exterior.

Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Jun 2007 11:47
Quote: "Why did the forum software spit out
TURN YOUR CAPS LOCK OFF
When I tried to post only the number 15068?

If it's going to be rude, it should be accurate.
My caps lock was already off dummy."


I had the same problem. It told me to change my underwear, but I'd already done it about a week before. Ridiculous!


hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 22nd Jun 2007 12:46
Quote: "That's the way I see it anyway, Cash and Hex might know better, maybe they could have a look and give us an idea of what elements take up the most code, might be interesting to compare different types of game with how much code goes where."


Here's an approximate breakdown of my code for anyone that is interested. To each his/her own method of coding; as for me, I like to break things down into fundamental modules so after months of not working on the game I can just take a quick glance and instantly get up to speed.

This may be much more info than you need on my game but it's 10 o'clock in the morning, the parcel delivery man woke me up prematurely at 8:00am and I couldn't get back to sleep, plus I’ve got nothing else to do till the afternoon.

01 COD.dba (1700), variable declaration and initialization
02 actor.dba (900), handles controlling the main protagonist
03 anime.dba (3200), handles protagonist 118 animations
04 audio.dba (220), handles game audio (sound and music)
05 buttons.dba (160), logs keyboard input and key combinations
06 camera.dba (260), controls the different types of cameras
07 clothes.dba (180), handles changing all the actors clothes
08 combat.dba (1770), handles all combat interactions
09 console.dba (840), controls the in-game console
10 credits.dba (220), handles the game credits (few so hard coded)
11 debug.dba (290), displays debug info on the screen
12 eanime.dba (2080), handles antagonist(s) 97 animations
13 effects.dba (1510), handles all game special effects
14 enemyAI.dba (1660), handles the behaviour of the antagonist(s)
15 filter.dba (340), texture filtering (lighten/darken, colour etc)
16 free.dba (280), so I don't have to keep track of entity ids
17 hud.dba (1620), handles the functionality of the HUD
18 imaging.dba (170), texture manipulation (sub sample, merge etc)
19 loading.dba (400), handles loading and progress bar
20 main.dba (60), main game loop, calling all other functions
21 maths.dba (270), all mathematical calculations
22 mesh.dba (40), mesh manipulation
23 physics.dba (770), handles all game physics
24 score.dba (120), updating game score, checks, name entries etc
25 scripts.dba (100), enemy AI script interface
26 stage.dba (1930), load stages and controls interactive entities
27 system.dba (860), background loading, checks, setups, etc
28 timer.dba (160), handles the master time that affects motion
29 video.dba (140), handles the introductory video
30 weapon.dba (760), handles everything to do with weapons
31 weather.dba (400), handles the game weather (rain and snow)
32 world.dba (740), initial world load and setup
33 zone.dba (410), handles the fight zone and enemy allocation

You can subtract say 100 lines from each of the above on account of superfluous spaces and comments used to keep the code neat and tidy, it's just so that I can quickly pick stuff up again after long absences. Like I said before the editor is about 5,000 lines and the usual suspects for racking up the lines of code like enemy AI scripts, dialogue, setup info etc are all outsourced to text files.

Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Jun 2007 16:10 Edited at: 22nd Jun 2007 16:12
It's nice to break down your code like that. I try and implement a kind of forced OO approach in DBP, and use separate source files to simulate my objects, so I'll end up with:

world.dba
player.dba
enemy.dba
-soldier.dba
-killer.dba
-tankman.dba
(these kind of inherit from enemy.dba by simply sharing functions and data structures)
weapon.dba
-m16.dba
-minigun.dba
-shotgun.dba
-grenade.dba
soundsystem.dba
loader.dba
particlesystem.dba

etc etc.

All the enemy and weapon functions and most others will have the same basic functions:
[Name]LoadData()
[Name]Create(params)
[Name]Destroy(x)
[Name]Process(x)
[Name]ProcessAll()
And then custom functions.

OO is the most elegant way to code a game, and obviously DB is procedural, but you can go someway to simulating OO in DB if you try.


hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 22nd Jun 2007 17:40 Edited at: 22nd Jun 2007 17:43
That's a very intriguing style. I guess I would have adopted something similar if I had started programming in C++ before i got around to Basic. After messing around with C++ mid-way through development of COD I started using an OO approach in some areas.

Code Dragon
18
Years of Service
User Offline
Joined: 21st Aug 2006
Location: Everywhere
Posted: 22nd Jun 2007 19:59 Edited at: 22nd Jun 2007 20:15
The Mekal Engine is just 1,287 lines long right now, 576 of them just for the File IO system that loads files from its special format into easy to access data structures for abstaction and easier loading (and does the same for saving) It took about 4 hours to code the system but now FileIO is easier than ever.

Quote: "
I try and implement a kind of forced OO approach in DBP, and use separate source files to simulate my objects"


I use that style now too, but instead of using inheritance for entities I have one big source file with zillions of parameters. The project has just begun and whenever I need a new entity I can customize almost everything:



Of course I`ll make files that define default values for types of entities so I don`t have to retype everything.

The funny thing is I use the same exact code to handle the player as the enemies.

Quote: "Why did the forum software spit out
TURN YOUR CAPS LOCK OFF
When I tried to post only the number 15068?"


Probably because it does something like this:



You never really know a person until you look at their google autocomplete entries.
Dr Manette
18
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 22nd Jun 2007 22:27 Edited at: 22nd Jun 2007 22:28
Revenge: 2398

Immortal Guardian: 1321

Everything else goes down from there. My current project is definitely going to be more... engine + AI + misc code =

Dr Manette
18
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 22nd Jun 2007 22:27 Edited at: 22nd Jun 2007 22:28
whoops, forum double posted me...

code master
20
Years of Service
User Offline
Joined: 4th Dec 2003
Location: Illinois
Posted: 22nd Jun 2007 22:39
I just started on a project 3 days ago, and It's already up to.. what, 154 lines? Wow. And I'll I've got to show for it is a measly tank that just sits there in the middle of the screen. Ha. But There's a large amount of engine framework crammed into that 154 lines. =D

I'm wondering how you guys use seperate DBA files, becuase the default editor tends to screw up with more than one code file, and the other editors don't work for me.

hyrichter
20
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 23rd Jun 2007 05:23
code master,
Have you tried CodeSurge yet?

As for source code length, Delphi tells me that on a full build of CodeSurge it has compiled 53722 lines of code. However, most of this isn't my code, it's the code for Synedit. I'd say that I've programmed around 7500-8000 lines for CodeSurge.

As for DB[P] projects, I haven't really been using DBP that much, but I did create a small FPS a few years ago that was around 2500 lines. I just don't have the coding time that I used to.

Good performance is better than a good excuse.
CodeSurge -- DBP Editor for serious programmers.
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 23rd Jun 2007 09:38
Quote: "Have you tried CodeSurge yet?"


Just tried it a few days ago... Gotta say, I love it. Anywho,

Excluding my DB projects, I'm in works (nearly finished with it) of a CMS (Content Management System) for websites, and its at about 3,866 lines of code. That's with the built in Forum, user system, admin panel, news system, and page handling system. Yikes.

My DBP projects I won't say as I've only finished 2 games.
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 23rd Jun 2007 11:02 Edited at: 23rd Jun 2007 11:03
Quote: "I'm wondering how you guys use seperate DBA files, becuase the default editor tends to screw up with more than one code file, and the other editors don't work for me."


Avoid syntax errors! It's weird, I know, but the editor only deletes your source code when it detects syntax errors. I think it's a kind of punishment. The bug still really annoys me, but I'm so used to it now, I know what the symptoms are of it failing (reporting a syntax error on a blank page normally) and how to resolve it (reload the project!). Always save before compiling, and recognise the symptoms before saving again, and you can live with it.

I'm gonna try Code Surge at some point though.


Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 23rd Jun 2007 14:44
(U can avoid it by opening all dba projects before compiling)

But i use code sugre


[B] - LINKIN PARK - [/B]

Login to post a reply

Server time is: 2024-11-18 19:33:12
Your offset time is: 2024-11-18 19:33:12