🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Future of C++

Started by
65 comments, last by savagerx 22 years, 8 months ago
First, I''m not a kid. Second, my claim was that there is no substitute for C++ - I did NOT claim that C++ could substitute for anything nor everything else.

And most unfortunetly COBOL is still alive...

Garbage collection isn''t a bad thing. Automatic garbage collection is BAD thing for RT systems. With a game, and any system with a hard loop, there''s no idle time to background process the garbage with. Eventually you have to collect the garbage, and if there''s a lot of garbage to collect you have a long pause in the game while it happens.

MI is something you need when you do OOD. If you don''t have it, you have to do even cludgier things to emulate it. If you''ve ever created a class, gave it a referce to another object and "published" a method of the object for the outside world to use, you''ve encounterd a good use for MI. And again, you have the control in C++ to chose whether or not MI is appropreate in a given situation.

Same goes for templates. If you want a polymorphic container, you got it. If you want a generic container without polymorphism, you got it.

Languages are more like toolboxes than individual tools.

...
Shak, that''s an interesting link you posted. When and if they finish that project it will be possible to quickly and easily write a cross-platform 3D game in Java. But that code those guys are writing will not be in Java. They are nailing down a proposal for an extention to Java2 that would make programming a cutting-edge game feasible. So the code for it will be in the JVM, it''s kinda like a cross-platform DirectX, they even call it JavaX.

...
I''m curious how to implement a Red-Black tree based container. Or how to build an oct-tree for occulusion culling? Or how to implement a BSP tree for static terrain rendering? Or how to build a neural-net for basic AI? I imagine it must be possible since people have written 3D games with Java. Can anyone enlighten me? How do you create advanced data structures without pointers?

Magmai Kai Holmlor
- Not For Rent
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
quote: Original post by Magmai Kai Holmlor
Eventually you have to collect the garbage, and if there''s a lot of garbage to collect you have a long pause in the game while it happens.

Ever heard of incremental garbage collection?
quote:
I''m curious how to implement a Red-Black tree based container. Or how to build an oct-tree for occulusion culling? Or how to implement a BSP tree for static terrain rendering? Or how to build a neural-net for basic AI? I imagine it must be possible since people have written 3D games with Java. Can anyone enlighten me? How do you create advanced data structures without pointers?

Simple: You use references.

eg.
  class Node{   protected Node next;   protected Object data;}  

A simple singly-linked list-node (methods excluded for brevity). The ''next'' attribute is a reference to another Node object. This reference is automatically dereferenced when it appears as an r-value in the code. There is no way in Java to declare a non-reference variable for a class (you can have non-reference variables of the basic types int/char/float/etc.).
There is also the keyword 'null', which acts as NULL/0 in C/C++, i.e. You can assign null to a reference-variable, making it point to nothing. So it is basically not correct to say that Java doesn't have pointers. Java *does* have pointers, it's just that they're called references, and you don't need any special syntax for dereferencing them (as it's done automatically for you). What Java doesn't have/allow is pointer-arithmetic.

In my example above I would create a Node object by e.g.
    Node node = new Node(); // we use new to create a new Node object.node.data = new Integer(30);node.next = new Node();node.next.data = new Integer(64);node.next.next = null;    

That would create a singly linked list with two items (Integer is a wrapper class for ints).

(IIRC Java automatically initialises object-attributes to sensible values (such as 0/0.0/null/etc), so the assignments to null is probably not necessary)

Edited by - Dactylos on October 7, 2001 9:39:14 PM
Java is a complete language, and there is nothing(in computer science terms) you can do in C++ that you cannot do in Java(or most other languages for that matter, pointer arithmetics or no pointer arithmetics).
As for the "how-the-hell-do-you-do-datastructures-in-java-without-pointers?" issue, that was well covered in this recent topic: http://www.gamedev.net/community/forums/topic.asp?topic_id=61744

"A society without religion is like a crazed psychopath without a loaded .45"
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Magmai Kai Holmlor wrote in regards to the proposed gaming-api
>It's kinda like a cross-platform DirectX, they even call it JavaX.

I just wanted to add that IMHO they chose the package prefix javax because all of the standard java eXtension packages are called that (sql, rmi/corba, xml, swing, naming, crypto and so on all have the javax-prefix). The name has nothing to do with DirectX I think.

Edited by - shak on October 9, 2001 8:45:35 AM
shak is correct. the gaming package is called javax.games because it is an extension package, like javax.swing, javax.servlet, etc. These are named this way because they are official standards supported by Sun and part of the Java language, but are not required to be present in every installation of the JVM (as the java.lang, java.io & java.util packages are).

It is in no way related to DirectX.

"If consquences dictate our course of action, it doesn''t matter what''s right, it''s only wrong if you get caught."
- Tool

"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
Regarding the issue that ANSI is dropping C++ in the near future, it is false!
ANSI is not dropping C++ and I believed that the information I''ve got a few days ago is untrue. Dammed my lecturer!!!

The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant

This topic is closed to new replies.

Advertisement