A Beginner's Guide to Creating a MMORPG

xiaoxiao2021-03-06  72

This article will focus on the first steps in building your own Massive Multiplayer Online Role Playing Games (MMORPG). It's target is the indie game developer, with limited resources and experience. After reading this article, you should know what it takes to get started , and some advises regarding what to do and what not to do. The very first step is to assess your skills, and your resources. you need to be honest with yourself, because it can be frustrating to waste your time trying to build something you Just can't.

Step One: Assessing Your Skills

Required Skills:

Know at least one programming language. So far, C is the most popular choice among game developers due to efficiency and performance advantages. Visual Basic, Java or C # might do the job as well. Become familiar with a graphic library. Popular choices are SDL , OpenGL, or DX / D3D. Choose the network library to utilize. You can chose between WinSock, sDL_net, or DirectPlay. Have general experience in game programming. For example, the events loop, multithreading, GUI design, etc.

HIGHLY Recommended Skills:

Client / Server communication and architecture. Multiplatform programming. You might want to design your MMORPG, and especially the server such that it can run on multiple OSs. For this purpose, I recommend using SDL, OpenGL and SDL_net. Web development. This will be needed if you want to enable people to view player statistics, server information, and other information on a website. Security & Administration. you do not want someone to hack your server, and mess around! Team skills. you will need a team that You can successful lead and management.

Step Two: MAKING A Preliminary Design

I have noticed many people posting in various forums looking for teams to make MMORPGs Most of them start with something like this:. "We are a starting company / game studio and we need 3 artists, 2 programmers, 1 musician, etc. for an innovative, never seen before MMORPG where you will have total freedom to do whatever you want and reshape the world, etc. We will pay you when it's done and we make some money. "Unfortunately, with the current technology and limited bandwidth, you can not have a dynamic world. Aiming at something impossible leads to failure. Rather, try to come up with a small, functional, expandable design and architecture.Basic software architectureFirst, try to focus on making a simple client / server model, where you will be Able TO:

Create a new character Save that character (server side) Log in with the character Be able to chat with others Be able to navigate around in 3DSaving characters might seem simple, but in fact, it is not. For example, there are two ways Of Saving The Characters: USING A DATABASE Server or Using Files. There Are Advantages and Disadvantages for Both:

DatabaseSfilesadVantages

You can easily add new fields, or modify existing fields. Updating player statistics (from outside the game) is much easier. You can instantly and efficiently retrieve various statistics, via SQL queries. There is no need to perform file I / O operations yourself , The Database Server Will Do That for you. Easy to Update / Restore.

Very fast access (read / write). Easy to implement. No additional libraries needed. No dependence on a database server. Therefore, you do not have to worry about getting database updates or security issues. Disadvantages

Easy to make mistakes. For example, doing an update query where you omit the 'where' clause. It can have disastrous effects, especially if you have old (or no) backups. Databases may be slower than actually opening / writing a player file . You might lose a few milliseconds when retrieving some data, especially if a lot of players log in / out at the same time. Additional code is required to convert your data to / from the database. Database and SQL experience is required. in addition ., you will need a library to interface between your program and the database If for some reason the database file becomes corrupt, you are out of luck; you can lose all the players (especially if no recent backups) .It can be very difficult to add new fields, unless you carefully design the file format / structure from the beginning. Inability to do player-wide queries (this can be circumvented by having a program that adds every night the important fields in a database server). Needs special coding IF you want to Update / Check Player Stats. a little bit Harden to update / restore.

Now that you decided which way to go about saving your characters, you'll need to chose what network protocol to use for the client / server communication:? TCP or UDP TCP is known to be slower but more accurate, and require additional bandwidth. in practice, I did not notice any problem using TCP. Provided that you have enough bandwidth available, TCP is a good choice, at least for the beginning. UDP can be really annoying, especially for beginners. Keep in mind that the preliminary tests of the engine or game will be done in your local network, so all the packets will arrive to the destination in the same order. This can not be guaranteed over the Internet. While the packets will usually arrive in the same order, some packets can be lost, and this is usually a problem. Of course, you can design your protocols in way so that the client / server will be able to recover from lost packets. But this is a painful process which is not recommended for beginner.Step Three: Choosing An Internal Proto Col for data transfer

IT Might Seem Simple, But, Again, It isn't. You can't just send strings, '/ 0' terminated. This is because you will need to send Both strings and binary data. It is unwise to use 0 (or any other sequence) as a terminator, because that terminator can be part of the data stream you want to send. Furthermore, if you send 20 bytes, and then another 20 bytes, most likely the server will not receive a 20 bytes packet, then another 20 bytes packet. Instead, it will receive 40 bytes at once, to avoid wasting the bandwidth with unnecessary headers. Alternatively, you can send a 1KB packet, but the server will receive it in 2 smaller . packets So you will need to be able to know where a packet starts, and where it ends In Eternal Lands, we use the following method:. Offset 0: 1 byte denoting the command transmitted Offset 1:. 2 bytes, the length of The Data Transmitted. Offset 3: Variable Length, The Body of The Message.

