• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[C++] Tibia Simulator

Bredaase

Programming Newb
Joined
Dec 22, 2015
Messages
142
Reaction score
36
Welcome to my thread.

Tibia Simulator (console)

CURRENTLY ON HOLD
Probably going to continue with this project in the next few weeks since I have started reading a book about c++ and using codesdope.com to rehearse the basics of c++.
FAQ

What is this Thread about?

It is about a project I am working on to improve my C++ knowledge. In this thread the progress of the project will be posted. Furthermore, suggestions from other users (which will challenge my programming skills on a realistic level) will be accepted and are always welcome. Of course, constructive criticism is more than welcome.

What is the 'Tibia Simulator'?
The Tibia Simulator is a console application created by me. It is a very basic program which will simulate the Tibia mechanisms such as, leveling, quests, skill system and items (trading and functionallity). It is not supposed to be a useful or fun program since it is more focused on 'skilling up' my programming skills. Please keep this in mind when giving constructive critcism.

How much experience do I have?
I programmed or scripted (unprofessionaly) occasionally but it were only very minor and basic things due to a lack of time. For the past two or three weeks I have read C++ tutorials and made small programms to enhance my C++ skills (learning by doing, trial & error). I have a good understanding of how things work and aim to start studying IT at a local University at the end of this year.

Goal of this project/thread?
The goal of this project is (as mentionted before) to get better at programming.

The goal of this thread is to show this projects progress and to gather suggestions and help. More experienced programmers are asked to help with problems or give suggestions.


Project Details

Current version: 0.1a

Current Progress:
[] Welcome Screen
[x] Main menu which can be operated by arrow keys
[x] Account Creation System
[x] Account Management System (including login)
[x] Game Menu
[] Character System
[] Vocation System
[] Hunt System
[] Quest System
[] Task System
[] Inventory & Trade System
[] Skill System
Note: Changes Possible, progress list not in order.

Github link: https://github.com/TheRealShroom/Tibia-Simulator


Pictures: (1) Main Menu https://imgur.com/a/dqhhk



Thank you for reading my thread.
 
Last edited:
So Random Event System, Random NPC Quest ( upto 10 per npc once done can not be done again maybe in level 1-10 11-20 you know stages )

Dungeons with bosses dropping Special Items also use ENUM for easier labeling of items :) like in yurots engine along with id or some other sht
ASCII art of equipment would be a fkin legend so maybe xD?
but console would have to be like 800x600 to make it look nice and be able to kinda sprite around :D
 
Last edited by a moderator:
Small update:
  • account creation is almost done only need to make the login menu (but thats a task for tomorrow and shouldnt take longer than 30 minutes). I will upload it to github once I am done.

So Random Event System, Random NPC Quest ( upto 10 per npc once done can not be done again maybe in level 1-10 11-20 you know stages )

Dungeons with bosses dropping Special Items also use ENUM for easier labeling of items :) like in yurots engine along with id or some other sht
ASCII art of equipment would be a fkin legend so maybe xD?
but console would have to be like 800x600 to make it look nice and be able to kinda sprite around :D

