Archive

Posts Tagged ‘OpenGL’

OpenSource OpenGL 2D RPG Engine (iPhone)

April 10, 2012 8 comments

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 Extension – Vertically and Horizontally flipped Tiles

March 18, 2012 2 comments

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:

October 21, 2011 4 comments

Hey Guys,

attached a BRAND NEW GAMEPLAY VIDEO from my Game. It shows random encounter and the Turn Based Battle Engine. Until now I’ve not implemented a lot of features but time will tell.

I AM STILL LOOKING FOR PARTNERS!! The team is growing and there is already a Composer on Board, but I need still Level Designers, AI Coders, Item Scripters and A STORYWRITER!!!!

Don’t hesitate to contact me!! We can make great things together!

Regards

Markus

The BattleEngine

YOOOO..

finally I started with the Battle Engine. I was discussing a lot with myself if I really should go for a Turn Based Battle System .. Nearly all successful RPGs out there are Action Real Time Combat with a lot of Kaboom and Kabang and so I thought i should maybe do the same.

But fuck it… My first plan was to bring the Old Feeling back, and so I will stick with it. Attached a cool Screenshot from a Combat Scene. Β πŸ™‚

Tomorrow I will bring some Logic in ..

Peace

Markus

 

Scripting Engine & Dialog Trees

Hey Folks,

(Nearly 800 visitors so far πŸ™‚ …)

as you now, my 2D RPG Engine is proceeding very well and I just finished some more major milestones. The scripting engine fully supports now Dialog Trees with Player Input, Global Variables (bool and int), Animations etc..

So everything you need to control whats happening on Screen.

Here are two Screenshots of how it looks like:

The first picture shows the script that gets loaded when the level start ups.. The Programmer can place TransportTile (which will teleport to new levels, Objects (in this case treasureChest) and NPCs..

 

It is very cool, because i can allocate the memory dynamically and then place the necessary objects in the level.

 

The second screenshots shows the script that gets played when the Player interacts with the Treasure Chest. You see IF Statements, playAnimations, wait etc.. Β very cool πŸ™‚

The third screenshot shows how an input Dialog looks like. I was inspired by Star OceanΒ in this scenario and I think it fits good together with the Touch Screen. The programmer can decide the amount of answers.

Well that was it for today…

Have a good time

Markus

 

 

FIRST GAMEPLAY VIDEO

Hey Folks,

the first Gameplay VIDEO is online and can be watched on Youtube. The Script Engine is working, Levels can be loaded and switched , NPCS can talk with the player and some of them walk around … A lot of code, beautiful outcome..

The game is doing really good and I am highly motivated to finish it … Still I Am looking for partners.. So hit me up if you want to join the team..

See the VIDEO: (It is unfortunately on HALF SPEED.. because somehow the video capturer slows down the iPhone Simulator ridiculously….)

Collision Detection = Game Screenshots

September 25, 2011 Leave a comment

Phew, finally I did it. I managed to implement Collision Detection. Instead of studying for the French Exam on College tomorrow I spend 2 days of trying to get this to work. And now it works,.. still it needs some fine tweaks but it works. And quite efficiently. A lit bit of Bit Shifting here and Bit Shifting there and the Character lost his god move and can not walk through Trees anymore πŸ™‚ Poor guy.

Yes, yes, the game is proceeding well and the next step is a Scripting Engine.. First Goal: Set transport points to change worlds and set start point of player.

Big things coming up hehe! But now I have to study first.. stupid school always distracts from the really important things in life πŸ™‚

IM STILL LOOKING FOR PARTNERS TO WORK TOGETHER.. IF YOU ARE INTERESTED.. WRITE A PM!!! Β