GSoC (Google Summer of Code) - Game Engine Kivy

391 views
Skip to first unread message

Cătălin Bălan

unread,
Apr 14, 2013, 12:53:42 PM4/14/13
to kivy-...@googlegroups.com
Hi everyone,

Yesterday night I found Kivy among the projects participating at GSoC this year (first contact with the toolkit) and I noticed that there was an idea for making it feel like a game engine. I've used MOAI (lua and C++), pygame (python), Processing (language for graphic designers), FlashPunk (flash) a very little bit of Unity3D (mono) and probably a couple others along the years, and I was actually hoping to work with MOAI for GSoC, but they didn't get accepted. I've now tried Kivy, and it's actually very cool and not as far as I thought from a game engine. The idea proposed on the Suggested Ideas page however is quite vague and could go in a lot of ways, if no one volunteered to do this yet, I'd be interested in having a discussion related to what would be most beneficial for Kivy to benefit both apps and games.

Game engines usually play a bit different with their objects (Entity, GameObject or sometimes Sprite) than UI toolkits (Widgets). So I tried to use a game engine mindset when programing with Kivy for the first time and tried to make a Missile Commander clone. Have a bunch of Sprites collected in a Scene, every one of those sprites has an update method and handles it's own state, and then let them loose and have them move around and play :).

I attached my first 3-4 hour attempt at getting Kivy to act like a game engine (while going through the documentation repeatedly). I have a Scene widget there which is resolution independent and scales to fit the whole window (without compromising aspect ratio though) that has a main loop to process game logic, does some simple input events, object creation and destruction. The code is not 100% pretty though (did some quick prototyping there plus tried and failed a few times until Kivy listened to me).

Actually, doing that on top of Kivy widgets was much easier than I though and if the goal is to make it feel more like a game engine there's not a lot to do. I might be wrong about the following, but:
  • There seems to be a resource manager already built into Kivy and nicely hidden from the user.
  • There is support for Atlas maps
  • Sprites are easy to build on top of existing elements
There are obviously a lot of things that could benefit game development that don't show up in Kivy, and this is the reason behind this email:
  • Have a different tutorial than that pong, one that's made to focus on game logic and managing game objects and doesn't deal with layout that much.
  • A simple Particle System
  • (as suggested) A simple grid/tile manager
  • Support for Texture Packer http://www.codeandweb.com/texturepacker (this would actually be implemented as an export format for Texture Packer and then used directly from atlas, probably 0 change in Kivy code)
  • Support for Box2D for physics http://box2d.org/ (I am pretty sure there's a port for python as well)
  • And there are probably several more possible additions...
I'd really like to help and talk a bit more about how and if I can contribute with this :).

Best regards,
Cătălin Bălan

PS. The assets contained in the archive are from a tutorial for MOAI SDK.
MissileCommand.zip

Gabriel Pettier

unread,
Apr 14, 2013, 1:57:33 PM4/14/13
to kivy-...@googlegroups.com
Hi

see inline answer

On Sun, Apr 14, 2013 at 09:53:42AM -0700, Cătălin Bălan wrote:
> Hi everyone,
>
> Yesterday night I found Kivy among the projects participating at GSoC this
> year (first contact with the toolkit) and I noticed that there was an idea
> for making it feel like a game engine. I've used MOAI (lua and C++), pygame
> (python), Processing (language for graphic designers), FlashPunk (flash) a
> very little bit of Unity3D (mono) and probably a couple others along the
> years, and I was actually hoping to work with MOAI for GSoC, but they
> didn't get accepted. I've now tried Kivy, and it's actually very cool and
> not as far as I thought from a game engine. The idea proposed on the
> Suggested Ideas page however is quite vague and could go in a lot of ways,
> if no one volunteered to do this yet, I'd be interested in having a
> discussion related to what would be most beneficial for Kivy to benefit
> both apps and games.
>

Great :)

> Game engines usually play a bit different with their objects (Entity,
> GameObject or sometimes Sprite) than UI toolkits (Widgets). So I tried to
> use a game engine mindset when programing with Kivy for the first time and
> tried to make a Missile Commander clone. Have a bunch of Sprites collected
> in a Scene, every one of those sprites has an update method and handles
> it's own state, and then let them loose and have them move around and play
> :).
>
> I attached my first 3-4 hour attempt at getting Kivy to act like a game
> engine (while going through the documentation repeatedly). I have a Scene
> widget there which is resolution independent and scales to fit the whole
> window (without compromising aspect ratio though) that has a main loop to
> process game logic, does some simple input events, object creation and
> destruction. The code is not 100% pretty though (did some quick prototyping
> there plus tried and failed a few times until Kivy listened to me).

