I'm pretty sure this will work just as well, but has less code
Dreadnought
Posted: Thu Oct 13, 2011 1:03 pm Post subject: Re: Assistance with some Game Elements
@Demonwasp Oooooh, I don't know Java (sad, I know), but I looked at your post and code quickly and it looks really, really cool. Maybe I'll play around with it if I have enough spare time. Probably could learn quite a bit from carefully reading it carefully.
I hope it didn't seem like I was trying to duplicate someone else's work with my code (although I'm far from the beast of a project you posted). I just wanted to make a quick example for Beastinonyou.
@Raknarg Yes, I agree flexible arrays may be slightly easier to work with than a linked list and would be very effective. In fact, in the past, I have used flexible arrays to do almost exactly what I did with the list. But, I also ran into weird problems and compile-time errors when trying to manipulate the arrays in some complicated ways, though I did find ways to do what I wanted in the end. Also, I have no idea how efficient Turing is at resizing arrays (especially large ones). I guess what I mean by all this, is that either method (flexible array or linked list) will work, but I like to feel that I know what's going on in my program and I find linked lists are more straight forward for my understanding.
DemonWasp
Posted: Thu Oct 13, 2011 6:57 pm Post subject: RE:Assistance with some Game Elements
@Dreadnought: I copied most of that from everybody's CS101 course, so don't feel like you're "duplicating" anything...everyone duplicates it.
Raknarg
Posted: Thu Oct 13, 2011 7:24 pm Post subject: RE:Assistance with some Game Elements
@Dreadnought Turing was never particularily effecient in the first place. However, in comparison with other methods in turing, I find that resizing array does not seem to drag too much on speed. There are other things like pictures and massive amounts of calculations that seem to drag much more than that.
Beastinonyou
Posted: Sat Oct 15, 2011 6:07 pm Post subject: Re: Assistance with some Game Elements
Ok, I've done some reading through Cervantes 3 Part tutorial on Classes.
Obviously, other languages are "OO", so would doing my assignment using Classes, etc (OOT) be good practice and better understanding when I learn a new language later on (after end of semester).
Before I even started Turing, I tried a shot at C++ and Java, and I had no idea what the hell all it was for.. I was just memorizing stuff. But now at least I know what's going on.
At least after looking at how classes work in Turing, it makes me wonder.. Would it be better to program my game using Classes and such, and would it be easier / harder? More Code / More Efficient?
I don't know if the teacher plans on covering classes and such in class, and I've always gone above and beyond the regular lessons.
TL;DR: Should I attempt my project using classes and such (OOT), or should I just stick to the procedural stuff..
Posted: Sat Oct 15, 2011 6:50 pm Post subject: RE:Assistance with some Game Elements
Beastinonyou wrote:
Obviously, other languages are "OO", so would doing my assignment using Classes, etc (OOT) be good practice and better understanding when I learn a new language later on (after end of semester).
OO is a paradigm. Not all languages are OO, infact more aren't then are; as holds true to any other paradigms (Like Object Oriented, Scripted etc.).
Beastinonyou wrote:
At least after looking at how classes work in Turing, it makes me wonder.. Would it be better to program my game using Classes and such, and would it be easier / harder? More Code / More Efficient?
don't know if the teacher plans on covering classes and such in class, and I've always gone above and beyond the regular lessons.
Going above and beyond is definitely worth it! Ask your teacher if you are covering it, i have not gotten the privileged of having a formal instructor, so i'm not sure.
Easier/Harder really depends. If it's an RPG you will definetly want a polymorphism system. The bigger the game, the more valuable classes would [probably] become. However it's not mandatory that you use classes. I've seen some pretty good games, and high marks from people who never touched classes. It's really up to you. I don't know much about them, other than what the tutorial covered.
As far as efficiency is concerned, I'm not sure. If by Efficient you mean less time wasted and less code coded, then it would depend on what your doing.
Raknarg
Posted: Sat Oct 15, 2011 8:36 pm Post subject: RE:Assistance with some Game Elements
Classes don't make anything faster. If anything, it takes longer to import/export stuff. However, you have to consider the fact that right now you are writing programs that will be max like 3000 lines or something. All classes are for are to organize procedures and stuff to make the actual game itself easier to code.
I think that for this program, you could try classes if you like, but you probably don't actually need them.
As for your class, my teacher didn't go into them. However, it was a grade 11 class full of newbies. You could try them. In fact, you could even consider a game where it would be useful, like a tower defense.
Sponsor Sponsor
Beastinonyou
Posted: Sat Oct 15, 2011 9:46 pm Post subject: Re: Assistance with some Game Elements
Alright, I can see how classes wouldn't really be Suitable for something simple and non-complex as my project.
My class is an 11/12 split actually, and obviously, at the end of this semester, I should start spending my spare time (on my Spare in middle of the day) programming in a different language.
Now, In the college course I'll be applying to, both Java and C++ looks to be primary language focus.
A question that I'm sure has been asked a gazillion times before, which should I invest more time into? / Start to learn First?
I tried to learn both back in gr.10, but I had about much success as my grandmother would trying to learn how to use e-mail. I have also spent a good 2 weeks in C back in August.
I feel like I'm leaning more towards C++ as for the moment.
Raknarg
Posted: Sat Oct 15, 2011 10:24 pm Post subject: RE:Assistance with some Game Elements
One thing that many people dont realize, is that learning new syntax is easy, but learning ideas on a complex language is harder. I would stick to turing just so you can learn other concepts and such. Remember that people have gone to Waterloo with only knowledge of turing or less.
However, I've heard people recommending python or ruby as the next language to learn
Dreadnought
Posted: Mon Oct 17, 2011 4:10 pm Post subject: Re: Assistance with some Game Elements
I completely agree with Raknarg, you shouldn't worry too much about getting ahead for college CS classes by learning a language.
Raknarg wrote:
Remember that people have gone to Waterloo with only knowledge of turing or less.
This is true. In fact Waterloo does not even ask that students entering CS have taken the course in high school. So I wouldn't worry too much about your college program.
That being said its not a bad to learn another language and which one may not be important. I have heard that python is much easier to learn than C++ or Java.
And about the classes, everything has pretty much been said. Their real benefit is making large programs better structured and easier to work with. I doubt your teacher will introduce them in class. They are probably overkill for what your doing. (But sometimes its fun to use a chainsaw to cut a stick )
Beastinonyou
Posted: Mon Oct 17, 2011 6:54 pm Post subject: Re: Assistance with some Game Elements
Dreadnought wrote:
And about the classes, everything has pretty much been said. Their real benefit is making large programs better structured and easier to work with. I doubt your teacher will introduce them in class. They are probably overkill for what your doing. (But sometimes its fun to use a chainsaw to cut a stick )
Yea, nice analogy btw ...
I also doubt we will cover or touch anything related to classes, and for the teacher has still got quite a few concepts to cover. Tomorrow we're doing String Manipulation.
He says that surely, I'll be well-prepared for College, because a Computer Science credit in high school isn't a requirement. They assume no knowledge of programming experience.
Raknarg
Posted: Wed Oct 19, 2011 3:41 pm Post subject: RE:Assistance with some Game Elements
Well if you are going to get used to making games, classes will be an asset. If you really want to learn how to use them, go ahead and practice them