RE: [racket-users] 2htdp/universe performance

2015-08-25 Thread John Carmack
That was the first thing I tried, and it got substantially slower.  Of the 
three ways to create large bitmaps, one of them was fast on MacOS, and all of 
them are slow on Windows.  Using a 4096x768 bitmap is clearly not going down a 
fully hardware accelerated path.

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Stephen Bloch
Sent: Tuesday, August 25, 2015 6:10 AM
To: racket-users@googlegroups.com
Subject: [racket-users] 2htdp/universe performance

John Carmack writes:
The performance problems were related to the larger scrolling worlds. The H2DP 
versions got slower the more clouds were in the maps.

If the background is basically static but scrolling, you might get a 
substantial performance improvement by

(define background (freeze big-expression-that-builds-the-background))

and using that variable henceforth.  (The “freeze” function renders an image 
expression to a bitmap once and for all, trading memory for time.)  If not the 
WHOLE background is basically static, but you have a lot of repeated elements 
(say, a bunch of identical clouds), you can

(define cloud (freeze big-expression-that-builds-a-cloud))

and use that variable instead of the big expression henceforth.  There’s no 
harm in doing both, e.g.

(define background (freeze … cloud … cloud … cloud … ))

although this won’t buy you any additional performance.

The idea that you functionally compose images like this:
 ...
Which draws image1 on top of image2 on top of image 3, which is backwards from 
the painters order that would draw image 3, then image 2, then image 1.

This imperative, side-effect-ing code is a little less clear to a beginner with 
the OOP and DC concepts, but It better represents what actually happens, and it 
is much easier to modify the code without worrying about the nesting.

It’s not clear to me that the imperative style “better represents what actually 
happens,” nor that this matters.

However, there is a big win associated with the functional approach: it forces 
model-view separation from the beginning.  Model-view separation is how almost 
all GUI programs are written, and failures to follow it cause a lot of the 
display bugs in GUI programs.  Students who learn an imperative-first approach 
to GUI invariably end up writing display handlers that modify the model, or 
mouse handlers that draw to the display, causing the aforementioned display 
bugs.

Stephen Bloch
sbloch1...@gmail.commailto:sbloch1...@gmail.com



--
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
racket-users+unsubscr...@googlegroups.commailto:racket-users+unsubscr...@googlegroups.com.
For more options, visit 
https://groups.google.com/d/optouthttps://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optoutk=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0Ar=Kjg6LltY9QjkipKooaVldA%3D%3D%0Am=K7ydo0ZPjv7m8zxvDGYN7qMNIVTK9hTRK44h6w1AzV4%3D%0As=1102dd791cbf03a04b142170144b798ed07a688b2e0e8dbb393ead3d538b74d6.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: My son's game in Racket

2015-08-25 Thread Mr Susnake
On Monday, August 24, 2015 at 10:28:07 PM UTC+6, John Carmack wrote:
 We “released” my 10 year old son’s game that was done in Racket:
 www.1k3c.com
 
  
 
 I’m still taking a little heat from my wife for using an obscure language 
 instead of something mainstream that is broadly used in industry, but I have 
 nothing but good things to say about using Racket and DrRacket for a 
 beginning programmer,
  and highly recommend it.
 
  
 
 I can’t recommend 2htdp/universe for this sort of thing, though.  I had to 
 drop to the native GUI bitmaps for performance reasons, hack around the 
 lifecycle to support a separate editor window, and I still don’t know how to 
 make the Quit
  menu item actually exit the app on the Mac version.
 
  
 
 I completely understand the reasoning for the way 2htdp/universe is built, 
 and saying that a “real” project should use the grown-up APIs is fine, but 
 the evolution from making a little animation to controlling it somehow to 
 fleshing it
  out into a game is so natural that recommending a fairly big rewrite is 
 unfortunate.
 
  
 
 I’m a big booster of functional programming, but I’m not sure that the 
 functional drawing paradigm ever really sank in while my son was working with 
 it, rather it felt like you just drew everything backwards with missing 
 parenthesis at
  the end.  I suspect that using the standard imperative GUI drawing code will 
 make perfect sense to him.
 
  
 
 I’m not sure yet if we are going to migrate to the regular GUI code for 
 upcoming work, or jump all the way to OpenGL so he can learn the joys of “Why 
 is the screen all black?”
 
  

