Molotov Max [MY FIRST GAME] - Cocos2djs Release!

Hi Everyone,

After a significant amount of effort/frustration/learning, I am very proud and happy to announce my new game - Molotov Max.

I am thankful for the people behind the Cocos2d engine for helping make this possible.

It’s completely free, so take a look, you might like it!

If anyone knows about licensing, I would appreciate it.I was contemplating releasing the code as GPL on GitHub, and I would probably include the spritesheets as well. Having said that, I still want to maintain ownership of the intellectual property of Molotov Max, as well as the characters in the game. Can I release the code as GPL while still maintaining ownership over the brand?

Thanks!

https://play.google.com/store/apps/details?id=com.raifaizen.MolotovJS

EDIT: Now available on iOS too!
https://itunes.apple.com/nz/app/molotov-max/id1047607395?mt=8

3 Likes

Great game! I’d love if you were able to release some source code. I’m also working on a side scroller and running into performance issues which you seem to have solved.

Thanks, that means a lot! I plan on doing that, I just need to figure out the whole brand licensing / GPL issue, which hopefully can be soon. If someone wants to chime in, please do!

In case you are having the same problems I did…
I was having tremendous problems with app startup load time, since at the beginning I add all of the sprites into the spriteFrameCache. Ultimately, my solution was to use lower resolution images (especially for the two boss characters), and it seemed to help quite a bit. The downside of course is that it hurts the graphics on the game, but I preferred that to harsh loading times. Also, if your texture is not a full RGBA8888 (the default setting), you can change how the texture is loaded to save memory like this. Unfortunately, at this time you cannot load the texture under a specific format, you have to change the default format for all textures prior to load, and then change it back as soon as the texture is loaded.

if (imgObj.pixels) { // apply to sprite
    cc.Texture2D.defaultPixelFormat = imgObj.pixels;
}

loadIntoCache(imgObj);

cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888; // return to default


Ah loading assets seems ok on my end. It’s the creation of many moving bullet objects that starts to make the game choppy where as yours seems to be smooth.

Are you using the spriteCacheFrame with the bullet object sprites? If you do not cache the textures/frames, the performance will be slow.

I am not sure if it would help, but you might want to try making a pool of like 50 bullets, and try to recycle them so you are not constantly allocating memory (I didn’t do that, since it wasn’t necessary in my case).

Yeah, I am. I have it cached at the scene once. I also have object pooling. How are you moving your bullets, x++ or are you using actions?

I’m not sure what x++ is. My game used the default chipmunk physics engine, I am not using any actions, all I am doing is applying an impulse to the bullet like this. Once that is called, the bullet travels in the direction of the impulse, no more work required on my end.

bullet.body.applyImpulse(cp.v(-170, 0), cp.v(0, 0));

hmm I will try using physics objects instead of sprites… maybe that will help with movement and collision. thanks

Hello,
congrate!! the game is addactive, I also use Cocos2d-js to develop games. Why dont u build a web version for this game :smiley:

And have u implemented any solutions to reduce the cocos js library size as well as the apk size. I heard that, games made by cocos2d-js are bigger in comparision with cocos2d-x (C++).

Hi Pantoo,

Thank you for the very nice words, I really appreciate it! I am working on releasing it for iPhone as well, hopefully I can figure out how to build it on a Mac soon.

To be honest, I really have not had too many problems with the size of the apk. You can try minifying the code, which might help a little.

I was able to reduce the size considerably by using lower color quality textures when appropriate. You do not need RGBA8888 for everything, in a lot of cases the difference in quality between that and RGBA4444 is hard to notice.

I do not have anywhere to host the web version, plus the controls are really more for touch screens, so I probably wouldn’t do that.

I’m really glad you enjoy!

Hey,
Ok, I love it, and love Cocos2d-js as well. But I always deploy my games for web HTML5, they run smooth and well. I tried to build my games by Xcode then I got “Inavlid native objects” errror. Did you have same errors? Is it easy to build Cocos2d-js games for native platforms like IOS or android? And Did they have different performance on native platforms in comparison with Cocos2d-x written by C++.?

Ugh, don’t remind me! I had a lot of those issues, they are extremely difficult to debug and sometimes stop the game from running on the native platforms - iOS/Android.

They were so problematic for me that I often believe if I should have chosen to use C++ instead of the JS bindings.

Anyway, I am not sure I can help, but these two things were the biggest cause of Invalid Native Object errors for me:

  1. Forgetting to call this._super(); when overriding a method from a cocos base class (such as a Node).
  2. Be careful about the animations with release() and retain(). This is a known issue with cocos2djs, basically, on the animations (and perhaps other things) you have to call them sort of like a malloc / free

thank u, i tried release() and retain(), it ran :smile: So will u choose C++ version to build Games instead of JS version?

The game was finally approved by Apple and is now on the App Store!

Great. Congrats on the release. Feels great, doesn’t it?

Thanks! It does feel good to finally release the game. I’m just glad I didn’t give up on the project, since I had to basically rewrite everything from scratch halfway through :frowning:. Originally I was writing the game in HTML Canvas, thinking that I could do some kind of PhoneGap type solution to have it on Android/iPhone. Unfortunately, I realized way too late in the process that the performance was never going to acceptable on mobile platforms. Luckily I learned about Cocos2dx and I was able to use it as a base for the game and long story short, I finally made it!

If I learned anything in the process it is:

  1. Use an Engine to make your game
  2. See point 1
  3. Test your progress frequently on target devices
  4. Making games is hard!

@craftytrickster the game immediately close when i tap Start game, before that i run it and shoot several bullets.
device: ipad 2, ios 8

I am sorry to hear that. Unfortunately I do not have an iPad in order to test it, however, I have spoken with someone who has used an iPad with the game (do not know which version), and it seemed to work fine. I will ask around more regarding this issue.