• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Coding a game?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Whitefang

Member
Joined
Dec 19, 2011
If I were to look into coding a game, what programming language should it be in, do you guys think? I know SCAR (lol) and Java, but I've heard Java is terrible for that type of thing.

Opinions?
 
I think Java gets poor marks because of its garbage collector more than anything else. When your program has to handle real-time input from the user with minimal latency, having the garbage collector periodically make the program hiccough is bad news. That said, if you're careful with how you allocate and use memory, you can minimize the impact of the GC.

Of course, with any language you choose you'll want to be careful about something. Even in C/C++ (the usual suggestion for writing games) you'll want to be careful about your pointers lest you leak memory, derference a NULL, or perform a double-free.

JigPu
 
It really depends on the type of game you want to create. Like JigPu said Java may not be the best choice if your writing a game that is latency sensitive, like a FPS.

That being said Minecraft was write in Java.
 
Minecraft is a terrible game using that as an example is like saying flash based games are great. Dont get me wrong flash has improved tons java still sucks. I try and avoid anything requiring java on my PC. (I still use some though and just expect periodic 100% CPU usage occasionally for no reason whatsoever)

I would avoid java and flash :p Especially if you want it to run on older hardware.
 
It really depends on the type of game you want to create. Like JigPu said Java may not be the best choice if your writing a game that is latency sensitive, like a FPS.

That being said Minecraft was write in Java.

Yes, I know Minecraft was written in Java.

That's why I shy away from writing games in Java.

I'll look into C/C++.
 
Java does have benefits to it though so dont discount it completely. Portability, and durability of your game being two of the big ones. I recently decided to kick around anarchy a bit and realized I started playing that game on win 2k pro here it is win 7 time and it doesn't complain. You only job is making sure to keep to current java compatibility which is tolerably easy.
 
I've been messing around with UDK. It's geared towards shooters but oddly enough it uses UnrealScript which is based on JS.

I've not even begun to scratch the surface but I'd say Unreal3 Engine is the best engine out there regardless of whatever game you're trying to create.
 
I think what I'm going to do is work on my idea (3d tic tac toe - just a starter :p) in Java, so I know how I want it done (since I have a strong grasp of the language), and then redo it in C++ as I learn the language, so I already have the math and stuff worked out.
 
If you're just making a quick proof-of-concept, you might want to check out pygame. For more serious work, you're probably looking at something in C++ or (more and more common these days) C#.

If you aren't wanting to write your own engine and you can handle C++, and you own any of Valve's Source engine based games, you can download the Source SDK for free from Steam.

Finally, I don't think it's entirely fair to say that Minecraft's terrible performance has anything (or at least much) to do with Java. It's a homebrew game engine that does software rendering, it's bound to be much slower than the commercial titles we're used to. Notch may not have written the most efficient rendering code on the planet, either, but by now I imagine that it's pretty well streamlined.
 
Looking for some help on showing a 3d image. I want to have it built so you can rotate it any direction, and the X's and O's will always face the person. I was thinking, to figure out the orientation, that I could have two variables that changed when you dragged the mouse - if it moves right, say, the X variable increases - left and it decreases. Up, the Y value increases, down it decreases. You'd then use this and some block of code to figure out how to display the board properly.

My question is, basically, how would I go about writing this block of code? Finding out which of the six sides should be mostly showing wouldn't be difficult, but I want to be able to have it looked at from any angle. I'm going to keep thinking about it, but would love suggestions :).

Is it a limitation of the Java programming language for this? Would I find it easier in, say, C++ or C#?
 
Take a look at some general OpenGL algorithms. Your not going to be calculating what sides are showing but rather the cameras viewing angle of the entire scene.
 
What do you mean? I haven't looked at OpenGL yet, but are you saying I'd have a pre-rendered scene? If so, how would I go about doing that? I'm an utter noob to anything that doesn't involve painting using the paint{} method in Java xD.
 
If you are an utter n00b shouldn't you be looking at some ready framework first to get started? Unity? There are even some that are purely java (though Unity looked simple enough).

