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.

DarkBASIC Discussion / How many lines do normal games take up?

Author
Message
The Lone Programmer
22
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 2nd Oct 2003 04:37
I was wondering...
How many lines does a fairly made game take up? My game has probably taken up 300 lines and I hardly got anything.

If games dont take up a lot of lines how do you get them that way. Is there a way to link pages of different code together.

Say maybe one page is dungeon and another page is a different dungeon. Is there any way to link them through some kind of like hyperlink or does the codes have to be clashed together.

I have DBC and plan to get DBP so maybe if you know please state what its for. Lots of code lines get kinda confusing.

Thanks
Nicolas

Future Company Name = Blazing Fire
Current Website Name = Blazing Fire
Future Number is Eleventy
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 2nd Oct 2003 05:11
think of it this way, a normal game by todays standards is Red Faction or Half Life, they have over a good million lines of code. Considering the simplicity of Dark Basic Classic or Pro, should be considerably less to achieve a similar effect (like 5000-10000)


Dark Basic Pro has arived! I can feel the power!
andrew11
22
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 2nd Oct 2003 06:03
It also really depends on how many levels/characters you have and how you actually do it.

For example, If you hard code everything including levels and characters, it will be much more, but if you just make a "shell" and load everything via files.

You can seperate files, like includes, but I think thats kinda messy, so I just seperate into functions or subs. It's still really hard to keep track of all that code though. Only work on one section at a time, and only edit the others when you need to. Otherwise, you could ge overwhelmed.

"All programmers are playwrites and all computers are lousy actors" -Anon
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 2nd Oct 2003 07:44
Yeah, what andrew11 said is right... You need to divide your program/game up into sections...

The best way i have found to do it is to split it up into a whole load of functions and #INCLUDE them into my main program (read more on this in the help files), that way it is ALOT easyer to keep track of where everything is.

For example, if you had 30 lines of code that you use repeatedly throughout your game and its the same code over and over, you could simply put it into a function and call the function when needed, thus removing all of those 30 line code blocks and replacing them with a simple function call...

And for world data and character weapons and other object data etc, it is best to put all of that into external files, like into *.txt files or something like that... That way, you can just open the file to read from your main program, which saves you putting all the lines of DATA strings into your main program and again, replacing them with a single line of code, the READ command.

It is best to start dividing your program up as early as possible because, as andrew11 said, it can become quite overwhelming if you have to search through a whole load of nothing to find one variable that you mucked up, or to find where the IF is that isnt working like is should, whereas you can just open up your file containg the function and you can sort the problem out straight away (depending on how big your function is of course)...

Hope I Helped...

If Quizz's Are Quizzical, Then What Are Test's?
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 2nd Oct 2003 11:53
ITs much better to keep an engine as data-driven as poss, use a shell and load files into it.

"It's amazin' what you can do with a computer and access to t'internet"
heartbone
22
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 2nd Oct 2003 14:16
Mary's Pro Keno 5672
INTERSHIP 6109
COMMBAT 6083
Who Like Puzzles? 3389
Pooh Banger 833
Slot Racers 2118
Easy Tank 5688
Easy Tank COMMBAT 14962

Expect about 5000 lines for an average complete shareware quality game.

The more you see, the more you know.
The more you know, the more you see.
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Oct 2003 14:29
As you can see from Heartbone's post...it depends on the game. You code what you have to code, don't worry about the number of lines.

What is important is the number of lines executed per game cycle, and the complexity of those lines. Each operation eats into the amount of time available between SYNCS, each command uses a different number of operations.

It's quite possible to write 100,000 lines of code, but only execute 100 lines per game cycle. The question you've asked is very open-ended.

For example, I update only a percentage of my HUD each game cycle. This reduces the number of lines executed in my HUD function to about 30 lines per game cycle. In reality, the HUD function has around 300 lines of code.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Beta 1
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 2nd Oct 2003 16:30
The last thing I was playing with had about 2000 lines but of those maybe half are part of an ongoing game engine and will be reused for the next project (with some alterations probably as I cant stop tinkering)

DBP has made includes far simpler by allowing additional source to be loaded from other files from within the editor. At the moment I have a several files I load for every project which include functions and routinges handling common tasks that I'm likley to need in any program (eg my mesh/texture handling system, various template file handling routines, and my dynamic terrain/scenery engine)
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 3rd Oct 2003 02:30
dwarven tales editor 15000 (not complete)
dwarven tales game 13000 (not complete)

http://www.lunarpixel.com
It's already tomorrow in Australia
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Oct 2003 13:30
RTS demo (about 30% complete) - 844 lines. This will be several thousand lines I'm sure.

Tetris - 640 lines, could be condensed probably

3d space shooter - 700 lines

It also depends how well you program, how efficiently you can condense code.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Oct 2003 15:41
And also... dont forget that if you comment your code (which you should do...) it can almost double the amount of lines used...

Hope I Helped...

If Quizz's Are Quizzical, Then What Are Test's?
Check my profile for a quick test of knowladge...
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 5th Oct 2003 10:57
Comment? Why do you think its called code!
Killswitch
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 5th Oct 2003 22:40
*shudder* How many lines does a FF game have? *shudder*

~I see one problem with your reasoning: The fact is that is a chicken~
Magpie
21
Years of Service
User Offline
Joined: 16th Jul 2003
Location: Otherland! Cos it rocks!
Posted: 5th Oct 2003 22:57
Depends whether they do lots of profiles in external files or load all the info into their code. I tried to do a FF-ish game once...

Barely escaped with my dignity.

Killswitch
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 5th Oct 2003 23:03
Lol there there Helix

