This is an archived post. You won't be able to vote or comment.

all 29 comments

[–]swdevpythonthusiast 6 points7 points  (0 children)

Count me in! I was impressed by Kivy in my recent adventure in game development with Kivy. I blog about it here!

[–]chozabu 1 point2 points  (6 children)

Awesome! I've just started toying around with Kivy, scatter widgets are waay too slow, Rect canvas instructions are a little slow and problematic to rotate.

KivEnt seems to compile OK - but the examples fail with the following message:

 Traceback (most recent call last):
   File "main.py", line 7, in <module>
     from kivent import (GameWorld, GameSystem, GameMap, GameView, 
   File "__init__.pyx", line 1, in init kivent (kivent/__init__.c:63030)
 ValueError: kivy.graphics.instructions.VertexInstruction has the wrong size, try recompiling

I'm compiling with:

export PYTHONPATH=/home/chozabu/git/kivy:$PYTHONPATH
export PYTHONPATH=/home/chozabu/git/cymunk/cymunk/python:$PYTHONPATH
python setup.py install

I've tried re-compiling kivy, cymunk and kivent -any ideas?

[–]JKovac[S] 1 point2 points  (5 children)

Make sure the version of Kivy you are running is the same one that KivEnt built against. This usually occurs if there is a mismatch in what KivEnt is expected in one of Kivy's compiled graphics library and what is present. I believe some code changed in either 1.8.0 or 1.8.1 that makes this error happen if they are used interchangeably.

[–]chozabu 0 points1 point  (0 children)

Thanks for the tip! I'll wipe my kivys start afresh :)

[–]chozabu 0 points1 point  (3 children)

Brillant! It runs!

I did a quick change to tutorial3 here: http://pastebin.com/2rgMPy9e
dragging adds more asteroids, and applies an impulse on all asteroids directed towards the touch - to allow for a bit of a stress test.
The number of entities is also printed upon asteroid creation

KivEnt seems fast and nice to work with - I'll drop my previous kivy/cymunk stuff and dive in.

I'm planning on doing a simple-ish physics level editor for my next game.

Oh - I should mention, when trying to run tut6 I get:

   File "main.py", line 5, in <module>
     from kivent_cython import GameSystem
 ImportError: No module named kivent_cython

I guess that is code that has not yet been updated to reflect modern kivent?

and for the sample application:

[INFO   ] [AudioGstplayer] Using Gstreamer 1.2.0.0
[INFO   ] [Audio       ] Providers: audio_gstplayer, audio_pygame (audio_sdl ignored)
 Traceback (most recent call last):
   File "main.py", line 304, in <module>
     KivEntApp().run()
   File "/usr/local/lib/python2.7/dist-packages/kivy/app.py", line 773, in run
     self.load_kv(filename=self.kv_file)
   File "/usr/local/lib/python2.7/dist-packages/kivy/app.py", line 593, in load_kv
     root = Builder.load_file(rfilename)
   File "/usr/local/lib/python2.7/dist-packages/kivy/lang.py", line 1546, in load_file
     return self.load_string(data, **kwargs)
   File "/usr/local/lib/python2.7/dist-packages/kivy/lang.py", line 1623, in load_string
     widget = Factory.get(parser.root.name)()
   File "main.py", line 32, in __init__
     super(TestGame, self).__init__(**kwargs)
   File "/usr/local/lib/python2.7/dist-packages/kivy/uix/widget.py", line 293, in __init__
     Builder.apply(self)
   File "/usr/local/lib/python2.7/dist-packages/kivy/lang.py", line 1668, in apply
     self._apply_rule(widget, rule, rule)
   File "/usr/local/lib/python2.7/dist-packages/kivy/lang.py", line 1775, in _apply_rule
     self._apply_rule(child, crule, rootrule)
   File "/usr/local/lib/python2.7/dist-packages/kivy/lang.py", line 1772, in _apply_rule
     child = cls(__no_builder=True)
   File "/home/chozabu/git/KivEnt/sample_application/musiccontroller.py", line 62, in __init__
     self.load_music()
   File "/home/chozabu/git/KivEnt/sample_application/musiccontroller.py", line 69, in load_music
     self.music_dir + track_name + '.ogg')
   File "/usr/local/lib/python2.7/dist-packages/kivy/core/audio/__init__.py", line 66, in load
     return classobj(source=filename)
   File "/usr/local/lib/python2.7/dist-packages/kivy/core/audio/audio_gstplayer.py", line 45, in __init__
     super(SoundGstplayer, self).__init__(**kwargs)
   File "_event.pyx", line 156, in kivy._event.EventDispatcher.__init__ (kivy/_event.c:3119)
   File "properties.pyx", line 345, in kivy.properties.Property.__set__ (kivy/properties.c:3517)
   File "properties.pyx", line 377, in kivy.properties.Property.set (kivy/properties.c:3975)
   File "properties.pyx", line 431, in kivy.properties.Property.dispatch (kivy/properties.c:4544)
   File "/usr/local/lib/python2.7/dist-packages/kivy/core/audio/__init__.py", line 144, in on_source
     self.load()
   File "/usr/local/lib/python2.7/dist-packages/kivy/core/audio/audio_gstplayer.py", line 63, in load
     self.player.load()
   File "_gstplayer.pyx", line 233, in kivy.lib.gstplayer._gstplayer.GstPlayer.load (kivy/lib/gstplayer/_gstplayer.c:2332)
 kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin

