Skip to main content

Posts

Showing posts with the label cocos2d-X

Bone Rush (PyWeek26)

I've been a regular participant in the pyweek contest. The last time i participated, i tried to use cocos-creator to work as editor for cocos2d (python) and was fairly successful in creating a clone of Reigns (a mobile game about making choices). This time i wanted to replicate the rush fight game, where the faster you tap the faster the game moves. It's pretty fun mechanic and would fit well with the theme "flow". So i got to work with the same workflow i had before, create characters in inkscape and create sprites to be used in game. For a while i pondered about supporting skeletal animation using cocos-creator setup but was not sure if i was going to find time to do it, so i choose to go with sprite animations instead. Creating the sprites was a big deal as i was not sure if i wanted to setup the character in blender / cocos-creator / Inkscape for capturing the animation images. Inkscape quickly fell apart as an option as there was no way i could keep track...

CocosBuilder Plugins

I know that cocos builder is old news by now. People have moved on to sexier more advanced tools for getting things done, namely CocosStudio and SpriteBuilder. I have been vocal about using this editor at work because we have been able to integrate it with our workflow very easily. 1) Ability to create custom classes is just amazing, 2) The animation creation just works. The one thing i do crib about is that there was no way to get those custom classes that we created for regular items integrated to the editor. I've tried to get plugins working a while ago and just gave up because it didn't work. Today i was motivated enough to dig deep and get the damn thing working. I was unable to push to the original repo but have forked and have put in the stuff. Ill try to see if i can extend this to be more useful may be change the renderer to cocos2d-x instead of cocos2d. These are some things ive' been thinking about will have to see where this goes. Just excited to ge...

LoL-Wars Mobile

I've been working on lol-wars for the mobile for a couple of days now. The gameplay is pretty much the same as the original html5 version, but the experience is what i've been working on. The major problem with the html5 version was the use of firebase for handling the communication between the players and also to keep track of who is online. Frankly the code was all messed up and all over the place. I did however learnt how to use angular material and get familiar with the riot's developer api. For the mobile version i've tried doing it with unity, quickly realising that i was spending way too much time without much progress. I was trying to figure out the gameplay flow while trying to figure how it's done and eventually the project got sidelined. I still loved the idea but wasn't able to motivate myself to get it done in unity, so i thought to myself that getting the game done was more important to me than doing it in a particular tech. I needed this ga...

CodeGenerator for CocosBuilder

If you have used cocosbuilder editor for animating / creating scenes in cocos2d-x you would have realised that there is a lot of boilerplate code, the code that is pretty much always copy paste from something you have done before. 1) Initialising the member variables 2) Adding the member functions 3) Binding the member variables 4) Binding the methods to callbacks. 5) Loading the ccb file. All this is pretty much the same for all the classes  you write for using cocosbuilder ui. I've done a bunch of work before parsing the ccb files but never occurred to me that i could write a script to generate the code. That is exactly what happened when one of my colleagues exclaimed.. this is pretty much same code for every class why dont' we write a script for it.. Well that is exactly what i did and here is the git repo for it.. https://github.com/vkbsb/ccbClassGen The usage is simple and will mostly work. I do believe this can still be improved and would like people to ...

Flash animations in GoDot Engine

If you have not heard about GoDot game engine,.. you should check it out right away.. godotengine.org Last time, i wrote a blog post about my experience making a simple physics game to GoDot Engine. Though there are a bunch of free options announced during the GDC this year, i thought ill' contribute to the engine. The one piece that is most important for game dev is the pipeline for the engine. One of the most common tools used for 2D animations is Flash. I have been using a library called Super Animation for almost all the games we've made for android at TMG. It's  a  free tool which lets you convert swf files to .sam files. This file can then be loaded in Cocos2Dx using the Open source loader library  https://github.com/raymondlu/super-animation-samples I thought it would be a good idea to port this cpp library to GoDot so that i understand how to write custom modules for the engine. This is the video of the module in action. I have expos...

Automating CCB Creation

