vect changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, ICFP'03 http://www.icfpcontest.org/, A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/, A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list
Etaoin has quit [Read error: 60 (Operation timed out)]
Etaoin has joined #ocaml
buggs has quit ["maybe it crashed"]
carm has quit [Remote closed the connection]
lus|wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
lus|wazze has joined #ocaml
carm has joined #ocaml
<Smerdyakov> carm = Carmelo Piccione?
Smerdyakov has quit ["Client exiting"]
Smerdyakov has joined #ocaml
brwill_zzz is now known as brwill
Kinners has left #ocaml []
lus|wazze is now known as MegaWatS
MegaWatS is now known as wazze
gim has quit [tolkien.freenode.net irc.freenode.net]
gim has joined #ocaml
brwill is now known as brwill_zzz
carm has quit [Read error: 110 (Connection timed out)]
jdmarshall has joined #ocaml
Kinners has joined #ocaml
Xolution has quit ["sleepytime!"]
Herrchen has quit [Read error: 110 (Connection timed out)]
Kinners has left #ocaml []
<async> how would you go about making your own caml toplevel?
<async> as in writing a custom one
<teratorn> what for? :)
gim has quit ["plus rezo"]
Herrchen has joined #ocaml
jdmarshall has quit []
mw has quit [Remote closed the connection]
mw has joined #ocaml
ayrnieu has quit ["installing lunar"]
cm has quit [Read error: 110 (Connection timed out)]
cehteh has joined #ocaml
GNUcifer has joined #ocaml
cehteh has quit [Read error: 110 (Connection timed out)]
_JusSx_ has joined #ocaml
wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
karryall has quit [Remote closed the connection]
karryall has joined #ocaml
<Maddas> hmm
<Maddas> Looks like there isn't any pure O'Caml code that calculates CRC32s
<Maddas> When writing that in an efficient way, would speed be comparable to the speed of some C code doing the same thing?
<Maddas> s/speed/execution speed/
<karryall> no idea
<mattam> i suppose you're efficient impl uses references ?
owll has joined #ocaml
Xolution has joined #ocaml
owll has left #ocaml []
GNUcifer is now known as cehteh
_JusSx__ has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
madroach has joined #ocaml
<madroach> Hello, I'm just trying to program the game "pong" and have performance problems doing so. I use the graphics library with auto_syncronize false and clear and refresh the screen every 0.01 seconds. Are there any hints ??
<madroach> I use a Pentium 166
<cehteh> why clear the full screen?
<madroach> It is hard work to manually use the "rubber" and remove the "tail" of the ball.
<Smerdyakov> Clearing the full screen is the usual way.
<madroach> First I tried to draw a black ball with a white circle around it.
<Smerdyakov> 100 frames per second is faster than television cartoons. :)
<cehteh> anything above 25 frames is ok ... dont go too high
<madroach> A part of my main loop is: if time -. Unix.gettimeofday () > 0 then (* refresh *);
<cehteh> busy-loop?
<madroach> No, in every iteration of the loop I increment time by 0.01.
<cehteh> huh
<madroach> Got it, how it works ?
<cehteh> no
<cehteh> i would usleep() or such
<madroach> I use a loop in which I only iterate time by 0.01 and calculate the position of the ball.
<madroach> At the end of the loop I test if I have some time left to refresh the screen. But thanks for the tip with usleep(), I used a "busy recursion" for sleeping.
<cehteh> ah
<vegai> what's that?
<cehteh> thats what i meant by busy-loop
<cehteh> thats bad
<madroach> Wait one minute I'll try it with the usleep.
<cehteh> and next, you only need to calculate the position of the ball on every frame .. not every 0.01 sec
<cehteh> .. and next .. how do you calculate the position of the ball?
<karryall> ... except ocaml doesn't have usleep
<cehteh> i am not an ocaml programmer .. but i guess there is some form of sleep
<cehteh> maybe sleep with a float? .. his time to RTFM
<karryall> there is sleep but it sleeps a (integer) number of seconds
<cehteh> ah
<karryall> madroach: you could use ocamlsdl
<cehteh> and select() ?
<madroach> karryall: I'm just learning objective caml. SDL is too hard jet.
<karryall> yes, that's the canonical workaround
<madroach> s/j/y
<madroach> In which module is usleep ??
<cehteh> read above :)
<cehteh> no usleep
<madroach> shit
<cehteh> use select() .. that should be somewhere near the networking stuff
<madroach> I What does this do ?
<karryall> let usleep timeout = ignore (Unix.select [] [] [] timeout)
<cehteh> arent ocaml functions generic ... note to the developers, why not provide a sleep which takes a float ... thats a common portable solution
<karryall> first, AFAIK, there are no developers here, so no use making notes to them :)
<karryall> and I'm not sure it's that portable
<karryall> these time functions have a tendency to interact with signals in non-portable ways
<madroach> Using the Unix.select it raises the exception Unix.Unix_error(11, "select", "")
<karryall> humpf, yes, that's EINTR
<cehteh> defines ocaml signal handlers?
<madroach> What is EINTR
<madroach> ??
<cehteh> interupt
<madroach> ok
<karryall> standard unix error 'Function interrupted by signal'
<madroach> Well I also thought about using the timer functions for letting the program "wake up" when the time has passed, but this seemed too complicated to me.
<cehteh> is there no library for eventqueues in ocaml?
<karryall> madroach: it is complicated because the Graphics modul is already using timers and/or signals internally
<karryall> cehteh: waht do you mean eventqueues ?
<cehteh> a priority_queue ordered by time where events can be scheduled .. including all the wait stuff etc
<karryall> there's Equeue , written by G. Stolpmann
<cehteh> i would use such a thing for game programming
<karryall> well, no, you would use ocamlsdl
<karryall> :)
<cehteh> i am not in game programming anyways
<cehteh> and a pong game cries for ncurses!
<madroach> cehteh: fine I only know ocaml for three months :)
<cehteh> madroach: i know it for some longer but dont use it :)
<karryall> madroach: try this one
<karryall> let usleep timeout =
gim has joined #ocaml
<karryall> let t1 = Unix.gettimeofday () in
<karryall> let to_wait = ref timeout in
<karryall> while !to_wait > 0. do
<karryall> try ignore (Unix.select [] [] [] !to_wait)
<karryall> with Unix.Unix_error (Unix.EINTR, _, _) ->
<karryall> to_wait := t1 +. timeout -. Unix.gettimeofday ()
<karryall> done
<madroach> There is a function delay in the Threads module...
<madroach> But I don's get my ocamlc to work (ocamlc -o pong -threads graphics.cma unix.cma thread.cma pong.ml
<madroach> )
<madroach> It says Error while linking .../treads.cma(Thread): Reference to undefined global `Unix'
eternite has joined #ocaml
<eternite> hi evrybody!
<madroach> karryall: Thanks, but your function is even worse, now the ball only hops around on the screen.
<karryall> madroach: what do you mean ?
<madroach> The ball appears only on about every fifteenth iteration of the main loop.
<karryall> btw the function has a bug
<karryall> replace the try .. line
<karryall> with
<karryall> try ignore (Unix.select [] [] [] !to_wait) ; to_wait := 0.
fabbione has joined #ocaml
<madroach> karryall: OK, thanks now it runs a bit better than with the busy loop.
buggs has joined #ocaml
<madroach> ...But still it doesn't look very pretty
<karryall> use ocamlsdl if you want it to be pretty
<cehteh> ncurses :)
_JusSx__ has quit ["BitchX has bite! (Just ask Mike Tyson!)"]
<madroach> well, than there's no chance of doing it with the graphics library - it's a pitty...
_JusSx_ has joined #ocaml
vegai has left #ocaml []
carm has joined #ocaml
fabbione has left #ocaml []
karryall has quit ["home"]
eternite_0 has joined #ocaml
eternite has quit [Read error: 54 (Connection reset by peer)]
tims has joined #ocaml
madroach has quit ["leaving"]
JX has quit [Read error: 110 (Connection timed out)]
JX has joined #ocaml
<Maddas> mattam: I didn't implement CRC32
<Maddas> mattam: I don't know anything about CRC32 yet, but if I can achieve similar speeds (a few percent slower won't matter of course) with O'Caml, I'll try to write my own.
<mattam> you can
Etaoin has quit ["Client exiting"]
Smerdy has joined #ocaml
Smerdyakov has quit [Read error: 110 (Connection timed out)]
Smerdy is now known as Smerdyakov
The-Fixer has quit ["Goodbye"]
arty has joined #ocaml
arty has left #ocaml []
Etaoin has joined #ocaml
Xolution has quit ["The riot be the rhyme of the unheard."]
cehteh has quit [Remote closed the connection]
The-Fixer has joined #ocaml
cehteh has joined #ocaml
Xolution has joined #ocaml
Etaoin has quit ["Client exiting"]
Xolution has quit [tolkien.freenode.net irc.freenode.net]
Smerdyakov has quit [tolkien.freenode.net irc.freenode.net]
mw has quit [tolkien.freenode.net irc.freenode.net]
mattam has quit [tolkien.freenode.net irc.freenode.net]
mimosa has quit [tolkien.freenode.net irc.freenode.net]
mellum has quit [tolkien.freenode.net irc.freenode.net]
Hadaka has quit [tolkien.freenode.net irc.freenode.net]
brwill_zzz has quit [tolkien.freenode.net irc.freenode.net]
wuuru has quit [tolkien.freenode.net irc.freenode.net]
det has quit [tolkien.freenode.net irc.freenode.net]
lam has quit [tolkien.freenode.net irc.freenode.net]
teratorn has quit [tolkien.freenode.net irc.freenode.net]
JX has quit [tolkien.freenode.net irc.freenode.net]
tims has quit [tolkien.freenode.net irc.freenode.net]
jrosdahl has quit [tolkien.freenode.net irc.freenode.net]
Maddas has quit [tolkien.freenode.net irc.freenode.net]
Riastradh has quit [tolkien.freenode.net irc.freenode.net]
whee has quit [tolkien.freenode.net irc.freenode.net]
vect has quit [tolkien.freenode.net irc.freenode.net]
cehteh has quit [tolkien.freenode.net irc.freenode.net]
eternite_0 has quit [tolkien.freenode.net irc.freenode.net]
Herrchen has quit [tolkien.freenode.net irc.freenode.net]
async has quit [tolkien.freenode.net irc.freenode.net]
The-Fixer has quit [tolkien.freenode.net irc.freenode.net]
Defcon7 has quit [tolkien.freenode.net irc.freenode.net]
Demitar has quit [tolkien.freenode.net irc.freenode.net]
buggs has quit [tolkien.freenode.net irc.freenode.net]
rox has quit [tolkien.freenode.net irc.freenode.net]
Hipo has quit [tolkien.freenode.net irc.freenode.net]
wax has quit [tolkien.freenode.net irc.freenode.net]
Xolution has joined #ocaml
cehteh has joined #ocaml
The-Fixer has joined #ocaml
Smerdyakov has joined #ocaml
JX has joined #ocaml
tims has joined #ocaml
eternite_0 has joined #ocaml
buggs has joined #ocaml
mw has joined #ocaml
Herrchen has joined #ocaml
mattam has joined #ocaml
rox has joined #ocaml
Demitar has joined #ocaml
mimosa has joined #ocaml
async has joined #ocaml
mellum has joined #ocaml
jrosdahl has joined #ocaml
Maddas has joined #ocaml
Hadaka has joined #ocaml
Riastradh has joined #ocaml
whee has joined #ocaml
brwill_zzz has joined #ocaml
teratorn has joined #ocaml
Defcon7 has joined #ocaml
wuuru has joined #ocaml
det has joined #ocaml
lam has joined #ocaml
Hipo has joined #ocaml
vect has joined #ocaml
wax has joined #ocaml
_JusSx_ has quit ["BitchX-1.0c19 -- just do it."]
wazze has joined #ocaml
The-Fixer has left #ocaml []
The-Fixer has joined #ocaml
<eternite_0> by!
eternite_0 has quit ["Arlg connection crash!"]
mimosa has quit ["I like core dumps"]
tims has quit []