
-----------------------------------
Windsurfer
Sun Oct 22, 2006 3:55 pm

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.

-----------------------------------
Clayton
Sun Oct 22, 2006 7:18 pm


-----------------------------------
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" :lol:

Nice to see that you decided to post the source though. Heres another Well done! Good Job on Forces :D

-----------------------------------
BenLi
Mon Oct 23, 2006 4:26 pm


-----------------------------------
Pic.Blur? i'm using 4.0.5 which is the newest version at the time forces was released. Wanna give the .tu source?

-----------------------------------
Windsurfer
Mon Oct 23, 2006 4:42 pm


-----------------------------------
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.

-----------------------------------
Carey
Tue Oct 24, 2006 12:12 pm


-----------------------------------
where the heck did you get turing 4.1?

my school doesnt have it and i cant find anywhere to download it

-----------------------------------
Windsurfer
Tue Oct 24, 2006 3:24 pm


-----------------------------------
I purchased a fully licensed copy from my local Holtsoft distributor.

-----------------------------------
petree08
Thu Oct 26, 2006 8:23 am


-----------------------------------
yeah this program is really sweet

-----------------------------------
iamcow
Thu Oct 26, 2006 4:48 pm


-----------------------------------
yeah strange, my school has it but they don't have the distribution copy yet

-----------------------------------
Mr. T
Sat Oct 28, 2006 1:01 am

Alex's Opinion
-----------------------------------
I purchased a fully licensed copy from my local Holtsoft distributor.
lol. sucha model citizen.  :lol:

-----------------------------------
blaster009
Sat Oct 28, 2006 6:48 pm


-----------------------------------
Haha...Bit Torrent FTW.

-----------------------------------
Windsurfer
Sat Oct 28, 2006 6:59 pm


-----------------------------------
"Purchased" is such a... vague term :lol: 
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?

-----------------------------------
Clayton
Sat Oct 28, 2006 8:46 pm


-----------------------------------
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 :D

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)

-----------------------------------
Tony
Sat Oct 28, 2006 10:00 pm


-----------------------------------
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.

-----------------------------------
md
Sat Oct 28, 2006 10:48 pm


-----------------------------------
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.

-----------------------------------
Andy
Sun Oct 29, 2006 4:57 am


-----------------------------------
honestly guys, we should just build a turing compiler that's platform independent. it wouldnt be that hard.

-----------------------------------
Tony
Sun Oct 29, 2006 12:31 pm


-----------------------------------
and write a wapper to have Draw. module render in OpenGL :D Brillaint!

-----------------------------------
ericfourfour
Sun Oct 29, 2006 1:55 pm


-----------------------------------
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.

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.

-----------------------------------
md
Sun Oct 29, 2006 4:37 pm


-----------------------------------
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.

-----------------------------------
ericfourfour
Sun Oct 29, 2006 7:02 pm


-----------------------------------
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.

-----------------------------------
Clayton
Sun Oct 29, 2006 9:26 pm


-----------------------------------
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?

-----------------------------------
Tony
Sun Oct 29, 2006 11:38 pm


-----------------------------------
well we've had some bad experiences with group projects before. :? 

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.

-----------------------------------
[Gandalf]
Sun Oct 29, 2006 11:45 pm


-----------------------------------
well we've had some bad experiences with group projects before. :? 

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.

[url=http://www.compsci.ca/v2/viewtopic.php?t=11558]This interested me, and afaik he did actually have a start, but...  nothing in the end.

-----------------------------------
ericfourfour
Mon Oct 30, 2006 12:20 am


-----------------------------------
Here are a few useful links (Yay, Google!):
Complilers [url=http://www.compilers.net/paedia/compiler/index.htm]here and [url=http://en.wikipedia.org/wiki/Compiler]here. Parsing [url=http://en.wikipedia.org/wiki/Parsing]here. I didn't read over them because its late but I'm sure they will prove useful.

-----------------------------------
Tony
Mon Oct 30, 2006 9:22 am


-----------------------------------
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.. at least to extract variable declarations.

-----------------------------------
Andy
Mon Oct 30, 2006 1:50 pm


-----------------------------------
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.

-----------------------------------
ericfourfour
Mon Oct 30, 2006 5:20 pm


-----------------------------------
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.

-----------------------------------
Windsurfer
Mon Oct 30, 2006 5:37 pm


-----------------------------------
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 :)

-----------------------------------
Windsurfer
Wed Nov 01, 2006 5:17 pm


-----------------------------------
[url=http://www.garagegames.com/products/torque/x/] XNA studios, anyone? I'm going for it. Going to remake Forces for Xbox arcade.

-----------------------------------
Silent Avenger
Wed Nov 01, 2006 7:20 pm


-----------------------------------
That would be cool to play Forces on an xbox 360.
