Jump to content


C++ or Java for a Game Engine?


22 replies to this topic

#1 LizardGamer

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 06 November 2010 - 10:41 AM

I am an enthusiastic person when it comes to game engines, and so I am trying to create my own game engine and I'm trying to choose between some languages.

I'm sort of looking at Java and C++ to create an engine with, but I don't know what language I should use because I'm a newbie with programming languages.

I was thinking if I was going to use C++ I would use AngelScript or Lua to script the game, and if I was going to use Java I would use Java to script because I don't think AngelScript of Lua have been ported to Java or if I can use them at all in Java.

If you know the differences between these Languages (C++ and Java) for programming games, could you please give some helpful info, Like speed difference, ease of use etc.

And I know Java is more basic and C++ is for the more experienced person.

P.S. No need to tell me not to make an engine but a game instead, because I know the structure of a game engine already.

#2 fireside

    Senior Member

  • Members
  • PipPipPipPip
  • 1589 posts

Posted 06 November 2010 - 01:37 PM

Java is a little slower, so that's you're first consideration. Take a look at some demos of the Jmonkey engine and see if it will be adequate. Java works pretty well with the web, depending on your engine, you can use applets or web apps, so it's a convenient way to distribute games. Java doesn't really need any scripting so it's easy to extend engine classes to modify the engine for a certain type of game. That's difficult, or nearly impossible with a scripted engine, without reverting back to c++ and then possibly adding new scripting.
Java is less secure in the sense that it's easy to decompile. Java uses opengl for good or for bad, but it may mean more learning for someone who knows directx. If you are going to do a smaller, web centric engine, Java is probably a little better choice. There aren't as many mid level libraries as c++ for it. There really aren't a lot of java engines around, which should give you some idea of the demand of each, but then, specializing might be the better way to get noticed anymore.
Currently using Blender and Unity.

#3 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 08 November 2010 - 01:21 PM

Depends on the engine's target market: cutting-edge FPS or casual 2D side-scroller?

Anyways, if I wasn't limited by language, I would not make a Java-based engine. I'd pick a language that is "closer to the metal" or compiles down to a lower level.
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#4 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 08 November 2010 - 06:26 PM

If you're considering Java, any reason why you're not considering .Net?
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#5 TheNut

    Senior Member

  • Moderators
  • 1701 posts
  • LocationCyberspace

Posted 08 November 2010 - 07:08 PM

Java games on the desktop are practically unheard of. If you practice your Java skills, you will likely end up as a server or web developer somewhere. C++ as a language is as good as any other and will make you more marketable in the gaming industry. .NET also has a strong pressence with tools developers. LUA is a good scripting language and is my prefered choice, but also consider Python as it's quite popular and will earn you brownie points in the game industry.

Something else to consider...

Java -> port to the 'droid or to the crackberry
.NET -> port to M$ phone
C++ -> port to symbian

If you're good, you'll code your Java or C++ classes such that it would be minimal effort to migrate between the two languages if that should ever happen to you. The core of my C++ engine was ported to C# with minimal adjustments. As a result, I work with the same code base accross multiple platforms including Silverlight, Symbian, Linux, Mac, and iOs. Code is your asset, so write it once and use everywhere.
http://www.nutty.ca - Being a nut has its advantages.

#6 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 08 November 2010 - 07:41 PM

TheNut said:

Java games on the desktop are practically unheard of.
Indeed. I mean, who would ever hear of Minecraft... That game is destined to be a failure. :)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#7 TheNut

    Senior Member

  • Moderators
  • 1701 posts
  • LocationCyberspace

Posted 08 November 2010 - 09:07 PM

Hardy har har :)
http://www.nutty.ca - Being a nut has its advantages.

#8 fireside

    Senior Member

  • Members
  • PipPipPipPip
  • 1589 posts

Posted 08 November 2010 - 11:01 PM

Quote

Java games on the desktop are practically unheard of.