Hehe, that's a nice little game, and the code seems to make good use of
kivy, not bad at all :).

>
> Actually, doing that on top of Kivy widgets was much easier than I though
> and if the goal is to make it feel more like a game engine there's not a
> lot to do. I might be wrong about the following, but:
>
> - There seems to be a resource manager already built into Kivy and
> nicely hidden from the user.
> - There is support for Atlas maps
> - Sprites are easy to build on top of existing elements
>
> There are obviously a lot of things that could benefit game development
> that don't show up in Kivy, and this is the reason behind this email:
>
> - Have a different tutorial than that pong, one that's made to focus on
> game logic and managing game objects and doesn't deal with layout that much.
> - A simple Particle System

There is the panda particle project that builds a particle system on top
of kivy, seems to fit integration nicely
https://github.com/chaosbuffalolabs/ParticlePanda
(see
https://groups.google.com/forum/#!msg/kivy-users/-u1SrDQDmMQ/Z-1W1Zf-MoIJ)

> - (as suggested) A simple grid/tile manager

Yeah, being able to manage Tiled (http://www.mapeditor.org/) files
natively would be nice, for example.

> - Support for Texture Packer http://www.codeandweb.com/texturepacker (this
> would actually be implemented as an export format for Texture Packer and
> then used directly from atlas, probably 0 change in Kivy code)

Good idea :)

> - Support for Box2D for physics http://box2d.org/ (I am pretty sure
> there's a port for python as well)

There is a Cymunk (https://github.com/tito/cymunk) integration
available, Cymunk being a cython implementation of pymunk (python
bindings from chipmunk http://chipmunk-physics.net/), this is
incomplete, but other people have shown interest in completing it, so
there can be collaboration on that, i guess :).

> - And there are probably several more possible additions...
>
> I'd really like to help and talk a bit more about how and if I can
> contribute with this :).

Surely there can be improvement in this direction, even if kivy is a
thin/flexible enough wrapper not to compromise building games, it could
probably be made much more helpful, be it natively or using external
projects.

>
> Best regards,

Same :) and thanks for your interest!

> Cătălin Bălan
>
> PS. The assets contained in the archive are from a tutorial for MOAI SDK.
>
> --
> You received this message because you are subscribed to the Google Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Kovak

unread,
Apr 15, 2013, 5:10:56 PM4/15/13
to kivy-...@googlegroups.com
Hi,

I'm the lead designer at Chaos Buffalo Labs, we're the guys that built Particle Panda. We've built an unreleased infinite runner, and I'm currently working on a top down 2d game using kivy that includes chipmunk for physics and collision via cymunk and our kivy particle for particle effects.

On Wednesday we'll be releasing a new version of kivy particle that has 10-50% better performance on my test device (Asus Transformer TF101) as well as some bug fixes.

I've also been working on cymunk getting more features enabled.

If you're interested in hearing more in-depth about my experience working with kivy on game development you can shoot me an email or a gchat at kova...@gmail.com

Mathieu Virbel

unread,
Apr 17, 2013, 5:26:08 PM4/17/13
to kivy-...@googlegroups.com, r1char...@gmail.com, Thomas Hansen
Hi Catalin,

I would like you to talk with Richard Jones. He have some greats ideas
about what is really missing from Kivy to be a good game engine. He's
also co-author of Pyglet, and made the "Match 3" game on the google play.

What i can say is:
- You could improve our resource manager and Atlas.
- Experiment and see if creating a lighter base for a Sprite (Scatter is
heavy, and Widget might be too) would be useful or not, and what would
be the impact for an end-user
- The Chaos Buffalo Labs already did a good particle engine. I would
advice to _not_ redo one, but contribute to the work they done.
- Grid/tile manager +1
- Support for texture packer would be good. But see also the work i've
introduced (hidden, but it still here):
https://github.com/kivy/kivy/blob/master/kivy/tools/texturecompress.py
It's a tool for saving compressed texture into a .tex, with a json
header. Easy to extend, easy to use. We could even put png or jpeg in it
at the end.
- About Box2D, i would like to say, we already got pymunk examples, and
cymunk for android. Pymunk is more used with kivy, but we miss a
PhysicContainer (just a container that abstract the physics view of an
object, and correctly update the widget information out of it.)

Anyway, good luck!

