Duncan Cragg
Posts: 6
Joined: Thu Dec 08, 2016 10:08 pm
Location: London
Contact: Website

Teaching a Functional Programming style via 2D game dev

Thu Dec 08, 2016 10:22 pm

Hiya!

I'm thinking about writing a simple, 2D, sprite-oriented games engine, with a really accessible API.

This would be aimed at teaching kids (and maybe adults) a Functional Programming style - whilst having fun!

It will be written in C and GLES, and of course will be open source on GitHub.

Anyone here find that an interesting idea? Happy to elaborate on what exactly I have in mind..

Cheers!
Duncan

Morphology
Posts: 36
Joined: Tue Jan 10, 2012 11:16 am
Contact: Website

Re: Teaching a Functional Programming style via 2D game dev

Wed Dec 21, 2016 9:07 pm

Isn't that what Raylib is designed for?

raysan5
Posts: 37
Joined: Tue Sep 30, 2014 4:44 pm
Location: Barcelona
Contact: Website

Re: Teaching a Functional Programming style via 2D game dev

Thu Dec 22, 2016 11:25 am

As Morphology state, that's the idea of raylib (http://www.raylib.com). It's been in development for more than 3 years and it's been used with more than 250 students to teach the basis of videogames programming. :)

Duncan Cragg
Posts: 6
Joined: Thu Dec 08, 2016 10:08 pm
Location: London
Contact: Website

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 12:16 pm

Thanks to you both for the pointer, but Raylib isn't about helping non-programmers to program!

As you said yourself, it's designed "to teach the basis of videogames programming", not programming itself.

My idea is to help people of all ages and abilities learn to write satisfying programs in a very high level language, with instant feedback - which is what you can get with making games.

Somewhat like Roblox or Kodu, but with a better programming language.

And as a bonus, it will be easy to create multiplayer games, too!

I've written or prototyped a lot of the code in Java - it's called 'NetMash' - I want to rewrite it in C for speed and portability.

Cheers!
Duncan

User avatar
Paeryn
Posts: 2735
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 12:46 pm

I'm intrigued by the idea of a Functional Programming style in C, especially since C isn't a Functional Programming language.
She who travels light — forgot something.

jahboater
Posts: 4826
Joined: Wed Feb 04, 2015 6:38 pm

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 1:04 pm

Paeryn wrote:I'm intrigued by the idea of a Functional Programming style in C, especially since C isn't a Functional Programming language.
I think the unspecified new functional language Duncan is proposing is probably interpreted, with the interpreter written in C.

C was chosen for portability and speed.

My problem with these languages is that when it comes down to it, the new language is abandoned and a traditional language chosen instead - to do the real work.

OK perhaps bootstrap it in C because C is always available, but then write the interpreter in the new language.
If the new language is incapable of the task, or too slow, then perhaps its a bad choice.

Duncan Cragg
Posts: 6
Joined: Thu Dec 08, 2016 10:08 pm
Location: London
Contact: Website

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 1:41 pm

Sorry - I have been a big vague!

I did say 'API' in the first posting, then 'language' in the second! :roll:

You can do Functional Programming style in C - it's a bit of a trick, but possible. That plus a high-level gaming API such as in Raylib, can give what I want.

But I also have a proper Functional Programming language - that is interpreted in the Java code I wrote. It would indeed, also be interpreted in the C implementation.

Sorry for the confusion.

My problem with these languages is that when it comes down to it, the new language is abandoned and a traditional language chosen instead - to do the real work.
Yup - so I'd have both an API with everything high level, plus the new language, and hope that my language takes over the world and all that.
OK perhaps bootstrap it in C because C is always available, but then write the interpreter in the new language.
If the new language is incapable of the task, or too slow, then perhaps its a bad choice.
The new language interpreter is written in C.

I don't think I'm explaining this too well - or did I?

jahboater
Posts: 4826
Joined: Wed Feb 04, 2015 6:38 pm

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 2:03 pm

Duncan Cragg wrote: I don't think I'm explaining this too well - or did I?
Yes that's fine!
Duncan Cragg wrote: The new language interpreter is written in C.
That's common and should work well.

I was just questioning why it isn't written in the "new language", why resort to another, very old, language?
Unless the older language does a better job, in which case the need for a new language is in doubt ;)

I guess the new language may be specific to games programming and not general purpose like C.
In that case how useful is it for your students to learn?

Duncan Cragg
Posts: 6
Joined: Thu Dec 08, 2016 10:08 pm
Location: London
Contact: Website

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 3:06 pm

I was just questioning why it isn't written in the "new language", why resort to another, very old, language?
Unless the older language does a better job, in which case the need for a new language is in doubt ;)
Um, well my plan is only to take the Java interpreter for my FP language and rewrite it in C. You could program games over the gaming engine in that FP language.

Alternatively, program everything in C over a high-level API. That's the bit I probably need to explain better..
I guess the new language may be specific to games programming and not general purpose like C.
In that case how useful is it for your students to learn?
Well the new language is general purpose, not specific to games. But it would still only be useful to learn if it teaches valuable principles. I'm hoping that its FP nature will give that.

There are four pieces to the whole idea:
  • the FP language
  • the P2P networking
  • the high-level 2D/3D drivers or C API (which I think may be satisfied by Raylib)
  • this high-level C API I'm talking about for writing in C but in a Functional style
The last bit is an API for objects representing gaming elements to update each other when they change. The player is one of those, and gets updated when another player or a gaming element changes, so can update the display.
.

jahboater
Posts: 4826
Joined: Wed Feb 04, 2015 6:38 pm

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 3:19 pm

Do publish your work when its complete!

Duncan Cragg
Posts: 6
Joined: Thu Dec 08, 2016 10:08 pm
Location: London
Contact: Website

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 4:43 pm

jahboater wrote:Do publish your work when its complete!
Have you heard of "README-Driven Development"?

I've started a GitHub repo here https://github.com/DuncanCragg/Onex!

.

jahboater
Posts: 4826
Joined: Wed Feb 04, 2015 6:38 pm

Re: Teaching a Functional Programming style via 2D game dev

Fri Dec 30, 2016 4:56 pm

Duncan Cragg wrote:Have you heard of "README-Driven Development"?
No I have not, but it sounds a good idea.

Return to “OpenGLES”