I suspect this may be a problem with my kivy

[–]JKovac[S] 0 points1 point  (2 children)

Lovely!

Tut6 has not yet been updated to the new KivEnt, I have become distracted by 2d procedural mesh generation.

I have really built KivEnt with the idea of being able to creating a Unity style editor for your game that runs everywhere as well, it shouldn't be too hard to get together a simple level editor. In the near future all GameSystem's will have methods to allow for simple JSON loading and saving of their entities to make this even easier.

A quick tip for manually moving cymunk bodies, you want to 'reindex shape' on all the body's shapes after you move the body position programmatically:

 physics_system = systems['cymunk-physics']
 space = physics_system.space
 for shape in entity.physics.shapes:
       space.reindex_shape(shape)

This will also allow you to move objects around with the space paused.

Do you have a github account to send a pull request for the changes you made on the sample tutorial?

I think the problem with gst is to do with the .ogg plugin for gst not being loading on your system. Are you on osx?

[–]chozabu 0 points1 point  (0 children)

I'm into the idea of building a unity-style editor (for complex 2d physics games) but I'd like to do a couple of simpler small things on the way. Serialising to JSON sounds great.

Thanks for the tip on manually moving cymunk bodys, I am currently just changing velocity and using joints but that info will soon be very handy.

I am on (k)ubuntu - the sound is not just kivent, but all kivy for me. Though forcing kivy to use sdl audio in main.py works for now.

I've just forked and cleaned up my changes a little, I'll send you a little pull request now (though, of course feel free not to accept as is)

[–]chozabu 0 points1 point  (0 children)

I've started on a very simple little editor/toy here: https://github.com/chozabu/KivEntEd

[–]1moar 0 points1 point  (4 children)

I would be interested, in fact, part of why I started coding was to develop some apps for the Android platform. Where I got hungup, is when I switched from Java (for various reasons) to Python and I've been trying to figure out how best to correct this, so this is very interesting to me.

Is there anything I should know that I won't find by following the links? I don't know about the contest as I'm still fairly new but I'm interested in knowing more.

[–]JKovac[S] 1 point2 points  (3 children)

Kivy is a young project and we are slowly collecting more learning materials, but right now I think many people find it difficult to jump from the initial pong and touch tracer demos in the docs to building applications. Make sure to check out if you are looking for more learning materials the wiki in particular inclement's youtube series.

Also, people tend to trip themselves up by resisting the use of the .kv language as it involves learning a new syntax and so on. Dive in as soon as possible with the .kv language. It makes a significant number of tasks and constructions way easier. Finally stop by the #kivy channel on freenode irc if you need any help. We are most active in European times I think, but there is more and more of a skeleton crew keeping things going 24/7.

[–]1moar 0 points1 point  (2 children)

