Re: [go-nuts] Simple animation in Go (ie Game of Life)

691 views
Skip to first unread message

Kyle Lemons

unread,
Sep 12, 2012, 7:39:41 PM9/12/12
to klinse...@me.com, golan...@googlegroups.com
One cheap way to do it would be to use MJPEG and create a really basic webapp that exports the image tag on / and the MJPEG stream on /image.jpg. Then all you have to do is generate the images using whatever and encode them as a JPEG and write them.

On Wed, Sep 12, 2012 at 3:18 PM, <klinse...@me.com> wrote:
Can anyone recommend a simple method/library to do basic animation with Go?  I'm just looking to do simple simulations, such as the game of life or flocking, but to be able to see it on-screen as it is changing.  There are a huge number of gui/graphics/game libraries in various states of activity, but many seem focused on the creation of a static image to save.  I'd like to hear from anyone with recent experience doing simple on-screen animation.  Programming is just a hobby for me, and I don't have any web programming experience (but could eventually learn if that's the Go way).  I'm running Ubuntu via VirtualBox on a mac, if that makes a difference.  Thanks in advance for the help!

--
 
 

Larry Clapp

unread,
Sep 13, 2012, 12:30:41 AM9/13/12
to golan...@googlegroups.com, klinse...@me.com
I've been doing exactly that (Life in Go, with simple animation in the browser), so I went ahead and posted my code at GitHub.  Get life4.go and life.html at https://github.com/theclapp/go-life, "go run life4.go", and browse to localhost:6080/life.html.  This is my first ever GitHub repo, so I hope I didn't do anything terribly stupid.  :)

I've only ever run it on Chrome on a Mac, so YMMV as far as actually getting it to work, but the code at least might be illuminating.  (Hmm, actually I take that back, it ran fine on my Linux box (Debian) as well (using Chrome from my Mac).)

This (such as it is) is also the most sophisticated web programming I've ever done, so, again, I hope I didn't do anything terribly stupid.  It looks like you're a newbie too in that respect; w3schools.com has been very helpful to me, though I've picked up various bits of html and Javascript in passing over the past 15 years.

-- Larry

Job van der Zwan

unread,
Sep 13, 2012, 4:05:48 AM9/13/12
to golan...@googlegroups.com, klinse...@me.com
As I understand it, w3schools is horrible (according to web experts). See here:
http://w3fools.com/

Just a warning (I'm not a web developer myself, so I can't claim to know if there's any truth to this).

On Thursday, 13 September 2012 07:41:52 UTC+2, (unknown) wrote:
Thanks for posting your code!  I just ran it, and that's exactly what I was looking for.  I look forward to studying your code and learning from it.  The w3schools site looks to have some great info as well.  Thanks again for the help!

Larry Clapp

unread,
Sep 13, 2012, 9:41:42 AM9/13/12
to golan...@googlegroups.com, klinse...@me.com
Thanks, Job.  I went to w3fools.com and bookmarked several of the references they recommend instead of w3schools.

Their first two criticisms I couldn't care less about: I did not assume w3schools was affiliated with W3C, and I didn't care about their certifications.  The part about inaccurate or misleading information mattered a lot, though.

I've been dabbling in Common Lisp for about 10 years; it always amazed me how the newbies on the CL newsgroup seemed averse to just reading the Hyperspec.  I guess I should follow my own implicit advice and just read the spec for information about HTML5 (et al) instead of using random "reference" sites here and there on the web.  :)  We'll see.

Thanks again for the note.  Whether w3fools is right or wrong, either way I've expanded my reference base, so that's a good thing.  :)

-- Larry

Jeremy Wall

unread,
Sep 13, 2012, 11:00:16 AM9/13/12
to Larry Clapp, golang-nuts, klinse...@me.com
The biggest problem with w3schools is that you don't know when they
are wrong and when they are right. They are right often enough into
lulling you into a false sense of security and then WHAM!!! they hit
you with a doozy of an inaccuracy.
> --
>
>

Job van der Zwan

unread,
Sep 14, 2012, 6:15:37 AM9/14/12
to golan...@googlegroups.com, klinse...@me.com
Maybe this is still appropriate for you, even though it hasn't been updated in over half a year?

https://github.com/ziutek/gst

The WebM example appears to work for me.
Reply all
Reply to author
Forward
0 new messages