Computer Science Canada

Forces Source Code

Author:  Windsurfer [ Sun Oct 22, 2006 3:55 pm ]
Post subject:  Forces Source Code

All right, that's it; I've decided to release the source. It will be here for all to see. All my months of work, in one tiny zip file.

Please keep in mind that different portions were written under different circumstances and levels of knowledge of Turing.

If someone would like to convert this into a cross-platform language, please do so! It would be much appreciated.

I have changed the code so that it's small. There are two folders included, one named music, and the other background. You can put .mp3s files into the music one and .jpg files into background, and they will work in the game, switching at random.

Author:  Clayton [ Sun Oct 22, 2006 7:18 pm ]
Post subject: 

Just finished looking through ALL of the source and WOW, that is a lot of work (love the way you did your lightning bolts too, I never would be able to do that...) now i can see why forces was so good. I love the warnings that you used during particularily "rough" segments of code.

"Warning the following code is [bad] as it was done at crunch time, it works and thats all that matters" Laughing

Nice to see that you decided to post the source though. Heres another Well done! Good Job on Forces Very Happy

Author:  BenLi [ Mon Oct 23, 2006 4:26 pm ]
Post subject: 

Pic.Blur? i'm using 4.0.5 which is the newest version at the time forces was released. Wanna give the .tu source?

Author:  Windsurfer [ Mon Oct 23, 2006 4:42 pm ]
Post subject: 

Its turing 4.1 and was a late feature. You can delete the line and it will run fine. However, i put the source here for ppl to look at, mainly. Thank you, to those who do.

Author:  Carey [ Tue Oct 24, 2006 12:12 pm ]
Post subject: 

where the heck did you get turing 4.1?

my school doesnt have it and i cant find anywhere to download it

Author:  Windsurfer [ Tue Oct 24, 2006 3:24 pm ]
Post subject: 

I purchased a fully licensed copy from my local Holtsoft distributor.

Author:  petree08 [ Thu Oct 26, 2006 8:23 am ]
Post subject: 

yeah this program is really sweet

Author:  iamcow [ Thu Oct 26, 2006 4:48 pm ]
Post subject: 

yeah strange, my school has it but they don't have the distribution copy yet

Author:  Mr. T [ Sat Oct 28, 2006 1:01 am ]
Post subject:  Alex's Opinion

Windsurfer wrote:
I purchased a fully licensed copy from my local Holtsoft distributor.

lol. sucha model citizen. Laughing

Author:  blaster009 [ Sat Oct 28, 2006 6:48 pm ]
Post subject: 

Haha...Bit Torrent FTW.

Author:  Windsurfer [ Sat Oct 28, 2006 6:59 pm ]
Post subject: 

"Purchased" is such a... vague term Laughing
But i know they were distributing Holtsoft software.

But honestly. Has only one person glanced at this code? Or have all the downloads simply been to play the game?

Author:  Clayton [ Sat Oct 28, 2006 8:46 pm ]
Post subject: 

Now that I've had time to take a good thourough look at the code i have a couple of comments:

1)Package related procedures in a module, instead of just having your procedures crammed in some random include file, create a module to package procedures/functions in. It's a good thing to do to help with the organization of your code Very Happy

2)Make your particle (sparkle) engine a class. This way you will once again get the advantage of organization, plus the ability to have greater control over what goes on, depending on how you code it.

If you don't know how to do either/or of these things, check out the Turing Walkthrough for the tutorials on them (that is if you're interested in improving Forces)

Author:  Tony [ Sat Oct 28, 2006 10:00 pm ]
Post subject: 

sorry, I've been meaning to play around with your code, but as you know I don't exactly have a Windows machine to run Turing on.

Author:  md [ Sat Oct 28, 2006 10:48 pm ]
Post subject: 

I too am interested, but without any way of running my yet to be aquired version of turing on linux I haven't downloaded it.

Author:  Andy [ Sun Oct 29, 2006 4:57 am ]
Post subject: 

honestly guys, we should just build a turing compiler that's platform independent. it wouldnt be that hard.

Author:  Tony [ Sun Oct 29, 2006 12:31 pm ]
Post subject: 

and write a wapper to have Draw. module render in OpenGL Very Happy Brillaint!

Author:  ericfourfour [ Sun Oct 29, 2006 1:55 pm ]
Post subject: 

I suggest next time try using OOP. It will greatly reduce the amount of lines you wrote.

Two more things. Don't use global variables and I realize it was crunch time but the main loop shouldn't be over 100 lines long (that is the size of a small particle system)! For the main loop I would suggest get input, think, then render. Its even easier if everything is an object because then you could derive a get input method, a think method, and a render method and simply cycle through every object and call each of these methods.

code:
main loop
    cycle through every object
        get input, think, render, other stuff regarding the objects
    check if the main loop should exit


I'm no expert but this seems like a pretty easy way to organize your code.

Author:  md [ Sun Oct 29, 2006 4:37 pm ]
Post subject: 

