Advertisement

Is it possible that I just simply lack the required intelligence?

Started by August 13, 2014 01:20 AM
11 comments, last by cooljava50544 10 years, 5 months ago

I've been trying to use JMonkey Engine 3.0 to develop a simple tower defense game. I am only using cubes, and you select on a tower and press c to give it ammo. The bullets are just simple lines. There are so many problems in my code. I've been studying a java for about 8 months, and I am starting to feel discouraged. I'm actually following an exercise from my book, and I am confused as heck. The reason why I say that is because I can't seem to figure out how to debug my code. There's stupid stuff like when the cube-shaped enemy reaches the base, and it's z position is less than zero it will disappear, but it doesn't. I've been stuck on this for days.

Could I get any friendly and honest advice? Thanks biggrin.png

I've been trying to use JMonkey Engine 3.0 to develop a simple tower defense game. I am only using cubes, and you select on a tower and press c to give it ammo. The bullets are just simple lines. There are so many problems in my code. I've been studying a java for about 8 months, and I am starting to feel discouraged. I'm actually following an exercise from my book, and I am confused as heck. The reason why I say that is because I can't seem to figure out how to debug my code. There's stupid stuff like when the cube-shaped enemy reaches the base, and it's z position is less than zero it will disappear, but it doesn't. I've been stuck on this for days.

Could I get any friendly and honest advice? Thanks biggrin.png


First of all, no you do not lack the required intelligence, 8 months is no time at all when it comes to programming and there really is no such thing as a "simple tower defense game" (Its not normally the type of game we would recommend for beginners due to the complexity involved).

I would recommend getting familiar with whatever debugger your IDE includes (here is a guide for eclipse: http://www.vogella.com/tutorials/EclipseDebugging/article.html ).

If you still struggle you could post the relevant code here and ask for more specific advice.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Advertisement

I've been trying to use JMonkey Engine 3.0 to develop a simple tower defense game. I am only using cubes, and you select on a tower and press c to give it ammo. The bullets are just simple lines. There are so many problems in my code. I've been studying a java for about 8 months, and I am starting to feel discouraged. I'm actually following an exercise from my book, and I am confused as heck. The reason why I say that is because I can't seem to figure out how to debug my code. There's stupid stuff like when the cube-shaped enemy reaches the base, and it's z position is less than zero it will disappear, but it doesn't. I've been stuck on this for days.

Could I get any friendly and honest advice? Thanks biggrin.png


First of all, no you do not lack the required intelligence, 8 months is no time at all when it comes to programming and there really is no such thing as a "simple tower defense game" (Its not normally the type of game we would recommend for beginners due to the complexity involved).

I would recommend getting familiar with whatever debugger your IDE includes (here is a guide for eclipse: http://www.vogella.com/tutorials/EclipseDebugging/article.html ).

If you still struggle you could post the relevant code here and ask for more specific advice.

I believe pretty much everything is screwed up. Should I just post all of my written code? And thanks for making me feel better :d

I've been trying to use JMonkey Engine 3.0 to develop a simple tower defense game. I am only using cubes, and you select on a tower and press c to give it ammo. The bullets are just simple lines. There are so many problems in my code. I've been studying a java for about 8 months, and I am starting to feel discouraged. I'm actually following an exercise from my book, and I am confused as heck. The reason why I say that is because I can't seem to figure out how to debug my code. There's stupid stuff like when the cube-shaped enemy reaches the base, and it's z position is less than zero it will disappear, but it doesn't. I've been stuck on this for days.

Could I get any friendly and honest advice? Thanks biggrin.png


First of all, no you do not lack the required intelligence, 8 months is no time at all when it comes to programming and there really is no such thing as a "simple tower defense game" (Its not normally the type of game we would recommend for beginners due to the complexity involved).

I would recommend getting familiar with whatever debugger your IDE includes (here is a guide for eclipse: http://www.vogella.com/tutorials/EclipseDebugging/article.html ).

If you still struggle you could post the relevant code here and ask for more specific advice.

I believe pretty much everything is screwed up. Should I just post all of my written code? And thanks for making me feel better biggrin.png


Its probably best if you only post the classes / methods that you are having trouble with as more people will be able/willing to help if they don't have to read through massive amounts of code first, (You could put a zip with your full code on some online filehost and link to it aswell though if you want people to be able to help you debug things)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

With programming, its not about intelligence but more about patience and expierience, and finding help / solutions.

Of course problem solving will be easier for mister brainiac, but even his genious brain will not achieve much on his own. Even he will have to ask fellow programmers or big brother google from time to time when he certainly will get stuck on a problem. He could brood over it for years and maybe find a solution thanks to his incredible intelligence... or he asks other people that might have come across it and solve it in days.

Point is: if you get stuck, and really tried everything you could, google it, ask on forums, sleep over it, do something else for some time... in no particular order other than googling before asking on forums.

Now, debugging. Best thing is to use a debugger (as already pointed out), given you develop in IDE (Eclipse, Netbeans, whatever), you will have one built in. You can also find Java Debuggers on the net standalone AFAIK.

Next best thing, though uglier, is to build in debug log statements. Frameworks like log4j or similar will make it easy for you to print out strings to console, but define a log level. This way you can print out something with the DEBUG log level, which will be activated by default during development, but switched off for your final build.

I believe pretty much everything is screwed up. Should I just post all of my written code? And thanks for making me feel better biggrin.png

Saying that "pretty much everything is screwed up" is too vague and unspecific. As the others have pointed out, carefully debug your code, figure out exactly where things behave different than what you had in mind, and fix the bugs. If you don't know how to debug, learn it ASAP - more than a useful skill to have, you absolutely *need* it in order to improve.

Posting code is fine *after* you've done all you can to fix it on your own, otherwise it's just trying to outsource the debugging to somebody else.

And don't give up.

Advertisement
Like the above, you need to be able to debug the code, and use break points.
You simply put a break point on the code that checks the position, and when the square is near the correct position you can single step through the code and see what's happening with your variables.
If you have no debugger, then you'll have find out how to use one, because it is the tool you need.
Making you code neat and readable, with decent variable names helps a lot as well.
Also, when you find mistakes in your code, think if theres anything you can change in the way you code stuff to avoid similar mistakes in the future.
The whole point of many language features and coding practises is to prevention bugs and keep everything simple, so focus on that.

o3o

Everything that everyone has said is so true.

Every good IDE has a debugger built in and as a programmer that debugger is your best friend, so many times I've been struggling with bugs at work in code that *looks* or "feels" right until you are stepping through and seeing that blasted int of 3 should actually be a float of 3.12 and that's throwing this calculation off. Once you have learnt how to use a debugger you will hate every moment that you have to test or replicate an issue/problem without one. (E.G. deploying to customers' sites where a debugger isn't available)

Practice - another huge thing. I've been coding/programming (PHP to start, Java, C#, C++ (a little)) for 11 years and even now I look back at code I wrote as little as 6months ago and think what the hell was I thinking but at the time that the was the best way *I* knew how but in the time since I've learnt better practices, styles and even better ways to use the language I'm developing in but it takes TIME and PATIENCE to learn.

I've been studying a java for about 8 months, and I am starting to feel discouraged.


It takes many students 4 years of dedicated study in a university to barely be able to qualify for a decent internship or entry-level job in the games industry.

If learning to program where all that easy, everyone would do it and we'd all be making minimum wage. Learning any skill requires the same process: persevere, practice constantly, and don't be afraid to ask for help when you're stuck. smile.png

Sean Middleditch – Game Systems Engineer – Join my team!

This topic is closed to new replies.

Advertisement