Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Forces Source Code
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tony




PostPosted: Sun Oct 29, 2006 12:31 pm   Post subject: (No subject)

and write a wapper to have Draw. module render in OpenGL Very Happy Brillaint!
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: Sun Oct 29, 2006 1:55 pm   Post subject: (No 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.
md




PostPosted: Sun Oct 29, 2006 4:37 pm   Post subject: (No 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.
ericfourfour




PostPosted: Sun Oct 29, 2006 7:02 pm   Post subject: (No 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.
Clayton




PostPosted: Sun Oct 29, 2006 9:26 pm   Post subject: (No 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?
Tony




PostPosted: Sun Oct 29, 2006 11:38 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
[Gandalf]




PostPosted: Sun Oct 29, 2006 11:45 pm   Post subject: (No 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.
ericfourfour




PostPosted: Mon Oct 30, 2006 12:20 am   Post subject: (No 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.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Oct 30, 2006 9:22 am   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Andy




PostPosted: Mon Oct 30, 2006 1:50 pm   Post subject: (No 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.
ericfourfour




PostPosted: Mon Oct 30, 2006 5:20 pm   Post subject: (No 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.



Player_Proc.t
 Description:

Download
 Filename:  Player_Proc.t
 Filesize:  9.47 KB
 Downloaded:  179 Time(s)


Sparkle_Proc.t
 Description:
I did two now someone to the other 5 million.

Download
 Filename:  Sparkle_Proc.t
 Filesize:  4.7 KB
 Downloaded:  196 Time(s)

Windsurfer




PostPosted: Mon Oct 30, 2006 5:37 pm   Post subject: (No 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
Windsurfer




PostPosted: Wed Nov 01, 2006 5:17 pm   Post subject: (No subject)

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




PostPosted: Wed Nov 01, 2006 7:20 pm   Post subject: (No subject)

That would be cool to play Forces on an xbox 360.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 29 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: