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 Professional Discussion / Compiler speed with large projects

Author
Message
Ben_UK78
15
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 29th Sep 2013 08:32
Hi All,

I am starting to write a new game and am just wondering if there is a way to speed up or manage compile times once the project starts getting larger.

My last program finished at about 35000 lines and it got to the point where compiling was taking a large portion of the testing time - even though for testing purposes I was creating exes with no media.

Is there any way at all to speed up the compile times, either by opting to not compile everything and keep files that normally end up in the exe (would need to be for installations on other machines) in the game folder, or through any other means at all? Can the compiler be optimised for my machine - are there are options for speeding it up etc? Or anything on the project design side akin to something like how Unreal Engine does it where you don't compile the whole thing every time. Anything at all really...

Thanks for any help.
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 29th Sep 2013 10:46 Edited at: 29th Sep 2013 10:48
35k lines of code is quite impressive.
it also kinda weird.
why weird? "im starting to write a new game" and already 35k lines of code?

people finishing large projects with just 10k lines of code.
i suggest you to check your code and see if you can modify it

if you asking if there is a faster way to compile 35k lines of code?
then the answer is no.

but you can modify your code into smaller.
how?
use scripts and external files.
so when the game starts, he will get the database out of the file..

for example.
if you puting 10000 objects in the map, and those 10k objects takes 10k lines of code, you can minimize it to maximum 50 lines of code
how?
simple, make a reading engine from your exe that opens a text file and reads the next lines:

"LoadObj: MyObj.x"
"PosObj: X, Y, Z"
"RotObj: X, Y, z"
and so on.

And in DBP, all you do is:
Load from file "myfile.txt"
repeat
if Text$ = "LoadObj" then load object Text2$,FreeObj()
...
until EoF

so basicly you will save compile time, you will save load time and you will save space.

thats the smartest way to do coding.
scripts are usefull all the time

i hope i helped, Good Luck.

Stream SnifferTools/Plugins/Models/Games and more!
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 29th Sep 2013 17:07
Quote: ""im starting to write a new game" and already 35k lines of code?"

Quote: "My last program finished at about 35000 lines"


I think you read it wrong.

http://mattsmith.carbonmade.com/
Ben_UK78
15
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 29th Sep 2013 19:33 Edited at: 29th Sep 2013 19:37
Hi All,

Indeed, it was my last project that came to 35000 lines- not this one.

This one currently stands at about 200 lines.

The last project I wrote was a server client system for capturing data from an industrial activity and allowing it to be displayed on a large screen in a company HQ. The industrial activity is mobile, so our company, which handles 24hr data collection and monitoring onsite needed a way to send a screen image to the company HQ. It is near impossible to easily connect into the site, but we have internet access out easily enough (i.e. to BBC News etc)- and if not can do it using a personal dongle. I could have just sent the screen image, but wanted the bandwidth to be low so my program just sends the 20 or so data channels every few seconds and both displays the values and plots the chart lines at the company HQ. It grew to 35000 lines as I made it do some cool stuff. Some of our competitor companies provide something similar, but it is often just a screen image - mine synchronises the database stored on site with the HQ so when the internet goes down once it comes back up they can see what we did and look at values, come in in the morning as scroll back over the past 24 hours (they can actually scroll back the whole project if they want, easily going back 100 days or half a year or whatever).

I also added a login system so that people with the client can login and view the past 24 hours from home. Plus networking tools so I can login from home, or from site, and view who is logged on, change authorisations, backup data at locations across the network, restart it for new projects remotely and do various troubleshooting.

Hence 35000 lines of code.

However, by the end the compile times were annoyingly long. I tried C++ (using Dark GDK I think) and when I hit compile it was near instant. From reading it seems that Dark Basic builds larger exes than C++. Is it possible to cut this back by putting the files it automatically puts into the exe in the run directory while I am building the project?

It seems Dark Basic builds an exe that will run outside of the programming environment (out of my build directory) out of the box, so to speak. I don't really need that. While I am building the project I need as fast a compile time as I can get. I can worry about the exe working outside of the build directory at the end of the project.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th Sep 2013 14:05
As Sergey said, try to externalise as much as possible either through scripts or configuration files. This should eliminate the need to recompile when you're changing small details.

Quote: "However, by the end the compile times were annoyingly long. I tried C++ (using Dark GDK I think) and when I hit compile it was near instant. From reading it seems that Dark Basic builds larger exes than C++. Is it possible to cut this back by putting the files it automatically puts into the exe in the run directory while I am building the project?"


C++ will only recompile the files that have been modified. DBP on the other hand always recompiles everything.

TheComet

Can I bother you for a glass of water? I'm feeling a little horse.
Ben_UK78
15
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 1st Oct 2013 00:48
Thanks very much Comet.

I'm not going to claim to be the best programmer ever. I have toyed with UnrealScript and the Unreal Development Kit (UDK). Using that feels alot like injecting variables into already completed functions and overloading various bits of functions. All good and very quick since the whole lot is not being compiled each time, which would not doubt be a big task.

I liked the approach of that.

Can I write a project using that sort of methodology at all? I often keep test variables in a text file and load them from it so I don't have to recompile every time.

Can I ask a silly question and ask about scripts? How would I program in that way with DBP? I feel like I don't even know what you guys mean in relation to DBP. I can imagine it with UDK and UnrealScript.
Ben_UK78
15
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 1st Oct 2013 03:30
Well, that ended up being a silly question. Playing with examples from the codebase some code from Panther's had multiple files. I have never kept functions in other files to my main file before.

If I can, just a couple of quick questions:

1) I am right in going to File>New>File (Add to Project) to add files in this manner?

2) Are all functions and variables considered global in terms of these files (modules)

3) Is there anything that I need to be cautious about when programming in this way (i.e splitting code into different files)?

4) When I compile is it just compiling the file (module) I am in, or is it compiling every open file (module). If it is just the one I am in then this will be a much quicker way to organise and compile code and I have been silly not to realise I can program in this modular manner.

5) Is this what Sergey meant by scripts? Am I write in thinking of these files more as modules?
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 1st Oct 2013 03:48
4) Sadly no. DBpro bundles all the sources code up into one big file then compiles it. So using includes doesn't help the situation.

5) Nah. Have a look for a plug in called unity (or something like that) which is a plug in wrapper of LUA scripting engine. There's a few LUA base plug in's from memory for Dbpro, but i've no idea which one is best or the most complete.

Login to post a reply

Server time is: 2026-07-06 10:36:01
Your offset time is: 2026-07-06 10:36:01