Notices

Overclockers Forums > Software > Programming Tips and Tricks
Programming Tips and Tricks
Forum Jump

Coding a game?

Post Reply New Thread Subscribe Search this Thread
 
 
Thread Tools
Old 04-19-12, 08:47 PM Thread Starter   #1
Whitefang
Member



Join Date: Dec 2011

 
Coding a game?


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?
Whitefang is offline   QUOTE Thanks
Old 04-19-12, 09:46 PM   #2
JigPu
Inactive Pokémon Moderator

 
JigPu's Avatar 

Join Date: Jun 2001
Location: Vancouver, WA

10 Year Badge
 
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

__________________
.... ASRock Z68 Extreme3 Gen3
.... Intel Core i5 2500 ........................ 4 thread ...... 3300 MHz ......... -0.125 V
2x ASUS GTX 560 Ti ............................... 1 GiB ....... 830 MHz ...... 2004 MHz
.... G.SKILL Sniper Low Voltage ............. 8 GiB ..... 1600 MHz ............ 1.25 V
.... OCZ Vertex 3 ................................. 120 GB ............. nilfs2 ..... Arch Linux
.... Kingwin LZP-550 .............................. 550 W ........ 94% Eff. ....... 80+ Plat
.... Nocuta NH-D14 ................................ 20 dB ..... 0.35 C°/W ................ 7 V


"In order to combat power supply concerns, Nvidia has declared that G80 will be the first graphics card in the world to run entirely off of the souls of dead babies. This will make running the G80 much cheaper for the average end user."
"GeForce 8 Series." Wikipedia, The Free Encyclopedia. 7 Aug 2006, 20:59 UTC. Wikimedia Foundation, Inc. 8 Aug 2006.
JigPu is offline   QUOTE Thanks
Old 04-19-12, 10:00 PM   #3
cliffboss
Member



Join Date: Aug 2004
Location: Canada

 
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.

__________________
Game Rig : Windows 7 Pro SP1
AMD Phenom II X6 1100T, Asus M4A89GTD PRO/USB3, 8GB Mushkin Enhanced Blackline Frostbyte DDR3-1600, XFX Radeon HD 6950 2GB, 1x 120GB OCZ Vertex, 1x Seagate Barracuda 7200.10 500GB, LG 16x DVD RW, Corsair Graphite Series 600T, Corsair HX 850watt, Zalman CNPS9900A


Server : FreeBSD 8.2
Intel E6600, Asus P5B Deluxe, 2GB OCZ PC-7200 Spec Ops, Asus 260GTX 896MB, 1x Western Digital 640GB, 4x Western Digital Green 2TB in RAIDZ1, Norco RPC-470 4U, Enermax Liberty 500watt
cliffboss is offline   QUOTE Thanks
Old 04-19-12, 10:07 PM   #4
Neuromancer
Member

 
Neuromancer's Avatar 

Join Date: Oct 2005
Location: Tau'ri

 
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.

__________________
All rants I produce are sole property of 127.0.0.1.
10 types of people understand binary.
Suck iiiiiitttttttttt. -Shawn Spencer
Linux is the stepchild of the OS world. "You told me to set 192.168.0.266 ip address", okay >>>Kernel PANIC - Me
Neuromancer is offline Benching Profile Heatware Profile   QUOTE Thanks
Old 04-19-12, 10:44 PM Thread Starter   #5
Whitefang
Member



Join Date: Dec 2011

 
Quote:
Originally Posted by cliffboss View Post
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++.
Whitefang is offline   QUOTE Thanks
Old 04-19-12, 11:09 PM   #6
ssjwizard
Has slightly less legible writing
than Thideras, Member

 
ssjwizard's Avatar 

Join Date: Mar 2002
Location: Rio Rancho, NM

10 Year Badge
 
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.

__________________
Life is what you make of it, we exist for the sole purpose of existing. Dont waste the universe efforts!
All statements, imagery, and ideas contained within any posts are merely retold tales of fictional acts by a figment of the universe imagination.

So your looking for an AMD FX motherboard, things you need to know. Whats the max safe temps/volts for an FX?

Green Gorilla, CM 690-II nVidia, FX 8320, GTX 670, liquid cooled
Liquid Fusion, CM 690-II, A8+6670 Dual GFX, liquid cooled
Extreme evaporative water loop 450mm^3 water cooled beast - Incomplete
ssjwizard is offline Benching Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 04-20-12, 11:38 AM   #7
Nechen
Member

 
Nechen's Avatar 

Join Date: Dec 2009

 
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.

__________________
-Gigabyte Z68 UD4
-i5 2500k Sandy Bridge @ 4.5Ghz
-16GB Corsair Vengeance DDR3-1600 9-9-9-24
-eVGA GTX 560 Ti
-Antec 750w TruPower