The games that do use java on the desktop tend to be web related such as Runescape and Bang Howdy. Runescape is the second most played MMO. I think it's a great language, but I'm a hobbyist. Language really isn't very important on the desktop. What you say about code, though, is a good idea. Not so much for an engine in my circumstances, but things like a pathfinding class, fsm, etc. I'll let someone else write the engine, I don't have that kind of patience. Using an extensible language is important to me, so c++ with scripting just gets in the way as far as I'm concerned, at least in most cases. If it's highly specialized, it's all right.
Currently using Blender and Unity.

#9 LizardGamer

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 08 November 2010 - 11:08 PM

Quote

Minecraft... That game is destined to be a failure
Well alot of people have heard of Minecraft and its not going to be destined to be a failure!

#10 LizardGamer

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 08 November 2010 - 11:13 PM

But now I'm sort of leaning towards C++, because of the things that can be done with it

#11 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 09 November 2010 - 08:39 AM

LizardGamer said:

Well alot of people have heard of Minecraft and its not going to be destined to be a failure!
I guess your sarcasm-o-meter is broken.

But you haven't answered my question. Why not .Net (specifically, C#)? That way, if it just so happens no need extra performance somewhere, you can implement that in C++ and create the bindings between native C++ and managed C# using C++/CLI.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#12 Mattias Gustavsson

    Senior Member

  • Members
  • PipPipPipPip
  • 413 posts

Posted 09 November 2010 - 11:09 AM

.net runtime is massive though...
  • www.mattiasgustavsson.com - My blog and current projects
  • www.rivtind.com - My Fantasy world and isometric RPG engine
  • www.pixieuniversity.com - My Software 2D Game Engine

#13 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 09 November 2010 - 01:41 PM

Mattias Gustavsson said:

.net runtime is massive though...

Pretty much on a majority of machines now.

http://www.statowl.c...soft_dotnet.php

63% on v3, and 21% already up to v4...
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#14 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 09 November 2010 - 09:17 PM

Mattias Gustavsson said:

.net runtime is massive though...
35 MB for .Net 4.0. Yes, indeed, 3.5 SP1 was a whopping 231 megs. Don't use it :)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#15 LizardGamer

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 09 November 2010 - 11:32 PM

The Wierd one .oisyn said:

Why not .Net (specifically, C#)?

Because I don't know anything about them!!!!

#16 Hyper

    Valued Member

  • Members
  • PipPipPip
  • 195 posts

Posted 09 November 2010 - 11:35 PM

LizardGamer said:

Because I don't know anything about them!!!!
You should get busy reading then! :p
“You may be disappointed if you fail, but you are doomed if you don't try.”
Beverly Sills

#17 Mattias Gustavsson

    Senior Member

  • Members
  • PipPipPipPip
  • 413 posts

Posted 10 November 2010 - 07:50 AM

.oisyn said:

35 MB for .Net 4.0.

Wow, that's a massive improvement - it's actually starting to become interesting then :-) I'll probably stick with C++ myself, for performance and out of habit, but it's still good to see C# becoming more of a viable option - I know a lot of people like it.
  • www.mattiasgustavsson.com - My blog and current projects
  • www.rivtind.com - My Fantasy world and isometric RPG engine
  • www.pixieuniversity.com - My Software 2D Game Engine

#18 LizardGamer

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 10 November 2010 - 07:50 AM

Hyper said:

You should get busy reading then! :p
Na, I think I'm going to stick with C++ and scripting with Lua

#19 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 10 November 2010 - 04:25 PM

LizardGamer said:

Because I don't know anything about them!!!!
C# is basically just Java with extra features :)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#20 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 10 November 2010 - 05:18 PM

Mattias Gustavsson said:

Wow, that's a massive improvement - it's actually starting to become interesting then :-) I'll probably stick with C++ myself, for performance and out of habit, but it's still good to see C# becoming more of a viable option - I know a lot of people like it.

Actually, there is a Client Profile for Net3.5 SP1, which weighs in at 28MB. And, yes, there was a massive improvement in the Client Profile, both in content and "visibility" of it. MS realized shoving the whole framework wasn't going to work too well.

http://msdn.microsof...y/cc656912.aspx

There are also lots of web installers that start out at 1MB, and download as needed.

Lastly, users don't need to have the whole framework to run your stuff if they don't need the whole framework to run your stuff.
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users