You'll get a grasp at what is involved without banging your head on the wall too much, and then be able to decide where you want to go in a much more informed way.

I have not tried it, but every one of my colleagues and friends who have said it's great, and most of all it's fun as you get rolling very quickly which is great for motivation in the beginning.
 
While its possible to do all the math necessary to transform a 3D scene into a 2D image, you'll just be beating your head on a rock for no good reason. Understanding the math isn't necessary most of the time, and doing all the rendering in software is going to be bog-slow.

APIs like OpenGL and DirectX let you describe your scene in terms of polygons, and then have the video card perform all the math. The basics aren't terribly hard to understand, but having to describe every single polygon can get time consuming quickly. Still, there are some sites with excellent tutorials if that's your thing.

Development kits like the the source engine SDK, UDK, Unity, or XNA provide tools to make development even easier. I haven't used one (I lost interest in game programming before I learned of their existence), but from what I understand they let you import and manipulate models, tweak scenes and lighting without having to edit code, provide templates, etc. They and the engines they run on also provide a lot of boilerplate stuff that isn't strictly related to the graphics pipeline (e.g. gravity, wall detection, keyboard/mouse input, etc.)

As dropadrop said, a development kit usually makes your life a lot easier. Of course, for something as simple as tic-tac-toe, you could easily get away with using raw OpenGL with Java.

JigPu
 
Game IDEs are great but not something that a novice should really be hastling with. This is one of those times when you will just be making it harder on yourself by not having the prerequisite coding skills and understanding of the larger applications if you start out with a game IDE.
The basics aren't terribly hard to understand, but having to describe every single polygon can get time consuming quickly.
There are open source libraries that you can use in your own programs to allow importing of 3d models created in various formats to eliminate this.
 
What would the prerequisite coding skills be? And what do you mean by "understanding of the larger applications"?
 
What I mean by understanding large applications is this. In a complex game your player generally is going to have an inventory of some sort, they also have many other properties and actions. Items in the game world have properties or actions they can utilize. You need to understand how the information is going to move around in a uniform and predictable manor so that you can calculate whats happening right now, and how the game is going to respond to the player actions. Quite often in a complex application(not just games) a block of code deep down in the pits of its structure an action will occur that will have to be handled by a totally different piece of the program which could higher, lower, or parallel to it in terms of the data structure. If you dont have a solid grasp of concepts like polymorphism, OOD, scope resolution, interfaces, and a whole mess of other concepts that have to do with 3d coordinate systems starting out with a game IDE is unnecessarily challenging, and will probably lead you to writing redundant and/or bulky code.

This is really no different than why an entry level C++ book isnt going to have you use MFC, STL, or any GUI tools(other than the debugger).


Edit. I'm not saying these things to discourage you in any way, nor am I implying that you dont know how to program. I am simply pointing out that you can learn alot more about game design and how to understand their inner workings better by making a few without an IDE so that when your ready to take on leaning a particular toolkit you will only be learning the toolkit instead of also trying to learn the fundamentals of 3d programming.
 
Last edited:
Also regarding larger applications, it's not just the internal logic. Large applications will generally have a lot of different technologies or frameworks, which need to be configured to work together. Before even getting to think of the inventory you might be stabbing yourself in the eye trying to figure out how to get Spring and Hibernate to work together (just one example)...

Regarding prerequisite, it depends a lot on what kind of person you are. Surely you will need to know the basics, but if you are not used to configuring xml things can get very annoying quickly (try to stick to technologies used a lot so you find instructions).

The idea to first do something very simple is a very good one. If you are planning on doing games in the future You should definitely start small (it's also nice to finish something once in a while).

My main point with something like Unity is that it can give you an idea of what is involved, even when stuff like gravity, rules and textures are largely assisted you will still have loads of stuff left. If you try it out, remember all the hard work is already being done. :)

And that's not to discourage you, big companies take a long time developing games with big teams of experienced programmers. Most of them started strong, but had a big urge to learn.
 
Back