From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 1F6EBBC69 for ; Wed, 4 Jul 2007 00:49:22 +0200 (CEST) Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l63MnLaL015497 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 4 Jul 2007 00:49:21 +0200 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay03.plus.net with esmtp (Exim) id 1I5rBQ-0007gX-W0 for caml-list@yquem.inria.fr; Tue, 03 Jul 2007 23:49:21 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] ANN: Chess III Arena 0.5 Date: Tue, 3 Jul 2007 23:43:43 +0100 User-Agent: KMail/1.9.7 References: <000001c7bdbb$ec4d4750$ac01a8c0@johnyaya> In-Reply-To: <000001c7bdbb$ec4d4750$ac01a8c0@johnyaya> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707032343.44111.jon@ffconsultancy.com> X-Miltered: at discorde with ID 468AD271.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; non-trivial:01 ocaml:01 lacks:01 ocaml:01 hashtbl:01 hashtbl:01 model:01 speedup:01 verizon:98 blog:98 frog:98 wrote:01 binaries:01 compile:01 caml-list:01 On Tuesday 03 July 2007 22:48:40 Grant Olson wrote: > Chess III Arena 0.5 is my first (allegedly) non-trivial app in OCaml. It > is a fully functional chess game, although it lacks some desirable features > such as a computer opponent and network play at this point in time. It > uses Quake III player models as the pieces. > > Binaries for windows and source for other platforms are available at: > > http://members.verizon.net/~olsongt/c3a/ > > I've also detailed some of the things I like about OCaml on that page, > since I don't write enough to have a blog, but I imagine I'm preaching to > the choir on this list. ROTFLMAO. Wow! That is absolutely amazing! Love the name. =8-) Here's a quick patch, if you put this right after your definition of draw_md3 in md3.ml then the whole program runs an order of magnitude faster: let draw_md3 = let m = Hashtbl.create 1 in fun x y -> try GlList.call(Hashtbl.find m (x, y)) with Not_found -> let list = GlList.create `compile in draw_md3 x y; GlList.ends(); GlList.call list; Hashtbl.add m (x, y) list This simply memoizes the rendering of each frame of animation for each model in a display list. The result is that your geometry is stored on the graphics card and rendered directly, hence the gratuitous speedup. This is a wonderful idea for a first project in OCaml. I've taken a quick look at your code to give you some constructive criticism but your coding style is already excellent. Keep posting! -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. The OCaml Journal http://www.ffconsultancy.com/products/ocaml_journal/?e