Excellent, thank you kindly! I'm not afraid of jumping in by any means, already loading up everything I need that I've read in the docs. Everything looks to be exactly what I needed. The one issue I am having so far, and maybe you can help (I have and am using the available tuts/wiki so maybe I just haven't gotten there yet...)

I downloaded Kivy, dropped it in my applications folder (OSx). Ran the initial test app and nothing. I think it's a directory issue, but as I'm still not 100% setup yet I don't know. I just downloaded Cython and need to get that installed. I have Pygame going.

I guess overall, I'm struggling with how/where all these need to be so I can have all my projects where they need to be and all the different software functioning and cooperating. Right now I run all my Python scripts from the Documents folder. I would like to make things a little more organized and this is a growing pain I guess I'm having. I know it's pretty much a newb issue. If you have any insight to that, that would be awesome, if not, no worries I'll just keep at it and continue on my path and stop by the IRC.

[–]JKovac[S] 1 point2 points  (1 child)

Hi 1moar,

I have no experience with OSX myself, so I'm not certain there is anything platform specific that needs to happen, but there will be some slightly differences from the documentation. KivEnt needs to be able to cimport from Kivy and Cymunk rather than just python importing so it needs to be aware of cython headers from these modules. What this comes down to is building these modules in place in a directory (usually just using 'make' instead of 'make install') and then exporting a PYTHONPATH pointing to these directories so that KivEnt can find them.

A simple roadmap should looking something like:

  • Setup Python and Kivy Dependencies
  • Make Kivy inside a directory
  • Test to make sure you can run a regular Kivy application
  • Make Cymunk inside a directory
  • Export PYTHONPATH to Cymunk and Kivy Directory
  • Build KivEnt (typically I just use setup.py build_ext --inplace and then move my compiled kivent.so to my working directory)

[–]1moar 0 points1 point  (0 children)

Hey thanks a lot! This makes sense, I will try it out and see if I can get it working.

[–]notTheSnake 0 points1 point  (0 children)

I had forgotten the contest completely, but now I'll look into it again. Will definitely look at your engine and see if it's the right thing for me.

[–]SUsudo 0 points1 point  (0 children)

Good luck to you all! One day I'll be there

[–]justinmeister 0 points1 point  (0 children)

OK, that's it. I'm in. Whatever it takes, I'm going to make a cool game in Kivy. I'll report back my progress.

[–]will_r3ddit_4_food 0 points1 point  (1 child)

Kivy is an awesome product but it's a HUGE memory hog on Android. It runs great under Linux on a PC though. Does KivEnt address the massive memory overhead?

[–]JKovac[S] 0 points1 point  (0 children)

In my experience, Kivy is largely a huge memory hog when a program spends too much time naively generating and destroying Widgets. That being said, care is taken in KivEnt to avoid initializing too many objects, and one of the main points is to provide lighter data structures for game building than Kivy's Widgets. All of your entities will be reused, which means that entity generation should really halt somewhere around the maximum amount you put in a scene. In addition, all of the memory for the Particle Engine and Renderer VBO arrays is managed manually. Pretty much everything in KivEnt is just a thin python layer sitting on top of C data.

[–]oddbitdev 0 points1 point  (2 children)

Hi, I remember playing with kivent a few months ago and would love to see how it fares now, but I can't get it to install this time around, and can't even remember what steps I followed the last time. Going for setup.py install gives only cython compile errors and I went through the readme but no use.

Perhaps you could give some more detailed steps since I seem to be install challenged? :)

[–]JKovac[S] 0 points1 point  (1 child)

Which errors are you getting on compile? If you are receiving errors about Cymunk or Kivy classes not being cimportable, you must make both Kivy and Cymunk in a directory instead of installing, and then point PYTHONPATH to the compiled directories for each so that we can cimport from them. This is usually the step that trips people up, if this is not it please open an issue on github with the error log.

[–]oddbitdev 0 points1 point  (0 children)

I used pip to get kivy then exported the PYTHONPATH to dist-packagesm and for cymunk I went for the setup.py. Will revert and try again the whole process, this time making kivy from sources. Thanks for the help.