This method has the advantage of consistency: all the data transmitted follows the same standard The disadvantage is that some commands have a fixed, known length, so some bandwidth is wasted We will eventually switch to a hybrid approach, at a later date...

The next thing to decide is the server model: "Non-blocking sockets, non threaded", or "blocking sockets, threaded" Both methods (threaded vs. unthreaded) have their advantages and disadvantages..

Threaded:

Somewhat smoother response from the server, since if a player needs a lot of time (such as reading data from the database) this is done on it's own threaded, not affecting others Very hard to debug, and implement properly:. You will need a Lot of synchronization, and small oversights Can have dispatch effects (Server Crashing, item duplication, etc.) Makes Use of multiprocessors systems.non-thraded:

Much Easier to Implement and Debug. Slower Response Time.

In My Company, WE WENT for the Non Threaded Way, Because I Just Don't have the resources and disposition to Cope with the threaded.

Step Four: The Client

Do you plan to make A 2D or 3D Game? Some Would Argue That It's Easier To Make A 2D Game. I've Done Both, and I Tend to Believe That 3D is Easier. Allow Me To Explain.

In 2D, you usually have a frame buffer, which is a big array of pixels. The format of those pixels can differ, from video card to video card. Some have RGB modes, other have BGR modes, etc. The number of bits for Each Color Can Differ As Well. This Happens Only for 16bpp Video Modes. 8-Bit and 24-Bit Video Modes Are Easier, But With Their Problems (8-Bits Gives You Few Colors (256), While 24-Bit Modes Are Slower ). Also, you will need to make your sprite routines, and you have to sort your objects yourself, so they will be drawn in the right order. Of course, you can use OpenGL or D3D for 2D games, but it's usually not worth . it not everyone has a 3D accelerated video card, so using a 3D library for a 2D game usually gives you the disadvantages of both worlds: not everyone will be able to play it, and you will not be able to rotate the camera, Have Nice Shadows, And Various Other Eye Candies Specific To The 3D Applications.

The 3D way is, like I said, easier, but requires some basic math (especially trigonometry) knowledge. Today's graphic libraries are very powerful, and will offer you the basic operations for free (you will not need to sort your objects back to front, changing the colors and / or texture of an object is very easy, the objects will be lit according to the light and their position (as long as you calculate the normal vectors for them), and more. Furthermore, 3D gives you much more freedom of creation and movement. The disadvantages are that not everyone will be able to play your game (you might be surprised how many people do not have 3D capable cards), and pre-rendered graphics will always look better than the real- Time rendered equivalent.

Step FIVE: SECURITY