Yeah I had that idea too but I was thinking only to display the items if they are a rare drop from a monster since it would be a pain in the ass to make ascii art compatible with equipment slots and position it right :D I will implement the random event system in a later update if it comes that far since I want to focus on the basic systems yet (just like tibia did back when they first launched Tibia.
 
Why c++?

Good luck!

Good question. C++ is a very high level language and I was always interested in learning it since I got into OTS. However, by learning C++ I don't aim to use it for OTS since this community is dying and OTS are more like an expensive, time-consuming hobby. I recently talked to a family member who works at Audi and who is programming the interior for new cars (yes, the prototypes not only for Audi but aswell for Lamborghini, etc.). He is a very good programmer and I told him about my efforts and he told me that no matter which language, the Syntax doesn't differ that much. If you know one already then you will learn new ones way easier. C++ is a hard language to learn for beginners but I think I am getting a good hang of it. So in conclusion, I learn it because you can do so much with it and it is not as hard as assembly or pascal which would probably be a real pain to learn as first language. I think to start with any type of C language is ambitious but is also rewarded with much knowledge.

May I also ask why you are asking?
 
If you interested in improving your C++ skills. I have a pretty good book on it, if you send me your skype I can send you it. Starting Out With C++ From Control Structures through Objects, it's what was used in my computer science intro class.
 
Small update:
  • account creation is almost done only need to make the login menu (but thats a task for tomorrow and shouldnt take longer than 30 minutes). I will upload it to github once I am done.





Yeah I had that idea too but I was thinking only to display the items if they are a rare drop from a monster since it would be a pain in the ass to make ascii art compatible with equipment slots and position it right :D I will implement the random event system in a later update if it comes that far since I want to focus on the basic systems yet (just like tibia did back when they first launched Tibia.
no i mean like the main quest items they could be showed in ASCII and text along with them :D on milestones?
 
That's real nice that you are trying to learn by yourself. If you don't mind I would suggest that you read the Google C++ Style Guide.
I saw your code and you are doing some pretty bad practices, check out the guideline for conditionals here.
Good luck.
 
That's real nice that you are trying to learn by yourself. If you don't mind I would suggest that you read the Google C++ Style Guide.
I saw your code and you are doing some pretty bad practices, check out the guideline for conditionals here.
Good luck.
There isn't too much wrong with his conditionals. I prefer space in the parenthesis if (x == 5) as opposed to if (x==5) but everything is subjective and is dependent on what the coding standards on a particular project are. As for the curly braces, a lot of company's standards are to put the brace on a new line. I think its more important that he codes with a consistent style throughout his code than to follow a specific standard, especially since he's just learning the general language and shouldn't be trying to memorize a standard on top of that.
 
If you interested in improving your C++ skills. I have a pretty good book on it, if you send me your skype I can send you it. Starting Out With C++ From Control Structures through Objects, it's what was used in my computer science intro class.

Sure I just don't remember my skype name anymore and I would have to download skype I will send you a PM though, thanks!

no i mean like the main quest items they could be showed in ASCII and text along with them :D on milestones?

Yes, I will try to do that :)

That's real nice that you are trying to learn by yourself. If you don't mind I would suggest that you read the Google C++ Style Guide.
I saw your code and you are doing some pretty bad practices, check out the guideline for conditionals here.
Good luck.

There isn't too much wrong with his conditionals. I prefer space in the parenthesis if (x == 5) as opposed to if (x==5) but everything is subjective and is dependent on what the coding standards on a particular project are. As for the curly braces, a lot of company's standards are to put the brace on a new line. I think its more important that he codes with a consistent style throughout his code than to follow a specific standard, especially since he's just learning the general language and shouldn't be trying to memorize a standard on top of that.


Thank you for your suggestion. I don't know or maybe I should say that I don't think there is a general "way" of coding. As @Athena1 said I prefer my paranthesis with space and the curly brackets on a new line since it looks more clear to me. Of course, if it is a bad habit I should try to do it diffrent in the future. I will try to look more into that, thanks for bringing it to my attention. BTW, I am more concerned about the practical content e.g. if I do things which could/should be done in a diffrent/better/easier way.

I will continue to work on it now. I have made a new PC build yesterday and it took me longer than I thought so I didn't do much.
 
Hey I checked your code out and have some pointers for you.

This part is kinda unnecessary where you decrease it only to restore it again:
Code:
                selection--;
                if(selection>=0) //CHECKS IF THE SELECTION IS IN THE RANGE
                {
                    updateMenu(selection);
                }
                else //FIXES THE SELECTION TO NOT GO NEGATIVE
                {
                    selection = 0;
                }

Could simply be:
Code:
                if(selection > 0) //CHECKS IF THE SELECTION IS IN THE RANGE
                {
                    selection--;
                    updateMenu(selection);
                }


Same with the key down, could be written as:
Code:
                if(selection < menu_content.size()) //CHECKS IF THE SELECTION IS IN THE RANGE
                {
                    selection++;
                    updateMenu(selection);
                }

No need for - 1 on menu_content.size(), just use < instead of <=


Good luck!
 
C++ is a hard language to learn for beginners
i'd say it's not hard, it's confusing because of its ambiguity
if I do things which could/should be done in a diffrent/better/easier way.
seems that you don't know using namespace purpose, when you say you're using some namespace it means that all symbols in that namespace will become visible without adding the namespace prefix, in a giant namespaces such as std or boost, it's not a good practice, actually you did the good practice, you wrote its prefix, you shouldn't declare you're using namespace std, _especially_ while compiling with GCC, as std:: has a lot of members and methods, at some time you will label something that will conflict with std namespace, which will lead you perhaps hundred lines of errors, using namespace std only come useful while you doing a snippet, then you don't to bore yourself with std:: prefix.
You should as much as possible use data encapsualtion in your classes, there is no reason to you expose your members, it's an internal working members, it should be private.
 
Hey I checked your code out and have some pointers for you.

This part is kinda unnecessary where you decrease it only to restore it again:
Code:
                selection--;
                if(selection>=0) //CHECKS IF THE SELECTION IS IN THE RANGE
                {
                    updateMenu(selection);
                }
                else //FIXES THE SELECTION TO NOT GO NEGATIVE
                {
                    selection = 0;
                }

Could simply be:
Code:
                if(selection > 0) //CHECKS IF THE SELECTION IS IN THE RANGE
                {
                    selection--;
                    updateMenu(selection);
                }


Same with the key down, could be written as:
Code:
                if(selection < menu_content.size()) //CHECKS IF THE SELECTION IS IN THE RANGE
                {
                    selection++;
                    updateMenu(selection);
                }

No need for - 1 on menu_content.size(), just use < instead of <=


Good luck!

Damn I knew I was overlooking something :D thanks! Will change it

i'd say it's not hard, it's confusing because of its ambiguity

seems that you don't know using namespace purpose, when you say you're using some namespace it means that all symbols in that namespace will become visible without adding the namespace prefix, in a giant namespaces such as std or boost, it's not a good practice, actually you did the good practice, you wrote its prefix, you shouldn't declare you're using namespace std, _especially_ while compiling with GCC, as std:: has a lot of members and methods, at some time you will label something that will conflict with std namespace, which will lead you perhaps hundred lines of errors, using namespace std only come useful while you doing a snippet, then you don't to bore yourself with std:: prefix.
You should as much as possible use data encapsualtion in your classes, there is no reason to you expose your members, it's an internal working members, it should be private.

Alright so I should not declare namespace std in bigger projects only in small ones? I am going to read more about it. I actually tried to find out the purpose of it before but I didn't quite get it. Okay I will make them private. By the way what is the purpose of making them private? Because it is easier to "hack" or how may I understand it. I know the diffrence between public and private I just didnt get the purpose of it yet.
 
Update:
  • The account management system is done. You are now able to login or create a new account.

New Objectives:
  • Clean up / Fix the code based on suggestions
  • Make the Account management System easier to read and less messy
  • Start with actual game development

The new code should be available on github any moment. I know that the account system isnt the safest one (since it only stores the account details in a text file). I will try to make it safer at some later point. Also the code is very very messy you guys will probably dislike it. However, if you (are able to read through this mess) you can give me help and criticism on how to improve it. But for now I am more than happy that it actually works!
 
Back
Top