-Western Digital 1.0 TB AAJS 7,200RPM
-OCZ Vertex III 120GB SSD x2 (RAID-0)
Nechen is offline   QUOTE Thanks
Old 04-20-12, 12:09 PM   #8
jameseboy

 
jameseboy's Avatar 

Join Date: Nov 2010
Location: Livingston, Scotland

 
c++ is a good place to start, have a look at the irrlicht rendering engine. It was used in quake3, and has a load of tutorials in the library.

__________________
Daily Rig // i5 2500K @4.5ghz 1.34v // Asus P8Z68-v Pro // 8GB Samsung Green Ram 1866mhz // H100/CoolerMaster Fans // Samsung BluRay Reader // MSI Power Edition gtx670 oc // 2TB Spinpoint F4 (storage), 750GB Spinpoint F3 (Games & Apps) // Crucial m4 128GB (Boot Win8 w/ mods) //
Laptop/HP pavilion DV6 // AMD turion 2.3Ghz // 4GB corsair Vengeance // AMD HD5470 // 500GB Spinpoint M8 // WIN7
LanRig/Personal Server/Htpc // Pentium G850 @ 3ghz // MSI Z68A-G43 // Corsair XMS3 4Gb 1600Mhz & 8Gb Corsair Vengeance (2 x 4GB 1600) // Stock Cooler // Samsung DVD Writer // MSI Cyclone gtx 460 1Gb // WD Blue & Green 250 GB drives //

Open Acrylic Bench/HTPC -- MY OLD CM690 --Super Clean htpc/lan rig/ personal Server [WIP]--
Steam = Jameseboy57 Origin = jameseboy57

jameseboy is offline Benching Profile   QUOTE Thanks
Old 04-20-12, 03:35 PM Thread Starter   #9
Whitefang
Member



Join Date: Dec 2011

 
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.
Whitefang is offline   QUOTE Thanks
Old 04-20-12, 04:59 PM   #10
jameseboy

 
jameseboy's Avatar 

Join Date: Nov 2010
Location: Livingston, Scotland

 
The first game i built was connect 4, and we had to do it in javascript.... that was not fun.

__________________
Daily Rig // i5 2500K @4.5ghz 1.34v // Asus P8Z68-v Pro // 8GB Samsung Green Ram 1866mhz // H100/CoolerMaster Fans // Samsung BluRay Reader // MSI Power Edition gtx670 oc // 2TB Spinpoint F4 (storage), 750GB Spinpoint F3 (Games & Apps) // Crucial m4 128GB (Boot Win8 w/ mods) //
Laptop/HP pavilion DV6 // AMD turion 2.3Ghz // 4GB corsair Vengeance // AMD HD5470 // 500GB Spinpoint M8 // WIN7
LanRig/Personal Server/Htpc // Pentium G850 @ 3ghz // MSI Z68A-G43 // Corsair XMS3 4Gb 1600Mhz & 8Gb Corsair Vengeance (2 x 4GB 1600) // Stock Cooler // Samsung DVD Writer // MSI Cyclone gtx 460 1Gb // WD Blue & Green 250 GB drives //

Open Acrylic Bench/HTPC -- MY OLD CM690 --Super Clean htpc/lan rig/ personal Server [WIP]--
Steam = Jameseboy57 Origin = jameseboy57

jameseboy is offline Benching Profile   QUOTE Thanks
Old 04-20-12, 09:01 PM   #11
pcarini
Member



Join Date: Nov 2008

 
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.

__________________
"We can't stop here, this is bat country!"
pcarini is offline   QUOTE Thanks
Old 04-20-12, 09:17 PM Thread Starter   #12
Whitefang
Member



Join Date: Dec 2011

 
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#?
Whitefang is offline   QUOTE Thanks
Old 04-20-12, 10:44 PM   #13
ssjwizard
Has slightly less legible writing
than Thideras, Member

 
ssjwizard's Avatar 

Join Date: Mar 2002
Location: Rio Rancho, NM

10 Year Badge
 
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.

__________________
Life is what you make of it, we exist for the sole purpose of existing. Dont waste the universe efforts!
All statements, imagery, and ideas contained within any posts are merely retold tales of fictional acts by a figment of the universe imagination.

So your looking for an AMD FX motherboard, things you need to know. Whats the max safe temps/volts for an FX?

Green Gorilla, CM 690-II nVidia, FX 8320, GTX 670, liquid cooled
Liquid Fusion, CM 690-II, A8+6670 Dual GFX, liquid cooled
Extreme evaporative water loop 450mm^3 water cooled beast - Incomplete
ssjwizard is offline Benching Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 04-21-12, 12:10 AM Thread Starter   #14
Whitefang
Member



