SFML community forums

General => SFML projects => Topic started by: Sleepless on January 31, 2014, 06:30:50 pm

Title: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on January 31, 2014, 06:30:50 pm
Eleutheromania
Hello and thank you for reading! I thought it would be fun to share my hobby project Eleutheromania with the SFML community. I'm from Sweden so please bare with me if my english is somewhat crude. I would also like to share some of my thoughts and design decisions, as I think it's a good way to identify what you've done wrong and what you've done right. Maybe someone here also can get some inspiration, who knows! I can be a bit of a rambler, so if this post is too long (tl;dr), let me know.

About the game
Eleutheromania is a 2D RPG game that is a work in progress. I've always loved old school RPG games such as Fallout 2 and Arcanum: Of Steamworks and Magic Obscura. What I want to do with Eleutheromania is to mix a big open world with the rich dialogues and flexible quests that can be found in such older RPGs. I also want to give the game a more realistic flavor by adding hunger, thirst and sleep to the game. This is not an easy undertaking for me but it's alot of fun and has been a real learning experience.

Also, to avoid confusion I just want to say that most of the graphics are the work of Reiner “Tiles” Prokein over at Reiner's tileset. I've used his work to fit my needs, and just made the GUI graphics from scratch myself. I'll add a link to his website in the thanks section.

Design
I like using SFML because it is easy to use, got good documentation and an active forum. I like that SFML leaves it up to me as the user to implement all of the game specific details, and does not force me into a specific design.

The world of Eleutheromania consist of world cells, and each cell contains 1000 * 1000 squares, but this number is flexible. I've written a map editor in C# using SFML.net and Winforms. The map editor is also a work in progress, but so far you can add tiles to the world grid in two layers, add static and dynamic actors, zoom in and out, and manipulate actors attributes, such as scale, name, faction etc. The world is saved in an SQL database using SQLite.net.

The Eleutheromania game client is written in C++ and uses SFML 2.1. As I couldn't find a free SQLite C++ wrapper with an acceptable license, I wrote my own. From the start of this project a core design feature has been extendibility and flexibility. I've therefore tried to make it as easy as possible to add new content to the game and to edit existing content. A "modder" can add new graphics, audio, NPC types, texts, fonts etc. without a deeper understanding of the game or programming in general. It is also possible to add new factions to the game and set up its relationship towards other factions.

Eleutheromania uses a event based script system, and Lua as the script language. An NPC for example, lets a script file determine how it should react to a certain event, such as seeing an ally in combat. This system makes the game easy to modify and fast, as all the heavy calculations are done in the native code. Abilities (and in the future, quests and items) also use a similar event based system. It also makes it possible to add new content to the game without the need to recompile the native code.

Earlier in the project I wanted to add physics to the game. I realized after a while that the AI pathfinding became hard to handle because of this, and the AI was already complex enough because of the way I had designed the game world (not fixing static objects to specific grid points etc.), so another problem like physics would be a big hassle. I therefore made the decision to not add physics.

The games AI uses the A* pathfinding algorithm. The algorithm checks against a generated sparse matrix for collisions. The matrix is generated from the worlds static actors and the world tiles. The collision detection in the game supports circles, rectangles and irregular objects consisting of triangles.

Video
http://youtu.be/PoL3KDFFrBU (http://youtu.be/PoL3KDFFrBU)

Thanks
Thanks to Laurent Gomila for making SFML! I'd also like to thank the user Nexus for having Thor open-source. Your code taught me a lot about particle effects. A big thank you as well to Reiner “Tiles” Prokein at http://www.reinerstilesets.de/ for the graphics.

Contact
Feel free to contact me at contactsleeplesscoder@gmail.com.
I don't have a website or devblog, but it would be fun to write a website for Eleutheromania. If I do, I'll add a link here.
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Mercy404 on January 31, 2014, 06:42:12 pm
Wow, that looks really impressive! How long have you been working on the project?

Also, I'm curious, what was wrong with the licenses of the available free SQLite wrappers? Are you going to release your wrapper under a more permissive license to fill the need?
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Nexus on January 31, 2014, 06:48:27 pm
Hey, your project looks very nice! The characters and animations are really well done, also the trees and houses look pretty good. I think the water and grass textures can be improved a bit (less repetitive and less saturated color), but maybe you want them to remind of a certain game.

Is there already a story about Eleutheromania, or are you currently focusing on the game mechanics and the editor?

Also nice to hear that my library Thor helped you :)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on January 31, 2014, 07:26:31 pm
I'm new to these forums, is it ok to reply to two people in the same post?

@Mercy404:
Thanks man! I started on this game about two years ago, but most of the progress has been made during summer and fall this year. It's been an on and off project :)

To be honest with you, it was quite a while ago since I wrote the C++ wrapper, but I think it was because I felt that alot of the wrappers had licenses that wanted you to have open-source or not for commercial use. As I only needed basic functionality for my game, I figured I just could write it myself and avoid them. I've not been thinking about releasing it actually. I guess I would need to test it a bit more rigorously then.

@Nexus
Hello and thanks for your kind words! Yea, I could not agree more with you, most of the objects looks good, but the tiles needs a good rework. As making graphics is not my strong side, I've been thinking about possible solutions for this. It's definitely something I want to change.

There is no story behind Eleutheromania yet, I got some ideas though :). Yes, right now I'm working on game mechanics. I want to add support for projectile based abilities, like fireballs, and to add items.

Thanks for sharing the code :)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: AncientGrief on January 31, 2014, 08:56:47 pm
Hi Sleepless,

I recognized reiner's tiles the second I saw your video :D Remember him back in the days @ clickzone :)

I like your game mechanics, the pathfinding looks really smooth :D And the overall feel is great.
I don't like the tile graphics (maybe because I know some of reiner's games) but besides that, it looks really promising :D Keep up the good work!!!

Regards,
AncientGrief
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: AFS on February 01, 2014, 04:39:30 am
Fantastic work! The AI, the editor, everything  ;D

Just my opinion, but I think the night is way too dark/black. Perhaps you should try adding more blue? Asuming you are using "Sprite::setColor()" to archieve the effect, instead of using, say, "50,50,50" to make the sprites darker, use something like "70,70,100" to get a lighter and blueish night :P

Regardless, that's a damn fine job. Keep it up  ;)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Grimshaw on February 01, 2014, 06:46:13 am
This game immediately attracted my attention! Good to see a project in such a nice state. Can we try it ? :)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: eXpl0it3r on February 01, 2014, 10:36:57 am
This is awesome work, I really like it and hope you'll progress further! :)

Just my opinion, but I think the night is way too dark/black.
Just needs lighting and everything will look different. ;)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on February 01, 2014, 08:09:11 pm
Wow, thanks to all of you for the great feedback! :)

@AncientGrief: I agree with you about the tile graphics, they sure need some work. I got some ideas for this that I want to try using shaders and bitmasks.

@AFS: Glad you like it! Adding some blue to the night would make it look more like a night with a full moon, good idea. Right now I'm using a simple pixel shader that changes the pixels color based on the games current time of day. The GUI layer renders after that pixel shader.

@Grimshaw: I need to fix some small stuff that I noticed while recording the little youtube video, and I'd like to finish the small harbor town I have planned a bit down south on the demo map. Another thing that kinda holds me back from releasing a little demo is that the melee system right now is a bit of a stub until the items are implemented into the game. With that the game will be updated with correct weapon range, weapon damage, correct dynamic actor body colliders for attacks and more mechanics of that sort. I'll upload a demo when I feel happy about this stuff :), I'm really glad you want to try it though!

@eXpl0it3r: Wow, thanks man! Let me tell you, all the nice responses from you guys have really given me a motivational boost!
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: AncientGrief on February 01, 2014, 11:29:24 pm
@AncientGrief: I agree with you about the tile graphics, they sure need some work. I got some ideas for this that I want to try using shaders and bitmasks.

Yeah, but this can wait until the engine works :) I hate myself for being an "eye-person"...can't make something without looking good, even when I just managed to write 5 lines of code hehe.

Would like to see your results in the end :)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on February 02, 2014, 08:13:56 pm
@AncientGrief: Haha, I see what you mean :). Personally, if I have only written "backend" stuff for a long time, it's a nice change to write something that gives more of a direct visual result, so I usually go by what I feel is the most interesting thing to do at the time.
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: therocode on February 04, 2014, 06:24:23 pm
Even if people have written it before me, I still want to say that the game looks great! Impressive work. :)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Azaral on February 04, 2014, 06:28:04 pm
Neat little game
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on February 05, 2014, 02:56:27 pm
@therocode: Thank you! Glad you like it :)

@Azaral: Thanks!
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: slucis7593 on May 10, 2014, 11:16:56 am
Wow, your rpg game is very impressive!

I really love to make rpg game. :D
So, would anyone please give me some recommendation (Books, Website, Video, ...) about how to make a 2d rpg  game like this?

Thank you so much. (Sorry for my English is not good :()
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: zsbzsb on May 10, 2014, 02:12:04 pm
I really love to make rpg game. :D
So, would anyone please give me some recommendation (Books, Website, Video, ...) about how to make a 2d rpg  game like this?

This is really not the place to ask, instead you should make your own thread if you have any specific questions. Making a game is not simple, so you should start with a good C++ book and learn that before even attempting to use SFML.

On topic: Sleepless that game does look really good. ;)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Geheim on May 10, 2014, 07:08:44 pm
Hey Sleepless,
Very cool game you already made, I know its hard work, because I am working on a very similar thing too.

Did you make all the graphics your own? If so, you have some talent ;)
Keep up your good work, I know its gonna be a great game!
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: bcvz on May 11, 2014, 01:46:25 pm
that's impressive !

I was working on a similar project but I had problems with perspective when a player was between two tiles

how did you manage perspective ?

do you draw every tile in a loop or they are attached together and drown in one call ? do you use the sf::sprite class for tiles or vertices ?
thanks
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: lezebulon on May 19, 2014, 08:46:08 pm
Hi !
I'm pretty impressed with what you have done !
I'm wondering : how do you manage the collision detections ?  Is it just a grid or a more complex structure ?
thanks!
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on May 22, 2014, 10:52:43 pm
Wow, so many new replies to the thread! Really cool! I'm really thankful for all the new comments and compliments. I'm sorry that I've not replied until now, I've started at my new job and have had alot on my mind. I'm gonna do my best to answer all the questions, better late than never.  ;)

Since I made this thread I've added texture blending to the games tiles. It makes it alot easier to create a more varied and seemless look. I've also started writing a multiplayer version of the game. I've barely written any code on it yet but I got alot of the design planned out in my head.  ;)
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on May 22, 2014, 10:54:56 pm
Wow, your rpg game is very impressive!

I really love to make rpg game. :D
So, would anyone please give me some recommendation (Books, Website, Video, ...) about how to make a 2d rpg  game like this?

Thank you so much. (Sorry for my English is not good :()

Thanks slucis7593! Well, it's hard to say where you should begin without knowing how experienced you are at programming. If you are new to writing games, I would first do as zsbzsb recommended and learn a programming language by writing small games, like Pong for example. I recommend you to learn to write and design Object Oriented code. I use an event based approach in my game, which is something I learned to use in college. When designing the game core you can take inspiration from existing game engines, for example the UDK.

To write a game like Eleutheromania you will need to learn about Pathfinding (I use a modified A* that I've written), Collision Detection, Vector math amongst other things. I learned about alot of these at school. I'm afraid I don't know any specific books to recommend you, alot of my own design are from projects I've done at school or work.
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on May 22, 2014, 11:25:05 pm
@zsbzsb: Thanks! Glad you like it! :)

Hey Sleepless,
Very cool game you already made, I know its hard work, because I am working on a very similar thing too.

Did you make all the graphics your own? If so, you have some talent ;)
Keep up your good work, I know its gonna be a great game!
Hi Geheim! Thanks for the compliment! No, I do not make all the graphics on my own, thankfully ;).

that's impressive !

I was working on a similar project but I had problems with perspective when a player was between two tiles

how did you manage perspective ?

do you draw every tile in a loop or they are attached together and drown in one call ? do you use the sf::sprite class for tiles or vertices ?
thanks
Thanks! In Eleutheromania, the dynamic actors (like the player or NPCs) are not locked on a strict "grid-to-grid" movement. They are all free to move as they like and the world scrolls after the player on a pixel basis. You can find good articles on this by googling "Scrolling tiles" for example.

I only draw the tiles that are within the visible area of the screen. Those tiles are drawn in a loop. I will maybe write a caching function for this (when it can be applied) to save som CPU performance, but it's not really that big of a deal.

I use sprites for the tiles right now because I had trouble getting the texture blending to work otherwise. I re-use the tiles for the map, so the world map only consists of IDs that tells the tile engine which tile to render. That means that it only exists one copy of each unique tile type. This allows me to have a very big game world.

Hi !
I'm pretty impressed with what you have done !
I'm wondering : how do you manage the collision detections ?  Is it just a grid or a more complex structure ?
thanks!
Hello lezebulon and thank you! I use two systems for collision detection, one for the player and one for the pathfinding. The player is checked against a complex structure of shapes. The NPCs are using the pathfinding algorithm I've written, and it checks for collisions when calculating a path. This algorithm uses a grid that is generated out of the complex structure that the player uses. This grid includes possible collisions from tiles that are not walkable (like water), and static actors (like trees). The grid is basicly a sparse matrix that is on a more detailed level than the ground tiles. Sorry if this explaination is hard to understand :).
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: BaneTrapper on May 27, 2014, 07:24:50 pm
what algorithm you use for path finding? EG: AStar
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Mutoh on May 29, 2014, 03:01:23 am
Hey, Sleepless! First, I would like to compliment on your game. Though I will admit that, as with others, the graphics don't really suit my tastes, I'd say that the general design, layout and flow of the game is very pleasing to the eye. Good job.  :D

But now, allow me to curiously ask: why are you writing your own level editor? I'm using Tiled for my project, which is free and powerful, and I'd say that it does the job flawlessly, it saved me a lot of time I would have spent writing my own editor. Is it because of the isometric view (which I think Tiled maybe does not have)? For scripting the entities? :0
Title: Re: Eleutheromania - 2D RPG - Work in progress
Post by: Sleepless on May 29, 2014, 09:02:57 pm
what algorithm you use for path finding? EG: AStar

A* yes.

Hey, Sleepless! First, I would like to compliment on your game. Though I will admit that, as with others, the graphics don't really suit my tastes, I'd say that the general design, layout and flow of the game is very pleasing to the eye. Good job.  :D

But now, allow me to curiously ask: why are you writing your own level editor? I'm using Tiled for my project, which is free and powerful, and I'd say that it does the job flawlessly, it saved me a lot of time I would have spent writing my own editor. Is it because of the isometric view (which I think Tiled maybe does not have)? For scripting the entities? :0

Thank you Mutoh! I kinda agree on the graphics but for now it will have to do :). I've updated the rendering with tile blending which gives me more freedom to add new tile textures and combine them. I whipped together an example map and took a screenshot. Now I don't need to have "cross-over" tiles between different ground textures.
http://imgur.com/Dl3RGGa (http://imgur.com/Dl3RGGa)

As for your question, I wrote the level editor on my own because of multiple reasons. I wanted to write a native application in C# and I wanted to have total control over it. Tiled is probably a great level editor, I've never used it though. By writing my own level editor I can always be sure that I can add whatever feature I feel like. It's fun to code it as well :).