~I see one problem with your reasoning: The fact is that is a chicken~
The Lone Programmer
22
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 6th Oct 2003 01:21
Quote: "And for world data and character weapons and other object data etc, it is best to put all of that into external files, like into *.txt files or something like that... That way, you can just open the file to read from your main program, which saves you putting all the lines of DATA strings into your main program and again, replacing them with a single line of code, the READ command.
"


How do I do this???? Ive tried to learn in the help files and tutorials but I hate to say it, but they stink.
If I were to make text files would they still be able to execute commands for my weapons and stuff?

Say I have a weapon called sword. It costs 50gp and adds +4 to attack.
Would the text file be able to hold that but actually have the command work. Or will it just be as if it were a text command with no variables.

Please teach me some basics on text file making/reading, includes, subs, and functions.... But mostly the text file stuff.

Thanks for the help
Nicolas

Future Company Name = Blazing Fire
Current Website Name = Blazing Fire
Future Number is Eleventy
WarHunterX
22
Years of Service
User Offline
Joined: 25th Mar 2003
Location:
Posted: 6th Oct 2003 01:30
Theres a little magical place called "Command List", you should go there one day
Black Hydra
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 6th Oct 2003 02:45
Don't think of the amount of lines.

That really is saying nothing.

IMHO the hardest part of a game is not typing tons of code but problem solving on how you can best to this or this.

10000 lines of code may make you wanna crap your pants but how many lines it is doesn't really mean much. You will probably find that you will having more code is often more helpful than not (In terms of having comments or not).

If you want to make a game also look for things you might think that are reused. If you make functions or include files this can help break down your code (top-down logical approach) so that if there is an error it is alot easier to find and everything is neatly organized.

If there were 5000 lines of script and there was 1 error do you know how much of a pain that would be to look through and debug. But if it were 5000 lines but separated into functions you could just look up one section for a fault instead of scrolling through thousands of lines.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Oct 2003 11:58
Smokie,
Your right, it is always a good idea to use little files as much as possible, I'd even suggest a script engine if I thought you could take the pressure . I think you need to learn more before starting a big project - esp things like Arrays for storing your data, file handling, etc etc.


Van-B

My cats breath smells of cat food.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 7th Oct 2003 08:22
Quote: "Say I have a weapon called sword. It costs 50gp and adds +4 to attack.
Would the text file be able to hold that but actually have the command work. Or will it just be as if it were a text command with no variables."


Ok, what your going to need is to save all the info of that weapon into a txt file or the like for example:


This would mean, its called "sword" costs 50 and adds 4 to attack.

Now, to read this data into an array (the easiest way of storing it), you'll need a string parser which checks for commas (,) and saves the string into the array...

This is a string parser, if its not comented enough, just say and ill explain it.



And here is what is in the gamedata.txt file... feel free to edit it and change it and add things to it all you like, thats what its for...




Hope I Helped...

PS if you need help using it, just post it and ill explain stuff to you

If Quizz's Are Quizzical, Then What Are Test's?
Check my profile for a quick test of knowladge...
Xander
22
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 7th Oct 2003 08:28
My nearly finished RTS game is over 5000, it will probably grow to about 7000 before it is done. They are right, though. What really matters is how many lines are excecuted each loop, how much commenting you have done, and how condensed your code is. I have nearly no commenting, only a couple labels, and it is not very well condensed. I don't intend anyone else to be able to figure it out

Xander - Bolt Software

It doesn't matter if it is confusing, as long as it works
las6
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Finland
Posted: 7th Oct 2003 09:35
check the 20-liner compo board. That should give you some idea.

actually, I had an really OLD project with 500lines. I was able to squeeze it into 20 lines. So linecount doesn't always tell the truth.

heartbone
22
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 7th Oct 2003 09:49
15,000 lines =
(approximate counts)

1,000 Blank lines (whitespace)
2,000 Remarks
14,000 Executable statements (multiple statements on some lines)

The number of executable statements is the number that I'd look to as a gauge of program complexity. Those 20 line programs can contain 200 statements.

McPot, how many lines in a fairly made game?
Define a fairly made game and I'll answer you.

The more you see, the more you know.
The more you know, the more you see.
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 7th Oct 2003 15:07
Well I usually break my games up into segments.

Title Screen (Where you choose new game, load game) that has nice environmental effects : Around 400 Lines

First Scene of ED (camera doesnt even move): 700 Lines

First Town of ED: 1000 and counting

There will be muuuuuch more Ill figure the demo will be around 12000 lines.

RPGamer

Current Project: Eternal Destiny
We need a texture artist!
If your interested email me - [email protected]
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 7th Oct 2003 15:35
Sounds like a Top-notch game you got going there...

If Quizz's Are Quizzical, Then What Are Test's?
Check my profile for a quick test of knowladge...
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 7th Oct 2003 18:39
My retro entry was ~2000 lines of code, but I tend to heavily comment my codez . That was a pretty small game though.

Quote: "How do I do this???? Ive tried to learn in the help files and tutorials but I hate to say it, but they stink.
If I were to make text files would they still be able to execute commands for my weapons and stuff?"


People always say the help files stink, but they were a world of good for me. Here is the basics of file reading anyway...



Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Oct 2003 03:58
major silly post. The question poser asks then decides to tell us what he thinks about large volume sof code with assumptions.

Pfft,you bloated sack of protoplasm,stimpy hand kawalski that glass of meat.

http://www.lunarpixel.com
It's already tomorrow in Australia
PoHa!84
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 8th Oct 2003 04:36
Quote: "Pfft,you bloated sack of protoplasm,stimpy hand kawalski that glass of meat."

LOL
That's hilarious man! We don't get that kind of quality of phrases on Dagobah!

Destroy you with my mind, I could!

Login to post a reply

Server time is: 2025-05-20 13:48:50
Your offset time is: 2025-05-20 13:48:50