Join Date: Dec 2011

 
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.
Whitefang is offline   QUOTE Thanks
Old 04-21-12, 03:14 AM   #15
dropadrop
Member

 
dropadrop's Avatar 

Join Date: Mar 2001
Location: Finland

10 Year Badge
 
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.
dropadrop is offline   QUOTE Thanks
Old 04-22-12, 12:08 PM   #16
JigPu
Inactive Pokémon Moderator

 
JigPu's Avatar 

Join Date: Jun 2001
Location: Vancouver, WA

10 Year Badge
 
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

__________________
.... ASRock Z68 Extreme3 Gen3
.... Intel Core i5 2500 ........................ 4 thread ...... 3300 MHz ......... -0.125 V
2x ASUS GTX 560 Ti ............................... 1 GiB ....... 830 MHz ...... 2004 MHz
.... G.SKILL Sniper Low Voltage ............. 8 GiB ..... 1600 MHz ............ 1.25 V
.... OCZ Vertex 3 ................................. 120 GB ............. nilfs2 ..... Arch Linux
.... Kingwin LZP-550 .............................. 550 W ........ 94% Eff. ....... 80+ Plat
.... Nocuta NH-D14 ................................ 20 dB ..... 0.35 C°/W ................ 7 V


"In order to combat power supply concerns, Nvidia has declared that G80 will be the first graphics card in the world to run entirely off of the souls of dead babies. This will make running the G80 much cheaper for the average end user."
"GeForce 8 Series." Wikipedia, The Free Encyclopedia. 7 Aug 2006, 20:59 UTC. Wikimedia Foundation, Inc. 8 Aug 2006.
JigPu is offline   QUOTE Thanks
Old 04-22-12, 12:32 PM   #17
ssjwizard
Has slightly less legible writing
than Thideras, Member

 
ssjwizard's Avatar 

Join Date: Mar 2002
Location: Rio Rancho, NM

10 Year Badge
 
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.
Quote:
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.

__________________
Life is what you make of it, we exist for the sole purpose of existing. Dont waste the universe efforts!
All statements, imagery, and ideas contained within any posts are merely retold tales of fictional acts by a figment of the universe imagination.

So your looking for an AMD FX motherboard, things you need to know. Whats the max safe temps/volts for an FX?

Green Gorilla, CM 690-II nVidia, FX 8320, GTX 670, liquid cooled
Liquid Fusion, CM 690-II, A8+6670 Dual GFX, liquid cooled
Extreme evaporative water loop 450mm^3 water cooled beast - Incomplete
ssjwizard is offline Benching Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 04-22-12, 12:42 PM Thread Starter   #18
Whitefang
Member



Join Date: Dec 2011

 
What would the prerequisite coding skills be? And what do you mean by "understanding of the larger applications"?
Whitefang is offline   QUOTE Thanks
Old 04-22-12, 01:40 PM   #19
ssjwizard
Has slightly less legible writing
than Thideras, Member

 
ssjwizard's Avatar 

Join Date: Mar 2002
Location: Rio Rancho, NM

10 Year Badge
 
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.

__________________
Life is what you make of it, we exist for the sole purpose of existing. Dont waste the universe efforts!
All statements, imagery, and ideas contained within any posts are merely retold tales of fictional acts by a figment of the universe imagination.

So your looking for an AMD FX motherboard, things you need to know. Whats the max safe temps/volts for an FX?

Green Gorilla, CM 690-II nVidia, FX 8320, GTX 670, liquid cooled
Liquid Fusion, CM 690-II, A8+6670 Dual GFX, liquid cooled
Extreme evaporative water loop 450mm^3 water cooled beast - Incomplete

Last edited by ssjwizard; 04-22-12 at 02:01 PM.
ssjwizard is offline Benching Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 04-24-12, 04:45 PM   #20
dropadrop
Member

 
dropadrop's Avatar 

Join Date: Mar 2001
Location: Finland

10 Year Badge
 
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.
dropadrop is offline   QUOTE Thanks

Post Reply New Thread Subscribe


Overclockers Forums > Software > Programming Tips and Tricks
Programming Tips and Tricks
Forum Jump

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Mobile Skin
All times are GMT -5. The time now is 07:24 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
You can add these icons by updating your profile information to include your Heatware ID, Benching Profile ID or your Folding/SETI profile ID. Edit your profile!
X

Welcome to Overclockers.com

Create your username to jump into the discussion!

New members like you have made this the best community on the Internet since 1998!


(4 digit year)

Why Join Us?

  • Share experience
  • Max out your hardware
  • Best forum members anywhere
  • Customized forum experience

Already a member?