Chadwyk.com

The ramblings of a developer

Changing direction to Cocos2d-x

So I know I was really excited to create my own engine from scratch, but I fear at this point in time it is just way too far over my head.  I’ve spent the last several days trying to get SDL or OpenGL to load and display images, with limited success. Once I get an image loaded, I’m unable to really abstract it into a class to load multiple instances.  If I was able to, it wouldn’t be very efficient either because I’d need to figure out how to do texture atlases and texture batching, as well figure a way to manage the textures in memory.  It’s all really complex to someone that hasn’t touched c++ in a long time.

 

At the moment I feel fairly defeated, so instead, for now, since someone has already done all the hard work, I think I’m going abandon my engine attempt and try out Cocos2d-x instead.  It is a C++ version of the Cocos2d-iphone engine which I used to make Lumps of Clay.  It should be fairly similar I think.  Since Cocos2d-x is written in C++ it is cross platform compatible, and I believe the renderer uses OpenGL at the core, but it’s super easy to load images as Cocos2d-x does all the hard work for you .  I just don’t know how compatible it will be if I ever want to port it to devices like the Nintendo Switch. But if the Switch will be incompatible with Cocos2d-x, it would probably be incompatible with my custom engine since they were both going to be OpenGL based.

 

Maybe I’ll try to make a simple game with it, then send my pitch to Nintendo so I can get a Developer Kit, then see how hard it would be to port it.  We’ll see.  For now, I’m going to abandon my own engine and try to get a prototype going this weekend in Cocos2d-x.

 

In the future I can always revisit my own engine project.

 

UPDATE

I hopped on the forum for cocos2d-x and there is a thread about supporting the Switch since it was revealed that the Switch supports OpenGL.  It appears that at least one developer was able to port their game to the Switch from cocos2d-x, so that is good news!  There was not any posts lately on it so I left one asking if anyone else had been able to port to Switch.  Hoping to hear back some positive results!

Early Roadblock

So… It turns out, loading graphics is hard!

 

My goal is to be able to make a basic texture loader class that I can use on any node class in my engine.  This is kind of how Cocos2d-iPhone worked, in a simplified manner.  If I could only find one that was already created someplace that I could utilize…

I was able to get SDL to load images, though it was pretty complicated, and not optimized what-so-ever yet.  Plus if I go this route, I can’t use cool lighting effects.

I think my preferred route is to use OpenGL for that purpose.  However, I started playing with OpenGL and that’s waaaay harder then using SDL.  Though there are some image libraries that are supposed to make it easier.  I am currently trying one called SOIL, but I can’t find much documentation on it at all and the last time it was updated was years ago.  I might look at trying out a different one and seeing if I can get it working with OpenGL.

 

 

Procrastination is my worst enemy…

If you read my last blog post, way back in September you saw that I wanted to start a new game project. I listed a whole bunch of brain stormed ideas and thoughts about what I wanted to do.  Unfortunately I was still working a bit on contracted work so most of my free programming time went to that.  Now that my work on that app is winding down, I’ve been spending most of my time collecting and playing games rather than doing research and making prototypes of games.

 

Today that changes.  For this new project, I am going to settle on using Unity3d.  I really don’t like this idea very much.  For some reason it feels like cheating to me. Even though you are scripting a lot of code, so much is done for you automatically.  I guess this is good, and I should just accept it.  There are so many benefits to using Unity3d rather than something like cocos2d.  A couple are that it’s multi platform so it is easy to port to other systems (Xbox, ps4, iphone, etc).  Also, lots of companies are using it so experience may be good in it if I am looking for new work.

 

The final thing that is swaying my decision is that it was announced this week that a developer’s kit for Nintendo Switch is only going to be 50,000 Yen, or roughly $450. That’s a huge difference in what it cost for WiiU (thousands of dollars).  That alone makes me want to learn Unity. It’s always been a dream of mine to program and play a game of my own on a Nintendo system, and this price point actually puts that in my grasp! Nintendo finally is learning something to get more indy developers on board with the Switch!

 

So where does this leave us? It will probably be a few weeks yet before a Switch dev kit is available.  In the meantime I need to come up with a simple idea for a game.  I’m thinking I am going to keep it simple so that I can learn the basics Unity3d. More than likely I will publish this to the Apple Store with my other apps.  One reason for this is that it is my theory that if you have new apps in the store, your chances are higher to get tickets to WWDC, but we’ll find out. Once I learn the ropes of Unity3d, I’d like to make a new 2d game for the Switch!

 

Hopefully procrastination doesn’t kick back in!

 

 

A New Game

Last night I sat down with the white board and decided to brainstorm some ideas.

