how to make a MMORPG (online) spawning

Hi im traying to make a mmorpg but I dont now how to make the spawning like in runescape or world of warcraft were after you make a account you spawn in the tutoriale so you walk around then you have to go so you logoff then when you log back on you spawn were you last left off.

can anyone please point me in the right deraction :slight_smile:

A good way of doing this is by using a mysql database. (wich you can read and write data from)

first, make a table using the following command:

create table characters
(guid int, accountguid int , charname varchar, xpos float, ypos float, zpos float);

when a new character gets created you’d normally do something like this:

insert into characters 
    (guid, accountguid, charname, xpos, ypos, zpos) 
    values ((select max(guid) + 1), guidofaccounthere, "chosenname", x, y, z);

Now, let me explain some things

guid: A guid is a global id for something (used to identify something, In this case, the character).
accountguid: This is used for linking the character to a certain account (wich exists in a different table).
charname: This is obvious I think.
xpos: the player his x position (should be the same as of your spawnpoint when inserting the record)
ypos: the player his y position (should be the same as of your spawnpoint when inserting the record)
zpos: the player his z position (should be the same as of your spawnpoint when inserting the record)

Now, this is only for creating the character (and these are just some basic variables it could have)

For updating the player his position in the database when he logs out, you should do something like this:

update characters
set xpos = currentxpos, ypos = currentypos, zpos = currentzpos
where guid = playerguid;

the guid of the player should be stored in some variable when the player connects to the server. the currentxpos, currentypos and currentzpos can be read easily in unity by using:
playerObj.transform.x, playerObj.transform.y and playerObj.transform.z

Of course, these variables are examples and might be named different in your project.
I hope I thought you something, if you need anymore information about sql I suggest you go here: SQL Tutorial
If you want to know how to execute sql commands in unity then I suggest you look through the online scripting reference.