Cocos2d-x is awesome because you can use cocosbuilder for creating scenes / animations with ease. But there could be scenarios where you want to create multiple CCB (cocosbuilder files) like 1) Same animation but different images      You might want to create a large number of ccb files with different images but same animations. This could be done in the code as well but this would make it easier. 2)  Create a starting point for animation.     If you had to move the images around in the ccb but you know for sure that all the images have to be dragged into the scene and animated. So how do we do this?... Well the "CCB" files are nothing but XML files to be more precise they are PLIST  files. So all you have to do is create these XML files using a script of some sort so your manual labour is reduced. Python was the language of choice here because it's very versatile at doing things like these. I was going to use the xml Etree module for hand...

ComicNext

With the advent of the ios/android/wp8 there has been a steady rise in the digital comics market. A very immersive experience with audio / animations and some times even gameplay. This takes the already fun experience of reading comic books to a whole new level. Imagine the your favorite comics coming to life at least partially, with audio and animation effects. This idea has fascinated me and i decided to spend some time trying to figure out how best to do it. Here are some of the goals that i wanted to achieve for this: 1) Ease of creating content 2) Ensure that only the data changes for putting out a new comic. 3) Be Cross Platform Enter ComicNext  A new framework that will make creating digitial interactive comics for mobile phones / tablets very easy. We were able to create a quick prototype of how a comic book would look, you can try it out yourself HERE .  This is obviously in beginning stages and will take time to be widely available but, If you ar...

GloBall

GloBall Icon I've been drafting various ideas for a while and been thinking about getting to actually making them for a while now. Ever since i've started working in the games industry i've started thinking about bigger projects which are obviously going to take longer to develop. But I decided that should not be stopping me from making something quickly like i used to and put it up just for the heck of it. Its' one of those times when im' just eager to finish something and put it up. Here is the text i put down for this game a while ago: Neon Defender 2D Shooting game where you user cubes vs spheres style gameplay to select the type of bullet being shot. The enemies will be of different behaviors like in geometry wars and those from cubes vs spheres. So I called it Neon Defender because i was sure i wanted to go the Geometry Wars art style. Any way from that point it's moved through some hoops. I added the Upgrade mechanics for "loot Drop"...

Cocos2D-X for Android LiveWallpaper

Today i saw a question on the forum  at cocos2d-x.org asking about how to get the cocos2d-x application to run as a live wallpaper. Most of the basics come from the sample application provided by google, but since cocos2d-x is designed under the assumption that its' always used as an application you will have to change a few things here and there. So ive' quickly made some dirty adjustments to the code pasted on the forum to get the sample code running as a live wallpaper. Here is the screenshot of the default one running. Sample Cocos2D-x app as Live Wallpaper Im' excited to see what the cocos2d-x app devs can do once they start developing the live wallpapers. .. Here are the steps you should follow: 1) Open the .java file created in proj.android/src/your packagename/*.java 2) Modify it based on the java file embedded below. 3) Modify the AndroidManifest.xml file to make it behave like a wallpaper. Build and deploy the app just like any other cocos2d-x ap...

Cocos2D-X Memory Management

The last couple of days i have been trying to squash all the memory leaks in our game, this gave me a better understanding about the memory management used by cocos2d-x. It's a little different but with a little care you can get it right. Here are a few facts you should know  Every CCObject has a reference count of 1 when it is created.  If you call autorelease() and dont' retain the CCObject you don't have to call release()  CCNode's destructor calls release() on all its' children once(because it calls retain() in addChild())  If you call retain() or new on a CCObject you have to call release()  This is all straight forward, in fact this is all mentioned in the wiki on cocos2d-x.org website. It gets' tricky when you start using CCTouchDispatcher's targeted delegate and the CCBReader. When you load a ".ccbi" file the following happens: CCBAnimationManager calls retain() on RootNode of the "ccb" RootNode of the "c...

Cut Thy Polygon

Fruit Ninja is an awesome game.. very addictive.. and fun to play.. but if you observe carefully you will see that where ever you slash the fruit.. it is always cut in half.. It is a simple trick to keep things nice and fast. But imagine if you could cut and slice a fruit every which way you wanted precisely the way you wanted.. this is an idea i had for a while.. Slicing enemies into pieces based on slashes. Slicing fruits based on the slashs Creating predefined shapes from a starting shape  and the list goes on.. and it all starts with a line intersecting a polygon and the polygon being cut into two polygons. Before we go any further here are the screens of how the result will look. After 1 cut After two cuts After 3 Cuts Now lets get to the most important part.. Cutting a polygon into two pieces. For each Edge in the polygon:       if Cut bisects Edge           Find point of intersectio...