Andy wrote:
honestly guys, we should just build a turing compiler that's platform independent. it wouldnt be that hard.


Well start! Get the basic compiler done and I'm sure other people will help out with writing code for the standard library. I've already got a project on the go... but if someone actually does this I may help out.

Author:  ericfourfour [ Sun Oct 29, 2006 7:02 pm ]
Post subject: 

I'd definitely help out. Although, if your going to use openGL you might as well allow dll's. Otherwise, just stick to SDL for simplicity.

Author:  Clayton [ Sun Oct 29, 2006 9:26 pm ]
Post subject: 

Indeed, an independent Turing compiler would be a good thing to have. If this thing gets started, let me know!

*thinks to himself* - the beginnings of the next-gen dev team?

Author:  Tony [ Sun Oct 29, 2006 11:38 pm ]
Post subject: 

well we've had some bad experiences with group projects before. Confused

This is certanly a project that I would back up and do my best to contribute to, but I know just about nothing about making compilers. There's a bunch of other complicated parts such as syntax parsing, and debugers and what not.

I understand that there could be a lot of excitement about such project, but we would need a couple of very knowledgable developers for lead to carry this project though.

Author:  [Gandalf] [ Sun Oct 29, 2006 11:45 pm ]
Post subject: 

Tony wrote:
well we've had some bad experiences with group projects before. Confused

This is certanly a project that I would back up and do my best to contribute to, but I know just about nothing about making compilers. There's a bunch of other complicated parts such as syntax parsing, and debugers and what not.

I understand that there could be a lot of excitement about such project, but we would need a couple of very knowledgable developers for lead to carry this project though.

Exactly. I'd be glad to help with any SDL or library porting, but the actual coding of a compiler is beyond me.

This interested me, and afaik he did actually have a start, but... nothing in the end.

Author:  ericfourfour [ Mon Oct 30, 2006 12:20 am ]
Post subject: 

Here are a few useful links (Yay, Google!):
Complilers here and here. Parsing here. I didn't read over them because its late but I'm sure they will prove useful.

Author:  Tony [ Mon Oct 30, 2006 9:22 am ]
Post subject: 

It might be possible to simply (simpler?) compile Turing's syntax into standard C (that _should_ be cross-platform) and package the program with GCC

(as oppose to Turing's lexer parser and VC++ compiler)

That would actually be something I could contribute to at every level. And we bypass this huge task of creating our own cross-platform compiler (which is on a magnitude of a 4th year project I would imagine)

Btw, wtd has already showed how to [url=compsci.ca/v2/viewtopic.php?t=6712]parse Turing with regular expressions[/url].. at least to extract variable declarations.

Author:  Andy [ Mon Oct 30, 2006 1:50 pm ]
Post subject: 

writing a compiler isnt very hard. it's time consuming, but the theory behind it is quite easy to pick up. I took a compiler course last term, and the language used contained pointers, and subroutines; add oop, and a couple of functions and bam we'll have turing.

I dont know much about OGL since i'm mainly doing DX now days.. will try to pick it up in a few weeks tho.

I too, like cornflakes have other projects that needs attending to, so if someone else wants to start it sooner, by all means go ahead and i'll contribute as much as i could.

Author:  ericfourfour [ Mon Oct 30, 2006 5:20 pm ]
Post subject: 

Back on topic.

In Sparkle_Proc.t you had two closely related procedures which basically repeated the same lines. These were Mk_Spkl and Mk_Spkl_Custom. For your Mk_Spkl procedure it could have simply called the Mk_Spkl_Custom with the special values it has. That would have saved you around 21 lines.

Also, you are writing the distance formula every time you use it. Instead, just have a method that does it for you. It will greatly reduce the amount of characters you type. On that note the times you were using the distance formula the only deference between each of them was sparkle id number so a simplified distance function that only requires a sparkle id would work well.

These are just a few suggestions. I went through your code and used /**/ for comments where I made changes or where it can be improved.

Here is the new source files for Sparkle_Proc and Player_Proc.

Author:  Windsurfer [ Mon Oct 30, 2006 5:37 pm ]
Post subject: 

Thanks a lot!

Now, i really appreciate the commentary, but i did begin writing this only after two months of Turing. And, actually, in the global_proc.t I do have a Pt_Dist function, but i only used it later in my Turing learning.
And on the subject of those two procedures... Mk_Sparkle was the original, and the _Custom one only came nearing the end, and is only used for the specials. I know that Mk_Sparkle should use the custom procedure, but again, learning curve. I was wrong, and I messed up, but I didn't fix it.
I could continue on and analyze all 5500 lines of code, here, and probably find 1000 coding errors. But thank you for your commentary and input Smile

Author:  Windsurfer [ Wed Nov 01, 2006 5:17 pm ]
Post subject: 

XNA studios, anyone? I'm going for it. Going to remake Forces for Xbox arcade.

Author:  Silent Avenger [ Wed Nov 01, 2006 7:20 pm ]
Post subject: 

That would be cool to play Forces on an xbox 360.


: