Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Realm of Magic, a 2D Multiplayer RPG

  1. #1

    Realm of Magic, a 2D Multiplayer RPG

    This was originally going to be named Harry Potter Online, but since that could cause some problems, i renamed it to Realm of Magic.

    So far, the features are:
    - you can move, and se other player move. (still a little buggy)
    - use entreances (teleports you between rooms, placed in doorways etc.)
    - Chat (say, yell and whisper.)
    - See wich player you hold the mouse pointer over
    - See ping
    - See room title
    - GameObjects

    The only GameObject installed is a door on an entreance. walk up to it and whisper "opendoor", and it will disappear. (allowing you to enter)
    (type "/whisper opendoor" in chat)

    The /whisper function is not like in conventional games. it lets you speak only to people that are nearer than 30 pixles. /say can be heard up to 500 pixles distance, and /yell works up to 2000 pixles...

    http://thorins.net/RoM.rar

    Screenies:
    http://thorins.net/1.png
    http://thorins.net/2.png
    http://thorins.net/3.png

    To use the source, you have to have the standard Delphi6 socket components (TServerSocket and TCLientSocket) and DelphiX.

    Any tips, feedback, ++ is appreciated.

    EDIT: Post is updated with latest features... (01.10.2006 @ 00:34GMT)

  2. #2

    Re: Realm of Magic, a 2D Multiplayer RPG

    Quote Originally Posted by Diaboli
    (sry if my english is a little off, I'm norwegian )
    Most norwegians I know and have worked with, speak better English than than the English.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  3. #3

    Realm of Magic, a 2D Multiplayer RPG

    Have anyone tested it or looked at the source?
    I'm currently working on removing some serious lag when there are more than one player in a room, and some feedback would be nice.
    if you see any errors in the source that i for some reason havent cleaned, just tell me...

  4. #4
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Realm of Magic, a 2D Multiplayer RPG

    Hi Diaboli,

    I just downloaded your game... server fired up, client fired up...

    The text colours on the initial login page are a bit of a pain. The dark red is a little tricky to see.

    Once I had provided my nickname and logged in, a room appeared, then I got the error message:-

    '0,00 is not a valid floating point number'

    I'm guessing this is reading something from an INI file or the registry and is doing the conversion based on the locale thats set in the system settings.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  5. #5

    Realm of Magic, a 2D Multiplayer RPG

    Hi there,

    after starting the server and client I can type in my login-name. When I do so and click on start I only see a black screen and the standard Windows mouse cursor.

    Starting the client a second time gives me the same error Athena encountered.

    Greetings,
    Dirk
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

  6. #6
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Realm of Magic, a 2D Multiplayer RPG

    Hi Diaboli,

    Just looking through the code... I found the problem with the floating point conversion I think.

    I believe its down to the function calcDistance. You are using Pythagoras for the case where the difference between the X and Y values isn't 0, but why not ditch all the comparisons and float to string (and back again) conversions? I know its all floating point, but in this day and age, I wouldn't have thought its too much of a burden.

    I'm trying to get it working so I've modified the routine to this:-

    Code:
    Function CalcDistance&#40;X1,Y1,X2,Y2&#58; Integer&#41;&#58; Integer;
    begin
      result&#58;=round&#40;sqrt&#40;sqr&#40;x1-x2&#41;+sqr&#40;y1-y2&#41;&#41;&#41;;
    end;
    Based on the fact that your routine was doing a lot of float to string (and back again) conversion, this should also be faster.

    You mention the fact that it seems to get laggy when there are a few people on.

    Having just looked at some of the code, I would suggest that you consider changing the routines that feed information to and receive it from the server. In particular, RecPlayers and RecPlayerPos.

    You are spending a lot of time locating delimiters and then manipulating the strings that contain the data. You could still move the data around with strings, but you would be better off tightly formatting the data so that a particular item is always the same length and always in the same position. Then you only need to copy the data. I've also just noticed that you are locating the delimiters twice. Once to locate the end of the data (with your leftStr routine) and then again to delete the data (with your rightStr) routine. I'm just changing the code to use standard routines, like this:-

    Code:
    idxpos&#58;=pos&#40;'|',rec&#41;;
    dataitem&#58;=copy&#40;rec,1,idxPos-1&#41;;
    delete&#40;rec,1,idxPos&#41;;
    So as a complete example... this....

    Code:
    Function RecPlayerPos&#40;Rec&#58; String&#41;&#58; Boolean;
    var
      i&#58; Integer;
      iPos&#58; Integer;
      IsSelf, PID, Name, X, Y, Dir, Speed, House&#58; String;
      bIsSelf&#58; Boolean;
    begin
      while Length&#40;Rec&#41; > 0 do
      begin
        PID&#58;= LeftStr&#40;Rec,Pos&#40;'|',Rec&#41;-1&#41;;
        Rec&#58;= RightStr&#40;Rec,Length&#40;Rec&#41;-Pos&#40;'|',Rec&#41;&#41;;
        X&#58;= LeftStr&#40;Rec,Pos&#40;'|',Rec&#41;-1&#41;;
        Rec&#58;= RightStr&#40;Rec,Length&#40;Rec&#41;-Pos&#40;'|',Rec&#41;&#41;;
        Y&#58;= LeftStr&#40;Rec,Pos&#40;'|',Rec&#41;-1&#41;;
        Rec&#58;= RightStr&#40;Rec,Length&#40;Rec&#41;-Pos&#40;'|',Rec&#41;&#41;;
        Dir&#58;= LeftStr&#40;Rec,Pos&#40;'|',Rec&#41;-1&#41;;
        Rec&#58;= RightStr&#40;Rec,Length&#40;Rec&#41;-Pos&#40;'|',Rec&#41;&#41;;
        Speed&#58;= LeftStr&#40;Rec,Pos&#40;'#',Rec&#41;-1&#41;;
        Rec&#58;= RightStr&#40;Rec,Length&#40;Rec&#41;-Pos&#40;'#',Rec&#41;&#41;;
        if &#40;StrIsInt&#40;PID&#41;&#41; and &#40;StrIsInt&#40;X&#41;&#41; and &#40;StrIsInt&#40;Y&#41;&#41; and &#40;StrIsInt&#40;Dir&#41;&#41; and &#40;StrIsInt&#40;Speed&#41;&#41; then
          SetPlayerPos&#40;StrToInt&#40;PID&#41;,StrToInt&#40;X&#41;,StrToInt&#40;Y&#41;,StrToInt&#40;Dir&#41;,StrToInt&#40;Speed&#41;&#41;
        else
          Rec&#58;='';
      end;
    end;
    becomes....


    Code:
    Function RecPlayerPos&#40;Rec&#58; String&#41;&#58; Boolean;
    var
      i&#58; Integer;
      iPos&#58; Integer;
      IsSelf, PID, Name, X, Y, Dir, Speed, House&#58; String;
      bIsSelf&#58; Boolean;
      idxPos &#58; integer;
    begin
      while Length&#40;Rec&#41; > 0 do
      begin
           idxPos&#58;=pos&#40;'|',rec&#41;;
           pid&#58;=copy&#40;rec,1,idxPos-1&#41;;
           delete&#40;rec,1,idxPos&#41;;
    
           idxPos&#58;=pos&#40;'|',rec&#41;;
           x&#58;=copy&#40;rec,1,idxPos-1&#41;;
           delete&#40;rec,1,idxPos&#41;;
    
           idxPos&#58;=pos&#40;'|',rec&#41;;
           y&#58;=copy&#40;rec,1,idxPos-1&#41;;
           delete&#40;rec,1,idxPos&#41;;
    
           idxPos&#58;=pos&#40;'|',rec&#41;;
           dir&#58;=copy&#40;rec,1,idxPos-1&#41;;
           delete&#40;rec,1,idxPos&#41;;
    
           idxPos&#58;=pos&#40;'#',rec&#41;;
           speed&#58;=copy&#40;rec,1,idxPos-1&#41;;
           delete&#40;rec,1,idxPos&#41;;
    
        if &#40;StrIsInt&#40;PID&#41;&#41; and &#40;StrIsInt&#40;X&#41;&#41; and &#40;StrIsInt&#40;Y&#41;&#41; and &#40;StrIsInt&#40;Dir&#41;&#41; and &#40;StrIsInt&#40;Speed&#41;&#41; then
          SetPlayerPos&#40;StrToInt&#40;PID&#41;,StrToInt&#40;X&#41;,StrToInt&#40;Y&#41;,StrToInt&#40;Dir&#41;,StrToInt&#40;Speed&#41;&#41;
        else
          Rec&#58;='';
      end;
    end;
    This also gives you the chance of spotting bad packets, since if you don't find a delimiter when you expect one, you can simply ditch that packet and move on. Another option would be to create objects that contain the data and then use streaming to move the object data from server/client/server.

    Please bear in mind, that the first client based game I worked on was our competition entry. There are many people far more experienced than me on here who may spot big problems with some of my suggestions, but I just compiled it (with Delphi 5) with the changes I made in and I can run around and move from room to room. That said, I don't have anyone else to try it with at the moment, but a bit later on, I'll give it a go.

    I hope you finish it... there aren't enough old style games around. Too much emphasis is put on fancy graphics and environment which need a monster PC to play.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  7. #7
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Realm of Magic, a 2D Multiplayer RPG

    Quote Originally Posted by Huehnerschaender
    Hi there,

    after starting the server and client I can type in my login-name. When I do so and click on start I only see a black screen and the standard Windows mouse cursor.

    Starting the client a second time gives me the same error Athena encountered.

    Greetings,
    Dirk
    I got that problem when I started it from within the IDE. When I run it outside the IDE it works fine.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  8. #8

    Realm of Magic, a 2D Multiplayer RPG

    thanks for the MUCH simplified CalcDistance funtion!

    as for the reading and writing of packets, i am going to rewrite it to use raw data. for instance an integer will always be 4 bytes of the package, no matter how long... i just have to write some xxxToRaw functions...
    and some getXXX functions...

    like:

    [pascal]package:= #02+IntToRaw(PID);

    if OPCode = #02 then
    DeletePlayer(GetInt(Rec));[/pascal]

    after starting the server and client I can type in my login-name. When I do so and click on start I only see a black screen and the standard Windows mouse cursor.
    This happens AFTER the hostname box, right?
    if not, you have typed your name in the hostname box, wich would result in the client trying to connect to your name, wich prbbly wouldnt work.
    It can also be a symptome of not receiving the #00 package, wich tells the game that it is logged in and wich room to load...

    I have some updated code, but i'll wait with uploading it till i have fixed some of the errors you reported...

    EDIT:
    I have updated the download. the lag is almost entirely removed now, after using conversions to and from raw string.
    the link in the first post is updated, and here is another one:
    http://thorins.net/RoM.rar

    EDIT2:
    Sorry if you have tried to test the new features and found them not existing. my internet broke down during upload last night, but it has been uploaded now.

    feel free to check it out and comment. (source is still included)

  9. #9

    Realm of Magic, a 2D Multiplayer RPG

    I have managed to implement GameObjects (doors and so on)
    i will upload updated RoM.rar as soon as possible (I'll edit this post)

    EDIT: Update uploaded! (same link as before)

  10. #10
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Realm of Magic, a 2D Multiplayer RPG

    How about some screenshots?

    I'm quite busy these days, but I would have time to peek at a few screenies if you can whip a few up.
    Jason McMillen
    Pascal Game Development
    Co-Founder





Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •