caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Games
Date: Thu, 28 Jul 2005 20:48:29 +0100	[thread overview]
Message-ID: <200507282048.29965.jon@ffconsultancy.com> (raw)
In-Reply-To: <1122526158.6769.93.camel@localhost.localdomain>

On Thursday 28 July 2005 05:49, skaller wrote:
> On Thu, 2005-07-28 at 03:44 +0100, Jon Harrop wrote:
> > If the mutual recursion from having them "all know about each other"
> > causes a problem then you can use objects to circumvent the mutual
> > recursion,
>
> That isn't really the problem. Consider two fighters, with various
> kinds of attacks and defences: what happens when A uses punch type P,
> and B defends with action D .. taking into account other properties
> like speed and strength.. now consider all the possible combinations:
> it isn't possible to actually list them all.
>
> You also cannot simulate the real physics -- there isn't
> time for a proper simulation.

The terms "real physics" and "proper simulation" don't mean anything. However, 
a modern PC can do a huge amount of physics modelling in real time (IMHO).

> This problem is often handled by sending messages and
> interpreting them.. and having a default. If the default
> seems wrong, it is fixed.

I'm still not clear on how this is difficult in OCaml. From your description, 
it seems very straightforward...

> Crudely, you need an approximation physics that works
> for the game: and this is what most games get wrong.
> They don't actually design a physics, they do hoc
> hacks left right and centre, and then the whole
> system becomes almost impossible to manage.

I disagree. I've written a few games. One was very popular (twoplay, for the 
Acorn). I deliberately used "fake physics" on all of them because real 
physics almost always leads to bad game play. You get more freedom with fake 
physics (anything goes) which does make it easier to break the code but I'm 
not convinced that this is a real problem. I think there are much bigger 
problems with some of the algorithms, e.g. getting stuck.

> This is why simplistic games work, and more sophisticated
> ones tend to be full of stupid bugs .. for example
> casting a 'life leech' spell on an undead monster
> or stone gargoyle .. the programmers forgot to
> make a special case, and they didn't design
> a workable physics either.

One of the few games that I have really enjoyed in recent years is Grand Theft 
Auto, Vice City (on PS2). That was quite sophisticed with LOD algorithms and 
so forth. It also had many bugs. After you'd been playing for a while it 
slowed down to a crawl (probably due to manual memory allocation ;-). It 
would also hang quite often (probably due to too much low-level coding).

From my point of view, there is nothing technologically difficult in that game 
at all. I can see no reason for those bugs except poor programming.

I think there is no question that OCaml could have been used to write most of 
the code for the PC version without adversely affecting performance whilst 
greatly improving reliability. I see no reason to think that the console 
versions would not be similarly feasible, although it would require more 
work. Many games now use quite sophisticated LOD algorithms and OCaml is 
vastly better suited to this than C++.

> > Yes, I doubt anyone here has used their language on a console but there
> > is a lot of interesting non-console stuff to discuss.
>
> Felix has been used on an X-Box .. not really a console like
> a PS2 but anyhow .. :)

Impressive. :-)

> > > stuff, my memory and perfomance limits are REALLY tight. Sometimes all
> > > I have memory free is like 200kb out of 32mb total. And it HAS to work,
> > > many hours on end.
> >
> > Yes, this is the kind of games programming that OCaml is least
> > well-suited to.
>
> Why do you think that it is any worse than C++?

C++ has much more predictable memory requirements and it is much easier to 
squeeze memory usage in C++ than in OCaml. So if I were programming for 
something with really tight memory requirements (like embedded) then I'd 
probably avoid OCaml. However, modern consoles have a lot more memory and, I 
think, with a little effort OCaml should be workable. If I were a console 
games programmer then I'd definitely want to play with a suitable working 
OCaml setup before using it in a production game, of course.