Good day. Thank you for this game.
I found one little bug:
I have Windows 10  and das keyboard model s and when i want to press G or 
T, or H  it's doesn't work.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: My son's game in Racket

2015-08-25 Thread Jens Axel Søgaard
Hi,

Does G, T, and H work for you in DrRacket ?

/Jens Axel


2015-08-25 15:59 GMT+02:00 Mr Susnake susn...@gmail.com:

 On Monday, August 24, 2015 at 10:28:07 PM UTC+6, John Carmack wrote:
  We “released” my 10 year old son’s game that was done in Racket:
  www.1k3c.com
 
 
 
  I’m still taking a little heat from my wife for using an obscure
 language instead of something mainstream that is broadly used in industry,
 but I have nothing but good things to say about using Racket and DrRacket
 for a beginning programmer,
   and highly recommend it.
 
 
 
  I can’t recommend 2htdp/universe for this sort of thing, though.  I had
 to drop to the native GUI bitmaps for performance reasons, hack around the
 lifecycle to support a separate editor window, and I still don’t know how
 to make the Quit
   menu item actually exit the app on the Mac version.
 
 
 
  I completely understand the reasoning for the way 2htdp/universe is
 built, and saying that a “real” project should use the grown-up APIs is
 fine, but the evolution from making a little animation to controlling it
 somehow to fleshing it
   out into a game is so natural that recommending a fairly big rewrite is
 unfortunate.
 
 
 
  I’m a big booster of functional programming, but I’m not sure that the
 functional drawing paradigm ever really sank in while my son was working
 with it, rather it felt like you just drew everything backwards with
 missing parenthesis at
   the end.  I suspect that using the standard imperative GUI drawing code
 will make perfect sense to him.
 
 
 
  I’m not sure yet if we are going to migrate to the regular GUI code for
 upcoming work, or jump all the way to OpenGL so he can learn the joys of
 “Why is the screen all black?”
 
 

 Good day. Thank you for this game.
 I found one little bug:
 I have Windows 10  and das keyboard model s and when i want to press
 G or T, or H  it's doesn't work.

 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
-- 
Jens Axel Søgaard

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: My son's game in Racket

2015-08-25 Thread Mr Susnake
On Tuesday, August 25, 2015 at 8:03:43 PM UTC+6, Jens Axel Søgaard wrote:
 Hi,
 
 
 Does G, T, and H work for you in DrRacket ?
 
 
 /Jens Axel
 
 
 
 
 2015-08-25 15:59 GMT+02:00 Mr Susnake sus...@gmail.com:
 On Monday, August 24, 2015 at 10:28:07 PM UTC+6, John Carmack wrote:
 
  We “released” my 10 year old son’s game that was done in Racket:
 
  www.1k3c.com
 
 
 
   
 
 
 
  I’m still taking a little heat from my wife for using an obscure language 
  instead of something mainstream that is broadly used in industry, but I 
  have nothing but good things to say about using Racket and DrRacket for a 
  beginning programmer,
 
   and highly recommend it.
 
 
 
   
 
 
 
  I can’t recommend 2htdp/universe for this sort of thing, though.  I had to 
  drop to the native GUI bitmaps for performance reasons, hack around the 
  lifecycle to support a separate editor window, and I still don’t know how 
  to make the Quit
 
   menu item actually exit the app on the Mac version.
 
 
 
   
 
 
 
  I completely understand the reasoning for the way 2htdp/universe is built, 
  and saying that a “real” project should use the grown-up APIs is fine, but 
  the evolution from making a little animation to controlling it somehow to 
  fleshing it
 
   out into a game is so natural that recommending a fairly big rewrite is 
 unfortunate.
 
 
 
   
 
 
 
  I’m a big booster of functional programming, but I’m not sure that the 
  functional drawing paradigm ever really sank in while my son was working 
  with it, rather it felt like you just drew everything backwards with 
  missing parenthesis at
 
   the end.  I suspect that using the standard imperative GUI drawing code 
 will make perfect sense to him.
 
 
 
   
 
 
 
  I’m not sure yet if we are going to migrate to the regular GUI code for 
  upcoming work, or jump all the way to OpenGL so he can learn the joys of 
  “Why is the screen all black?”
 
 
 
   
 
 
 
 Good day. Thank you for this game.
 
 I found one little bug:
 
 I have Windows 10  and das keyboard model s and when i want to press G 
 or T, or H  it's doesn't work.
 
 
 
 
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users...@googlegroups.com.
 
 For more options, visit https://groups.google.com/d/optout.
 
 
 
 
 
 -- 
 
 -- 
 Jens Axel Søgaard