Whiteboard game ideas

Style

First I listed the type or style of games that I am interested in making.  I narrowed it down to 4 types.

  • Tower / city defense (Command and Conquer / Clash of Clans style)
  • infinite or dungeon runner (Sonic / Flappy bird style)
  • 3d open world (Minecraft style)
  • top down (Zelda / Final Fantasy / Diablo style)

Genres

  • Midevil
  • Space / futuristic
  • horror (Zombie, Vampire, Ghosts, etc)

Multiplayer

Every game or project I create, I like to add more features, and one that I’ve never worked with is multiplayer support.  I thought of ways to do this.  I thought of 2 obvious methods. The player goes to a list of available users in area and can challenge them, or the server auto assigns a match.  This would probably work the best in a tower defense or runner game the best as the game won’t have a in game avatar to display on screen.  Which brings me to my second method.  Either in the 3d open world, or Zelda style graphics, it could show all the players in the area of the map on screen.  There could be some fighting mechanism to attack or start a battle by tapping on them.

Regarding the battle mode, I haven’t decided if I like alternating turns or just striking whenever the player commands should be better.  I am leaning toward alternating turns, like a typical RPG.

Graphics

A couple ideas I’ve been throwing around are making a 3d game. I don’t think I want to model any artwork though. That is quite a bit to learn how to do.  However if I do go down this path, I may go with the blocky voxel art which brings the retro look and is also easier to do.

With 2d graphics, I’d probably draw graphics with my iPad Pro and Apple Pencil and bring them in to animate using something like Spine.  I could also use voxels or pixel art for a retro look. Pixel art is something I’ve always kind of wanted to get into, but it looks like it may be pretty time consuming.

Another option I thought of was doing something like I did with Lumps of Clay.  That app was completely made with stop motion animation and Play-doh.  I could go the same route, and try construction paper, something like the first episodes of South Park.  However, that sounds like a nightmare, and I really don’t want to go through editing that many photos again.

Level Style

Next I thought about how the graphics should best be rendered for the world itself.  Lumps of Clay was tilemap based and it was pretty easy to do. This of course wouldn’t work with a 3d game. This would require 3d or voxel models of everything. The other option is to have large sprites for everything. I think this would only really be needed in something like an infinite runner for the platforms etc.

Platform

Moving on, which platform or engine do I want to develop this for?  Obviously I want it to run on iOS and I know Swift pretty well at this point. However, it would be pretty nice to be able to build it for other systems like Android, XBox, Wii, PS4, etc.  For this solution I’d need to learn Unity.  Unity seems really cool, however it basically requires me to learn a whole complete new scripting language, and programming interface.  A benefit though, is that a lot of companies are looking for experience in Unity.  For Lumps of Clay, I used Cocos2d and I liked it a lot.  However, the project is barely alive any more and is an uncertainty that it will survive much longer as a viable solution. Spritekit seems to be a pretty good alternative if I want to stay exclusive to iOS.

Revenue

Money! Everyone loves it. Everyone wants it. The question is, how to get it?! With Lumps of Clay, I made 2 versions. Premium with no ads, but still had in app purchases. Also a Free version with ads and in app purchases.  No one has ever made an in app purchase. Most people have downloaded the free version, with a handful of people on the premium.

For this reason, I will only focus on one version. I want to decide this early because I want to incorporate it better in the game play.  For instance, if I make it freemium, I will want to make a game mechanic which limits them from doing certain actions so many times in a period of time.  They would then be able to make purchases to skip this time for example. I’d probably sneak ads in as well.

Database

The last big topic I have on the list is the server side database for multiplayer game play.  I’ve been doing a bit of research on which type may be best to create.  I have a lot of experience in MySQL and it seems pretty basic to me.  However I am told that it isn’t scale-able across many servers if the app blows up big.  Also with large databases it is supposed to be “expensive” on processing.

On the app I am working on for IMVD, the API utilizes REST and JSON commands.  It is pretty simple and seems like something I’d like to implement.

The API also uses noSQL. I wasn’t involved in setting it up or creating that side, but I am told it is scale-able to multiple servers and is pretty quick with large databases. This may be the solution I need – but yet again something else I’d need to learn how to create.

The last solution would be to find a 3rd party service that is meant for this.  The downside to this is that I would then be reliant upon them. If they ever chose to change payment plans, or go out of business, I’d be kind of out of luck.

Final thoughts

Those were my initial brain storming thoughts.  I still have a lot of thinking to do about it.  I think my next steps are going to be to investigate the graphics side of things and make some prototypes.  I’ll go from there and decide what I like best or what will be the easiest for me to proceed.  That should help me decide the style of game.