I guess it would take 6 months of hard work by a single OCaml-familiar 
programmer to get a working system up and running (provided ocamlopt already 
has a backend for the CPU). Given the potential savings, I'd be surprised if 
some games house wouldn't fund such work. Failing that, it would make a funky 
academic project. :-)

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists


  reply	other threads:[~2005-07-28 21:14 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-22 14:26 How to do this properly with OCaml? Thomas Fischbacher
2005-07-22 14:52 ` [Caml-list] " Eric Cooper
2005-07-22 15:26 ` [SPAM_PROBABLE] - [Caml-list] How to do this properly with OCaml? - Bayesian Filter detected spam Christophe Dehlinger
2005-07-22 18:58   ` [Caml-list] How to do this properly with OCaml? Stephane Glondu
2005-07-22 15:50 ` Berke Durak
2005-07-22 16:47   ` brogoff
2005-07-22 15:54 ` Michel Quercia
2005-07-23  5:00 ` Michael Alexander Hamburg
2005-07-23 12:34   ` Xavier Leroy
2005-07-23 13:16     ` Berke Durak
2005-07-23 16:36       ` Stephane Glondu
2005-07-23 18:27         ` Berke Durak
2005-07-23 18:50           ` Matthieu Sozeau
2005-07-24  8:35             ` Berke Durak
2005-07-23 19:18           ` Stephane Glondu
2005-07-23 19:35             ` Thomas Fischbacher
2005-07-23 19:50               ` Stephane Glondu
2005-07-23 19:59                 ` Thomas Fischbacher
2005-07-23 20:15                   ` Brian Hurt
2005-07-23 23:16                     ` james woodyatt
2005-07-23 23:27                   ` Stephane Glondu
2005-07-23 18:37     ` Michael Alexander Hamburg
2005-07-23 18:52       ` Bardur Arantsson
2005-07-23 21:35         ` [Caml-list] " Michael Alexander Hamburg
2005-07-23 19:19     ` [Caml-list] " Thomas Fischbacher
2005-07-24  7:27     ` [Caml-list] "Just say no!" campaign against Obj [was: How to do this properly with OCaml?] Alex Baretta
2005-07-24  8:02       ` [Caml-list] "Just say no!" campaign against Obj james woodyatt
2005-07-24 17:27       ` Stephane Glondu
2005-07-25  8:43         ` Alex Baretta
2005-07-24 21:37       ` [Caml-list] "Just say no!" campaign against Obj [was: How to do this properly with OCaml?] brogoff
2005-07-25  8:15         ` Alex Baretta
2005-07-25 17:08           ` brogoff
2005-07-25  8:57         ` Alex Baretta
2005-07-24 17:33     ` [Caml-list] How to do this properly with OCaml? skaller
2005-07-24 18:13       ` Stephane Glondu
2005-07-24 18:48         ` skaller
2005-07-24 19:14           ` Stephane Glondu
2005-07-24 20:29             ` skaller
2005-07-24 20:49               ` skaller
2005-07-24 21:08                 ` Stephane Glondu
2005-07-24 21:55                   ` skaller
2005-07-24 23:23                     ` Stephane Glondu
2005-07-25  0:32                       ` skaller
2005-07-25  6:45                         ` Stephane Glondu
2005-07-25 11:35                           ` skaller
2005-07-26  0:47                             ` Brian Hurt
2005-07-26  0:56                               ` Jere Sanisalo
2005-07-26  1:10                                 ` Brian Hurt
2005-07-26  1:34                                   ` Jere Sanisalo
2005-07-26  9:03                                     ` Richard Jones
2005-07-27 17:21                                     ` skaller
2005-07-27 19:44                                       ` [Caml-list] Games Jon Harrop
2005-07-27 20:35                                         ` Jere Sanisalo
2005-07-28  0:13                                           ` Jon Harrop
2005-07-28  1:12                                             ` Jere Sanisalo
2005-07-28  2:44                                               ` Jon Harrop
2005-07-28  4:49                                                 ` skaller
2005-07-28 19:48                                                   ` Jon Harrop [this message]
2005-07-28 21:32                                                     ` David Thomas
2005-07-28 22:31                                                       ` Jon Harrop
2005-07-29  1:44                                                         ` Michael Walter
2005-07-29  2:32                                                         ` David Thomas
2005-07-29  3:52                                                           ` skaller
2005-07-29 12:57                                                             ` David Thomas
2005-07-28 10:58                                               ` Gerd Stolpmann
2005-07-28 17:19                                         ` David Thomas
2005-07-28 19:22                                           ` Jon Harrop
2005-07-27 21:13                                       ` [Caml-list] How to do this properly with OCaml? Pal-Kristian Engstad
2005-07-27 22:28                                         ` skaller
2005-07-28  1:47                                           ` Michael Walter
2005-07-27 23:17                                         ` [Caml-list] Games Jon Harrop
2005-07-28  0:03                                         ` [Caml-list] How to do this properly with OCaml? Paul Snively
2005-07-28 18:26                                           ` Jonathan Bryant
2005-07-28 23:10                                             ` Paul Snively
2005-07-27 16:03                                   ` skaller
2005-07-26  1:01                               ` Stephane Glondu
2005-07-26  1:15                                 ` Brian Hurt
2005-07-27 15:33                                 ` skaller
2005-07-30 23:24                                   ` Thomas Fischbacher
2005-07-31  0:06                                     ` Jon Harrop
2005-07-31  3:10                                       ` skaller
2005-07-31  2:54                                     ` skaller
2005-07-26 20:32                               ` David Thomas
2005-07-27 15:05                               ` skaller
2005-07-27 15:29                                 ` Jon Harrop
2005-07-27 15:35                                   ` David Thomas
2005-07-27 20:11                                     ` skaller
2005-07-28 16:35                                       ` David Thomas
2005-07-30 23:33                                     ` Thomas Fischbacher
2005-07-31  0:39                                       ` james woodyatt
2005-07-27 19:59                                   ` skaller
2005-07-26  1:22                             ` Jon Harrop
2005-07-27 17:23                               ` skaller
2005-07-26  1:05                         ` Jon Harrop
2005-07-26  1:20                           ` Brian Hurt
2005-07-26  1:28                             ` Jon Harrop
2005-07-27 17:03                             ` skaller
2005-07-27 16:09                           ` skaller
2005-07-24 23:26               ` Brian Hurt
2005-07-25 17:21       ` Ken Rose
2005-07-25 19:19         ` skaller
2005-07-26  7:10           ` Alex Baretta
2005-07-23 18:58   ` Thomas Fischbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200507282048.29965.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).