Thank you for reply.
DrRacket? What is it?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: My son's game in Racket

2015-08-25 Thread Jens Axel Søgaard
DrRacket is the programming environment used to build the game.

Download it here: http://download.racket-lang.org/

Test the keys and let us know if they work or not.

/Jens Axel



2015-08-25 16:08 GMT+02:00 Mr Susnake susn...@gmail.com:

 On Tuesday, August 25, 2015 at 8:03:43 PM UTC+6, Jens Axel Søgaard wrote:
  Hi,
 
 
  Does G, T, and H work for you in DrRacket ?
 
 
  /Jens Axel
 
 
 
 
  2015-08-25 15:59 GMT+02:00 Mr Susnake sus...@gmail.com:
  On Monday, August 24, 2015 at 10:28:07 PM UTC+6, John Carmack wrote:
 
   We “released” my 10 year old son’s game that was done in Racket:
 
   www.1k3c.com
 
  
 
  
 
  
 
   I’m still taking a little heat from my wife for using an obscure
 language instead of something mainstream that is broadly used in industry,
 but I have nothing but good things to say about using Racket and DrRacket
 for a beginning programmer,
 
and highly recommend it.
 
  
 
  
 
  
 
   I can’t recommend 2htdp/universe for this sort of thing, though.  I
 had to drop to the native GUI bitmaps for performance reasons, hack around
 the lifecycle to support a separate editor window, and I still don’t know
 how to make the Quit
 
menu item actually exit the app on the Mac version.
 
  
 
  
 
  
 
   I completely understand the reasoning for the way 2htdp/universe is
 built, and saying that a “real” project should use the grown-up APIs is
 fine, but the evolution from making a little animation to controlling it
 somehow to fleshing it
 
out into a game is so natural that recommending a fairly big rewrite
 is unfortunate.
 
  
 
  
 
  
 
   I’m a big booster of functional programming, but I’m not sure that the
 functional drawing paradigm ever really sank in while my son was working
 with it, rather it felt like you just drew everything backwards with
 missing parenthesis at
 
the end.  I suspect that using the standard imperative GUI drawing
 code will make perfect sense to him.
 
  
 
  
 
  
 
   I’m not sure yet if we are going to migrate to the regular GUI code
 for upcoming work, or jump all the way to OpenGL so he can learn the joys
 of “Why is the screen all black?”
 
  
 
  
 
 
 
  Good day. Thank you for this game.
 
  I found one little bug:
 
  I have Windows 10  and das keyboard model s and when i want to press
 G or T, or H  it's doesn't work.
 
 
 
 
 
  --
 
  You received this message because you are subscribed to the Google
 Groups Racket Users group.
 
  To unsubscribe from this group and stop receiving emails from it, send
 an email to racket-users...@googlegroups.com.
 
  For more options, visit https://groups.google.com/d/optout.
 
 
 
 
 
  --
 
  --
  Jens Axel Søgaard
 Thank you for reply.
 DrRacket? What is it?

 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
-- 
Jens Axel Søgaard

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Continued Fraction Arithmetic Package

2015-08-25 Thread Deren Dohoda
Hello Racketeers,

The continued fractions package has made its first release, complete with
documentation and hopefully enough good examples. You can find it at
https://github.com/derend/continued-fractions

Short story:
(require continued-fractions)
logs, exponentials, trig, hyperbolic trig, precision guarantees, arithmetic
(+ - * /)
(require continued-fractions/bases)
arbitrary base conversion with user-configurable alphabets

Future plans: add the interface for creating custom continued fractions.
Any user-requested content I am good enough to implement.

Enjoy!

Deren

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: My son's game in Racket

2015-08-25 Thread Erik Bernoth
Yes, child learns to program games - awesome! But what I will probably never 
understand is why you game developers always live on planet Windows. You guys 
are also programmers, but I think there is no other programmer population that 
has such a high percentage of Windows people. Even embedded world has 
understood now (thanks to Raspberry, I guess) that there is another world that 
was built by programmers for programmers. It's like being a professional 
Formula 1 driver but only using bikes, because most people who pay tickets to 
watch Formular 1 are bike drivers as well.