Mathieu
> * There seems to be a resource manager already built into Kivy and
> nicely hidden from the user.
> * There is support for Atlas maps
> * Sprites are easy to build on top of existing elements
>
> There are obviously a lot of things that could benefit game development
> that don't show up in Kivy, and this is the reason behind this email:
>
> * Have a different tutorial than that pong, one that's made to focus
> on game logic and managing game objects and doesn't deal with layout
> that much.
> * A simple Particle System
> * (as suggested) A simple grid/tile manager
> * Support for Texture
> Packer http://www.codeandweb.com/texturepacker (this would actually
> be implemented as an export format for Texture Packer and then used
> directly from atlas, probably 0 change in Kivy code)
> * Support for Box2D for physics http://box2d.org/ (I am pretty sure
> there's a port for python as well)
> * And there are probably several more possible additions...
>
> I'd really like to help and talk a bit more about how and if I can
> contribute with this :).
>
> Best regards,
> Cătălin Bălan
>
> PS. The assets contained in the archive are from a tutorial for MOAI SDK.
>

Catalin Balan

unread,
Apr 17, 2013, 6:53:18 PM4/17/13
to kivy-...@googlegroups.com, r1char...@gmail.com, Thomas Hansen
Hi everyone!

Most of these tips are great pointers and so far, and are pretty much similar to what I see missing. Current goal is to implement a simpler sprite that doesn't rely on Scatter, some performance optimizations and porting and integrating external tools (maybe Chaos Buffalo Labs particle system, maybe cymunk) and extending the API in a way which doesn't break kivy's current architecture. Actually that will be a main focus, keeping the API consistent (more on that later, if the project will get accepted :D)

As of tomorrow afternoon, I'm pretty much done with the university so I'll have quite a lot of free time dive further and propose an actual project draft for GSoC. This week has been quite hectic.

Thanks again Kovak for that chat, and Richard I'm looking forward to contacting you after I hand in my current assignments for the university (tomorrow afternoon - Europe time).

I won't be looking at box2D for now as the port seems to be less mature than chipmunk, but again, I still have to read some more of kivy until I can make some final decision about what to work on.

If there's anything else you wish to add here, I am listening for feedback and I'm still researching the topic.

Thanks again!
Cătălin

Cătălin Bălan


You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/_5adduUg5tI/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.

Kovak

unread,
Apr 17, 2013, 8:16:50 PM4/17/13
to kivy-...@googlegroups.com
On the subject of Box2d versus Chipmunk:

There are a few reasons I ended up choosing to work with chipmunk for my current project, despite Box2d being more common in many engines

1. Based on what I've read chipmunk is more optimized than Box2d is, in python we have less room for error speed-wise so a faster physics engine is of course desirable

2. Chipmunk is unit independent, Box2d has been tuned for specific units of measure.

You can read a pitch on the subject from the creator of chipmunk here: www.cocos2d-iphone.org/forum/topic/20201 (although it is slightly outdated)

Catalin Balan

unread,
Apr 28, 2013, 10:49:02 AM4/28/13
to kivy-...@googlegroups.com
Hi again,

Went a bit further with what I can and can't do (and what people seem to want here) and I made a first proposal draft. Would you guys want anything else to show up in there? Anything restructured? Anything mentioned there I shouldn't do for the project... and well can you give me some feedback before I send it to big ol' Google?

Thanks,

Cătălin Bălan


--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/_5adduUg5tI/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Cătălin Bălan


Catalin Balan - Kivy as a game engine - proposal draft.pdf

John Lawman

unread,
Apr 29, 2013, 6:31:37 AM4/29/13
to kivy-...@googlegroups.com
What if you defined an "interface" layer instead? That way any backend can be plugged-in.

Layer example 

Kivy-based app (your game)
Kivy library (our favourite library with interface definition!)
interface code (interface wrapper "linking" to game engine below)
game engine library (e.g. Pyganim, cocos2d)

Hope this makes sense :)

Cătălin Bălan

unread,
Apr 29, 2013, 7:27:42 AM4/29/13
to kivy-...@googlegroups.com
That is an interesting idea, I might actually explore it for the next month, but it is a bit complex to include it in the actual project proposal before the deadline.

On the other hand, the idea on the suggestion page said that new developers who want to make games find it hard to figure out how to make games in Kivy. In my understanding the target group was people who want to make games, not advanced or expert developers who want to use their own tools with kivy.

It's still a nice idea, not saying otherwise, just a bit complex to tackle in 4 days to analyze and include in the proposal.

--
Cătălin Bălan

Sent from my phone, please pardon my brevity.

John Lawman

unread,
Apr 29, 2013, 7:35:35 AM4/29/13
to kivy-...@googlegroups.com
Fair enough :)

The major benefit of Kivy and simplifies a lot of development and I'm currently using it to write a game. 

I'm looking forward to seeing your project.
Reply all
Reply to author
Forward
0 new messages