We are looking for people!
C++ WebSocket server – Source-Code released
Hey folks,
I open sourced my C++ WebSocket Server implementation. It is a pretty basic C++11 server running on POSIX/MacOSX systems. It supports the most recent WebSocket implementation and works fine with Chrome/Safari and Firefox. Windows is not supported on purpose.
It was an awesome learning process to write it and I learned so much about HTML etc, that I can suggest for anyone who is interested in low level network programming to do the same.
The server supports MYSQL, JSON and runs on multiple threads. So quite cool 🙂
The read loop is not yet finished tho.. If you for example stream a big video file, the current thread will be blocked until it is received. That is a no-go and i am working on fixing it!
The runloop is based on select (shame on me i know) and uses the same principle NodeJS uses for example. One steady loop with event callbacks.
Check it out:
2D Level Editor released
Hey Folks,
i finally released the level editor for my 2D RPG Engine. It is written in C++ and Objective C. The rendering engine is OpenGL (nearly the same as in the 2D RPG Engine) but the interface is 100% Cocoa.
Interested? Visit: https://github.com/MarkusPfundstein/2D-Engine-Level-Editor and clone!
Peace
OpenSource OpenGL 2D RPG Engine (iPhone)
Hey guys,
if you are following this blog long enough than you surely know that I was writing a 2D RPG Engine about 9 months ago. Well, i stopped the project at the end of last year due to more interesting stuff but had a lot of questions in the last time if I couldn’t make it available for the community.
So here we go.. Download the Engine Source code here:
https://github.com/MarkusPfundstein/OpenGL-2D-RPG-Engine-iPhone
READ THIS: – The code is by NO MEANS perfect. It was the first time that I approached a big project like this, so stuff is sometimes a bit messy. Especially the implementation of the script engine is nothing i am proud of but ok 🙂 I think for learning purposes it is pretty good. The engine can render up to 3000×3000 tiles on 60 fps on a ipod 4th gen.. That is quite powerful 🙂
Okidok! Have fun..
P.S. The source code for the Level Editor written in Cocoa and C++ will be online next week! Stay tuned 🙂
Cocos2dx Extensions: CCValue
Hey guys,
i added another small extensions to my github. It is a template class which can be used like the NSValue class from the Cocoa library so basically speaking it allows you to store structs like CCRect/CCPoint in CCArray and CCDictionary which can be incredible useful sometimes.
Clone it here: https://github.com/MarkusPfundstein/Cocos2DX-Extensions
Some example code:
CCRect t1; t1.size = CCSizeMake(100, 200); t1.origin = CCPointMake(10, 33); CCValue<CCRect> *value = CCValue<CCRect>::valueWithValue(t1); CCArray *array = CCArray::arrayWithCapacity(2); array->addObject(value); CCRect t2; t2.size = CCSizeMake(100, 200); t2.origin = CCPointMake(10, 33); CCValue<CCRect> *v2 = CCValue<CCRect>::valueWithValue(t2); CCValue<CCRect> *v3 = static_cast<CCValue<CCRect> *>(array->objectAtIndex(0)); CCValue<CCRect> *v4 = CCValue<CCRect>::valueWithValue(v3); CCRect rectv4 = v4->getValue(); rectv4.size = CCSizeMake(10,10); if (v3->isEqualToValue(v2)) { CCLog("Equal"); } if (v3->isEqualToValue(v4)) { CCLog("still equal"); }
CCX Extensions
Hey guys. I was pretty irritated by the fact that there was no NSNumber style class in cocos2dx. This made it impossible to use CCDictionary to transport ints and doubles.
To solve it, I wrote a small template class which is based on CCObject and can be used smoothly with CCDictionary and CCArray.
Link:
CCX Extensions
Example:
first: CCXNumber<unsigned long long> *veryLong = CCXNumber<unsigned long long>::numberWithValue(13013123.2312132); myCoolDict->setObject(veryLong, "key"); later: CCXNumber<unsigned long long> *storedLong = static_cast<CCXNumber<unsigned long long> *>(myCoolDict->objectForKey("key")); CCLog("%llu", storedLong->getValue());
Have fun
Cocos2dx Extension – Vertically and Horizontally flipped Tiles
Hey guys,
for a new game i am currently working on, I decided to use the cocos2dx library in combination with the tiled level editor. After writing several 2d engines from scratch I decided that it is just too much work to get it really really right (especially with a this cool features, that modern games must have) and that I actually wanted to start making a game. The library its just awesome and was currently released as version 1.0.
One thing I found out yesterday that there was no support for flipped tiles when exporting a map from the Tiled Map Editor. I think that this was a big shame and digger into the source codes of both, Cocos2dx and Tiled to find out the right way to to implement it. You can get the final result here:
https://github.com/MarkusPfundstein/Cocos2DX-Extensions
It was actually pretty easy. Tiled Editor stores all maps in TXML format which is actually a dialect of the XML format. When saved uncompressed, you can see that maps are stored like this:
…
<layer name=”Tile Layer 1″ width=”5″ height=”5″>
<data>
<tile gid=”1″/>
<tile gid=”2147483649″/>
<tile gid=”0″/>
<tile gid=”2147483650″/>
<tile gid=”2″/>
<tile gid=”1073741825″/>
<tile gid=”3221225473″/>
<tile gid=”0″/>
…
In this example, the tile vids with 1 and 2 are the original tiles 1 and 2 unflipped. This high integer values are the tile values for flipped tiles.
I found out, that the guy who implemented flipping in the Tiled Editor uses two bit flags to check wether a tile is flipped or not.
Horizontally Flipped = 0x80000000
Vertically Flipped = 0x400000000
So in order to determine if a tile is flipped we just have to check against these two flags and than clear the gid. Pretty easy 🙂
To use it, download the two source files and replace them with those in you current cocos2dx library. It will work out of the box (supposed that you don’t have made any changes on your own) 🙂
The only affected cocos2dx method is CCTXMLLayer::appendTileForGid( … )
It is a very basic implementation until now and supports the flipping of tiles at the parsing stage. If you want to change or add tiles at runtime you are on your own 🙂 But I believe most of us won’t do it.
Have fun!
Markus
Hint 1: Using flipped tiles reduces the size of your tile set dramatically and allows for more proper level design.
Hint 2: Press ‘x’ or ‘y’ to flip on the respective axles.
Pictures of my new game:
Short update
Hey,
i know it was quite calm the last 2 month on my blog. The reason for that is that we had an awful huge amount of work at work to do. Deadline after deadline after deadline. But nevertheless I focused on game development in my free time and have quite some nice stuff in the pipeline.
More info on that will come soon. I also planned to write more tutorials so keep coming back and look if there is something new. I see that I have a constant traffic due to my tutorials so the interest is there. Its just always a lot of work to write one (as most of you probably know 🙂 ).
So, see you around 🙂
Markus
P.S. The walking dead series rooocksss! 🙂
News RPG Project
First of all: HAPPY NEW YEAR !!!!
Second:
The RPG project was a little bit quiet the last three months, but that didn’t mean that we were not working on it. The team has grown to four people and consists now of a Game Designer, an American who lives in Beijing and works there at a Chinese Game Company, a Swedish composer, who is so god damn talented that it scares me, a 2D Pixel artist from Amsterdam with an incredible talent for character design and last but not least… me, the nerdy programmer and some how manager of this all. Together we will work hard in 2012 to realize our project.
The goal for the next year is to design all the necessary production tools to develop and further to create a 2 hour long game which introduces the player to the world and the main characters. After that we will try to find a publisher! So, if you know one, let me know 🙂
We have awesome ideas in our design paper right now and I can tell you, this RPG is about to become great. It will be an awful lot of work but we love what we do and that is what drives us forward.
So lets hope the world will remain after 21.12.2012 ^^
Peace
Markus