Why am I even ranting? There's a new kid in the block, just getting introduced 
to how the world of programming looks like. He can grow up in this world were 
he can code and understand every little bit of his system, hacking his desktop 
manager with 15, and writing a new process handling with 21. Or he can live in 
a world were between UEFI starting the kernel and the API in his high level, 
feature rich IDE there's only magic and he will think he's not supposed to 
understand it. Which kind of kids do we want to have?

(PS: I didn't mention a specific distro or kernel here, because every open one 
is actually fine. Doesn't have to be the same as mine.)

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: My son's game in Racket

2015-08-25 Thread Greg Hendershott
Although I'm not a game developer, I have a past life developing
music/audio software commercially. We developed on Windows because
that's where the vast majority of the customers were, and that was
really the end of the discussion.

Also, although I'm about to exaggerate, I think that for much audio
and game software, the operating system is a bug not a feature. :)  It
stands between you and optimal use of the hardware, and can give you
as grief as well as help.  So, even assuming you rank OSs on some
scale of relative goodness, on an absolute scale you start to feel
they all sort of suck. :)  From the point of view of writing low-level
parts of some kinds of software.

Having said all that, these days I use Ubuntu, Emacs, Racket, and
everything I code is open source or free software. Shrug.

Anyway, an interesting aspect of using Racket for this is precisely
the agnostic, cross-platform GUI support.


On Tue, Aug 25, 2015 at 5:53 AM, Erik Bernoth erik.bern...@gmail.com wrote:
 Yes, child learns to program games - awesome! But what I will probably never 
 understand is why you game developers always live on planet Windows. You guys 
 are also programmers, but I think there is no other programmer population 
 that has such a high percentage of Windows people. Even embedded world has 
 understood now (thanks to Raspberry, I guess) that there is another world 
 that was built by programmers for programmers. It's like being a professional 
 Formula 1 driver but only using bikes, because most people who pay tickets to 
 watch Formular 1 are bike drivers as well.

 Why am I even ranting? There's a new kid in the block, just getting 
 introduced to how the world of programming looks like. He can grow up in this 
 world were he can code and understand every little bit of his system, hacking 
 his desktop manager with 15, and writing a new process handling with 21. Or 
 he can live in a world were between UEFI starting the kernel and the API in 
 his high level, feature rich IDE there's only magic and he will think he's 
 not supposed to understand it. Which kind of kids do we want to have?

 (PS: I didn't mention a specific distro or kernel here, because every open 
 one is actually fine. Doesn't have to be the same as mine.)

 --
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


cross-platform gui (Re: [racket-users] Re: My son's game in Racket)

2015-08-25 Thread Raoul Duke
 the agnostic, cross-platform GUI support.

That trick never works!

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] 2htdp/universe performance

2015-08-25 Thread Stephen Bloch
John Carmack writes:
 The performance problems were related to the larger scrolling worlds. The 
 H2DP versions got slower the more clouds were in the maps.

If the background is basically static but scrolling, you might get a 
substantial performance improvement by

(define background (freeze big-expression-that-builds-the-background))

and using that variable henceforth.  (The “freeze” function renders an image 
expression to a bitmap once and for all, trading memory for time.)  If not the 
WHOLE background is basically static, but you have a lot of repeated elements 
(say, a bunch of identical clouds), you can

(define cloud (freeze big-expression-that-builds-a-cloud))

and use that variable instead of the big expression henceforth.  There’s no 
harm in doing both, e.g.

(define background (freeze … cloud … cloud … cloud … ))

although this won’t buy you any additional performance.

 The idea that you functionally compose images like this:
  ...
 Which draws image1 on top of image2 on top of image 3, which is backwards 
 from the painters order that would draw image 3, then image 2, then image 1.
 
 This imperative, side-effect-ing code is a little less clear to a beginner 
 with the OOP and DC concepts, but It better represents what actually happens, 
 and it is much easier to modify the code without worrying about the nesting.

It’s not clear to me that the imperative style “better represents what actually 
happens,” nor that this matters.

However, there is a big win associated with the functional approach: it forces 
model-view separation from the beginning.  Model-view separation is how almost 
all GUI programs are written, and failures to follow it cause a lot of the 
display bugs in GUI programs.  Students who learn an imperative-first approach 
to GUI invariably end up writing display handlers that modify the model, or 
mouse handlers that draw to the display, causing the aforementioned display 
bugs.

Stephen Bloch
sbloch1...@gmail.com



-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Message signed with OpenPGP using GPGMail