Obviously, the users can not be trusted. Under no circumstances can you assume that the users will not be able to defeat your cleverly-designed encryption scheme (if you use one), or your protocols. Everything the user sends to the server has to be validated. Most likely, on your server, you will have fixed buffers. for example, it is common to have a small (maybe 4K) buffer for the incoming data (from the sockets). A malicious user can send a really long data sequence . If not checked, this will overflow the buffer, resulting in a server crash, or, worse, the user being able to hack your server, executing arbitrary code Every single message has to be checked:. whether buffer overflow occurred, whether invalid data Was Sent (Such As Uses Sending "ENTER THIS DOOR EVEN Thow The Door Is At the Other End of the Map, or" Use the Healing Potion "Althi S User Has No Such Potions, ETC.). I Will Say IT Again: IT Is Extremely Important to Validate All The Data. WHENEVER THERE IS A VIOLATI ON, LOG IT Along with Date, And The Nature of The Violation. Every On A While, Check That Log. If You Find Few Violations from Many Users, this is usually a bug in the client, OR A NetWork Problem. However, IF you find a lot of violations from the Same User or ip, this is a good indictive Thatone IS Toying with the Server, Trying Either to Hack IT, or Running A Macro / Script. Also, Never Store Data on The Client. The Clom The Server. in Other Words, IT Should Not Send Things Such As: "OK, this is my list of items" or "My Stregth IS 10, My Mana IS 200, And My Life IS 2000 OUT OF 2000 "

. Also, the client should not receive more data than it needs. For example, the client should not know where other players are, except if they are nearby. This is common sense, since sending all the players to everyone will consume a lot of bandwidth, and some players might hack the client to give themselves unfair advantages (like having the position of certain player displayed on a map). All this seems common sense, but, again, you'd be surprised to find out how many people do not possess what we call common sense.Other things to consider, when it comes to security: The player walk speed should be enforced on the server, not on the client The server should keep track of the time (in milliseconds) when a client. last moved, and if a move request comes faster than the normal threshold, this request should be discarded. Do not log such bogus requests, because they can result in network latency (ie the player lags, and all the data he sent in the last 10 SECONDS COMES AT ONCE).

Check the Distance. If a player attempts to trade with another player that is 10 billion kilometres away (or even on another map) log that. If a player attempts to look at, or use a map object that is far away, log that. Be Careful for Bogus IDs. For Example, It's Normal To Assign An ID To Every Player (The IT CAN Be Permanent (UNIQUE ID). IF The ID is Given When The Player Logs in ( Or WHEN A MONSTER IS CREATED, IT Makes Sense To Use The Position (INDEX) In The Player IS AS The ID.

So The First Player That Logs in Has ID 0, The Second Has ID 1, And So on. NOW, MOST LIKELY You Will Have A Limit of, Say, 2000 Indexes In That Player List. SO if aclient sends a commnd such as : "Look at actor with id 200000" This Will Crash The Server IF Unguarded Since The Server Will Attempt to Access An Invalid Memory. so do a check such as: "if actor id <0 or if actor id> max players the log violation and disconnect the player ". If you program in C or C , take care to either define the index as 'unsigned int' and check for the upper range, or if for some reason you define the index as int (int, by default is signed), remember to check against <0 and> max actor. Failure to do so will result in a lot of frustration both for you and the other users. Similarly, check for out-of-map coordinates. If you have some form Of path Finding on your server, and the client on a position on the ground M

MAKING A GAME IS A LOT OF WORK (Except for Pong and Tetris). This is especially true for mmorpg. You Simply Can't do it all by yourself. Ideally, An Indie Team Should Be Comprised of:

AT Least 3 Programmers: 1 for the Server, And 2 for the Client (OR 1 for the Client, One for the Tools, Such as Plug-ins for the Artists, A World Editor, etc.). Having Up to 6 Programmers IS good, more than 6 might be too much. It really depends on your leadership abilities. At the very least 1 artist, but preferably 2 or 3. If it's a 3D game you will need a 3D artist, a 2D artist (textures, interface , etc.), an animator, and an art department leader Unless you are a good artist, the art department needs to be kept together and coordinated by an experienced artist A few world builders:.. Building all your maps is a very long process , and it's critical to the game's success. Again, you will need a leader for the world building department. you can not just have anyone making whatever the hell they want since your world design should be consistent. A webmaster is a must, unless You are really good at Web Design, Andre Willing to Spend Your Time Making A Website. Having a Sound and Musicia n is not required, but a game with sound and music can be more enjoyable than a game without it. A designer of the game's economy. You might think that this is easy, and you can do it all yourself, but in fact it is one of the most complicated things. If your economy is poorly designed (ie items not properly balanced, resources put randomly on the maps, etc.) the players will get bored / frustrated and will quit. We had a big problem in one of our Early Stages, Especially Because The Economy Was Mainly Made By ME (a Programmer), And IT WASN '

t properly planned. So it took us about 2 months to rethink and re-implement an entire new economy system. This also required a total elimination of the items. Let me tell you, players are usually unhappy when you delete all their items. Fortunately , most of our players agreed with the idea, but it was still frustrating to spend so many hours arguing, compromising, explaining, and, in general, wasting time. But more on the economy later.As mentioned previously, you will need a 10 -15 people for a team, not including the moderators and admins. Those 10-15 people should also have previous experience in their field. If they are all beginners it's usually not worth it, since you will need to spend too much time explaining to Them what to do, how to do something, why the way it is doing it is big, etc.

Getting 10-15 people from the beginning is pretty close to impossible. No matter how much you will post on various forums, you will not get quality team members. After all, if someone is pretty skilled in his / her field, why would s / he join your team, when you have nothing to show? Many people have great ideas, but implementing them takes a lot of time and effort, so they would rather work at their own projects than join yours. So if you need 10-15 People, but you can't get it, but you can't get it, but you can't get it, but you can, how can't, in reality, you wn't, all of the start. what you real, is 1 programer and 1 artist. if You are a programer, Just Get An Artist. Beg a friends with art skills, pay a colleague / friend of your yours for you.

Now that you have an artist, and hopefully an idea on how the game should look like, it's time to start implementing the idea. Once you will have a semi working client / server engine, and some screenshots to show (or even better, the ability for players to actually log in to your world, walk around, and chat with each other), more people will be willing to join your team. Preferably, unless you brave some technology that no one has, you should make your client open source . Many programmers would join (as volunteers) an open source project, rather than a closed source project. The server, on the other hand, should be closed source (unless you plan from the beginning to make a totally open source MMORPG) .Some other advice: Do not brag about your game until you have something to show One of the most annoying things ever is when a newbie posts a "help wanted" request, asking for a huge team to join his game, explaining how cool the game. IS. ONCE you go to the website advertised (Usually ON a free hosting service) you will see an impressive navigation menu, containing sections such as:. "Download", "Screenshots", "Concept art", "Forums" You click on the Download link, and you get a nice "under construction "Page (OR, WORSE, A 404 Error). The you click on the screenshots page, and you get the screen result. if you don't have any pressing for Download Link. if you have no screenshots To show, do not put a screenshots link. better yet, do not even Waste your Time with a Website UnTo The Project (programming and art wise).

Step seven: dispelling some myths

You can not make an MMORPG, it takes a big company to build one.I disagree with that. While producing a game such as World of Warcraft, Ever Quest 2, Asheron's Call 2, Lineage 2, and others is impossible for a small , independent development team, making a decent game is possible, provided that you have the experience, motivation and time. you will need at least 1000 hours of programming to have a simple tech demo going, and perhaps up to 10-15K hours of programming to have an almost complete client / server. But as the team leader you'll have to do much more than just programming. Keeping the team together, solving conflicts, doing public relations (PR), tech support, setting up servers, banning troublemakers , brainstorming, etc. will be your attributions. So you will be swamped with non-programming tasks as well. Then you will most likely need to go to work / school, which shortens the time you can dedicate to your project. We are very Lucky That No Team Member Left The Team, But If this Ha ppens it can really be a problem. Just imagine your artist leaves halfway through the project. And even worse, s / he does not give you permission to use his / her art anymore. Of course, this can be solved by having them sign a contract, but it would still tiresome to have to get another artist. Having two different art styles in the same project can be a problem. Large amounts of money (usually 4-6 digits) is required to maintain an MMORPG server.Well, This is simply note true. I '

Ve Seen Dedicated Servers, with 1000 GB / MONTH for ~ 100 USD / MONTH (and A 2-300 USD Setup Fee). Unless Your Data Transfer Protocol Is Very Poorly Designed, 1000 GB / MONTH SHOUGH FOR A Server With A 1000 players online (on average). of course, you will need another server to keep your website and the client download (the client download can get a lot of traffic, once the game becomes popular). Our client is about 22MB, and sometimes we Have A 400 GB / Month Transfer. And Weave IS, You Won't NEED A DEDICATED Server To Start This Project. A DSL / Cable Server Can Do It's Job Pretty Well, UnTil you get 20-30 people online at the same time. Then either find a friendly hosting company to host it for free, in exchange for some advertising, or just pay from your own pocket. Making an MMORPG is very fun.This is not true. You Might Think That Everyone Will Appreciate You, That The Players Will Be Supportive, That You Can Make Very Innovative Quests , And, of course, have a lot of players playing your game. Players could be annoying. Even if it is a totally free game, they will find reasons to complain. What's worse is people will often complain about contradictory things. The fighters will not like the fact that it's too hard to gain levels, while the merchants will be very disappointed that the fighters make too much money from loots. If you decrease the monster drops, some people will threaten to quit the game. If you increase it, The Same People Will NOT LIKE The Fact That Now Even Beginners Can Make Money Easily. Letting IT As IS, ISN '

t good either. There has to be some innovation and improvements. If you decide to change something, for instance adding some new challenges to those who manufacture items, some will say it's too hard. If you do not, they will say it's too easy or plain boring. You might notice that the content players will usually not say anything and be satisfied, while the disrupting people will complain the most.The economy is an MMORPG is far harder to balance than the single player equivalent. In a single player game, you can have gradually improved weapons, so as the player advances s / he can afford better equipment, abandoning (or selling) the old. In a multiplayer game, on the other hand, this is concept fails since everyone will attempt to get the best weapon, skipping the low-level weapons. Most of the players would rather use no weapon and just save until they can afford the best possible weapon in the game. Economy design deserves it's own article.

All the things I enumerated so far, coupled with the extra work and challenges should make you think at least twice before deciding to engage in such an impressive project. You must understand the implications of your decision.

Conclusion

Hopefully this article gave you the insight you needed. My next article will be on how to set up an economy (more specifically, what mistakes to avoid), and some information about debugging a server and a client.

About the Author

This Article Was Written by Radu Privantu, Lead Programmer and Project Leader for Eternal Lands www.eee, Open Source Client Mmorpg. I can be Contacted At chaos_rift at Yahoo Dot COM

转载请注明原文地址:https://www.9cbs.com/read-122181.html

New Post(0)