Re: Not this again...



> Many RLs, from what I have seen here, do have initial problems with
> speed when taking into account LOS and FOV algorithms for the character
> and the AI. Add in a sophisticated AI that adds features like Neural
> Networking, and speed can quickly become very important.

C++ is only faster than any other (sane) programming language by a
constant factor. A poor algorithm can be exponentially slower than a
good one. Picking C++ over Visual Basic does not help you if your
algorithms are bad.

Of course, AI code can as slow as you want it. But you can not just add
more computing power to a neural network to make it "smarter". The
performance of a neural network does not improve by simply increasing
the complexity. Also, in order to train a neural network, you need an
amount of training data that increases with the complexity. The only
realistic scenario is to make simple networks that also become simple
to evaluate. I think things like path finding are much more
computationally demanding than simple neural networks. I have never
implemented a NN in a game though.

> Aside from what? Manual memory management for a small project like an
> RL isn't a huge deal, and does not require "lots of extra code".

Agree. But it requires some extra code, which also probably has a
slightly higher potential for hidden bugs.

> A good
> programming bug is ALWAYS hard to find - and of course, by good I mean
> the bug that survives three rewrites and only crops up in strange
> circumstances like using a wand of teleportation on the
> uber-dimensional Yak of Power, which instead of transporting it to the
> Nether Realm of Fear turns it into a pair of harmless flip-flops.

Yes. The hardest bugs are in the logic. The above sounds to me like a
writing-into-the-wrong-place-in-memory kind of bug though. :)

> Most memory leak bugs are actually easy to find - generally whenever you're
> changing the pointer without getting rid of the allocated memory it
> pointed to, you have a leak.

It is not always that easy. Many objects are often referenced to from
many different places. Making sure that objects always get deleted at
the right moment can be tricky.

> > It has
> > even been shown that GC:ed languages often run faster than non GC:ed
> > ones.
>
> I dont think that Java is faster than C though.

That is not because of the GC. ;)

> > [Anecdote...]
>You could easily have done the same thing with structs. If you're using
>C++, classes probably make more sense, but I haven't seen a really
>convincing argument out of this anecdote.

No. You probably have to experience it yourself. :) The example given
is not detailed enough to give enough information either.

About C and structs: It is not about how OOP structures the data that
makes it powerful in this case. You could have put all data in the base
Object (one struct) for all possible subclasses without losing much in
this example. It is the way OOP neatly separates behaviour of different
things. A method like enter() could do one thing for a floor tile, and
another thing for a water or trap tile. This is what makes it powerful.
And you can do OO-like programming in C too... It's just a lot more
awkward.

> > To end, I'm not too fond of Java. I don't think it is expressive
> > enough. I don't know what language would be optimal for roguelike
> > development, but I know that there are many choices better than C++.
>
> Like what?

> All in all, I feel very comfortable
> coding in C++, so it will very likely be the language I code my project
> in.

Yes. This is what it all boils down to. Use a language that you are
comfortable with. But different languages are good for different
things. There is always the opportunity of learning something new.

> If you've got some better suggestions, I'd love to hear them. I
> looked at Ruby, and.. decided I dont think I like it.

D, Pascal, Java, C#, Pike, Ruby, Python, Lua, OCaml, Ada, etc :). All
languages have strengths and weaknesses. My point with my previous post
was that the strengths of C++ have little in common with the needs of
the typical roguelike.

But once again, the only thing that is important is that you are
comfortable with your chosen language.

/Oskar

.



Relevant Pages

  • Re: Wholesome choice?
    ... need an interface with the power of a language. ... I've only been using computers for 40+ years without touch typing, ... Bugs and crashes *are* inevitable. ... And that anyone with anything but the latest version of Windows ...
    (rec.arts.sf.fandom)
  • Re: c / c++ : is it end of era ?
    ... When you start talking about "bugs in the language", ... Zero terminated strings. ... array information is never destroyed. ...
    (comp.lang.c)
  • Re: "STL from the Ground Up"
    ... language does not damn the entire language. ... The existence of bugs in one implementation... ... All five of the C++ implementations I tried: ... You just said smaller compilers are likely to have fewer bugs. ...
    (comp.programming)
  • Re: why learn C?
    ... i think programming is different from Software Engineering. ... then I can find other algorithms I have needed which are ... *not* part of which ever language you choose to select. ... and you will have done at least some algorithm development whether you ...
    (comp.lang.c)
  • Re: Java or C++?
    ... for the stuff we do, its the algorithms do tend to be complex, so I ... mostly because of the predictability of the language. ... where all the intervening steps are as light-weight as possible. ... developed hardware in VHDL. ...
    (comp.programming)