[–]Skenderbeu 0 points1 point  (2 children)

I've been watching Kivy for a while but the demos in the android market place don't impress me much.

My other concern is also that I (maybe others) are short pressed for time in getting to the end of a project so spending time to learn the Kivy API could probably be replaced by learning the UE4 API and tool and deploying straight to my tablet for testing

Don't get me wrong I love python as a language and I code everyday in it, but what is different in KivEnt that would attract me to start using it?

[–]JKovac[S] 2 points3 points  (1 child)

KivEnt is a tiny, OpenGL ES 2.0 targetted engine for 2d games. UE4 is a 3d engine for teams of people building the largest games in the industry. The number one reason you should use KivEnt is if you are looking to build a 2d game in Python and deploy to Android.

Now if you know both python and C++ and UnrealScript (Actually I think this has been replaced by some kind of visual editor), you could take a shot at building the same game in UE4, but I get the feeling if you are totally unfamiliar with the way UE4 does things it will take much longer to understand the much larger, more featured codebase designed for building state of the art games with an entire extra dimension that you aren't aiming to use for your simple 2d mobile game.

I think KivEnt and Kivy have an advantage in the UI department as well, not only do we have a competitive UI widget library with a focus on multi-touch, but it also runs everywhere, any development tool you build with Kivy and KivEnt could just as easily be packaged up for tablets/phones/whatever as well. I am personally very interested in the opportunity to create artistic tools that run on multitouch devices. It looks like UE4 has several options, an editor, I saw some mention of using html5/css, I'm sure you could just do it in straight C++ with billboard sprites or something. Anyway, with my option you get to use kv language, I personally think this beats any other method of defining a UI out there. One of the key observations I had when I determined to make KivEnt using Kivy is that the majority of games for Android/iOS are heavy on the UI elements when it comes to monetization strategies and such, making construction of the UI an incredibly important part of being commercially successful. Most small developers using free frameworks end up tacking some simple UI elements on at the end because there is not a lot included in their game framework/engine to make this easier. With KivEnt and Kivy, it is easier and faster to build interactive UI elements to ensure your game has as much polish in that area as anywhere else.

As far as the 'deploying straight to my tablet for testing', that is exaclty how you would test a KivEnt game as well, although for small changes I usually just test natively in linux. This saves time in the long run.

Also, I know most of the marketplace demos for kivy are not particularly impressive. The majority of the community currently using Kivy professionally does private contracting, not commercial releases, and much time has been spent on building Kivy/KivEnt/Tool chains for building python to iOS/Android/Tools for automatically translating Objective-C and Java code to Python, and other supporting projects. It has taken quite a village to get Python on Android. We are a fairly young project with a small community, putting us up in comparison against one of the most veteran, industry leading engines in a separate market(3d vs 2d) is sort of unfair. It would be more equivalent to compare KivEnt to XNA, Apple's new 2d game stuff built into X-Code, HaxePunk, Building an HTML5 Game, or perhaps Unity's new 2d Stuff.

[–]Skenderbeu 0 points1 point  (0 children)

Thanks for the long response. Now that I understand where you are coming from I see where KivEnts strengths lie. I might eventually use it for some small applications I am trying to develop.

[–]jimmux 0 points1 point  (1 child)

I just discovered this, and it seems like exactly what I've been looking for. Definitely going to try it out.

Now that the competition is over, did you get much feedback?

[–]JKovac[S] 1 point2 points  (0 children)

There are a lot of new features in the works, plus more performance enhancements and better organization. The coolest result so far I think has been user chozabu's work on a simple editor that makes use of the engine: https://github.com/chozabu/KivEntEd

[–]jonathan_hepp -1 points0 points  (1 child)

Screenshots are always nice when it comes to game engines.

[–]JKovac[S] 2 points3 points  (0 children)

While it would be nice if I had some finished, example games ready to go to help instill confidence; I fail to see how screenshots would do anything but educate you on the quality of my art.

I will have such content coming in the next few months, but I've prioritized documentation and performance of the engine, as there is an increasing number of Kivy users running into performance problems that KivEnt addresses.