Xentales
http://xentales.com/

XPS - Rewrite
http://xentales.com/viewtopic.php?f=34&t=94719
Page 1 of 1

Author:  Andy123456 [ 14 Mar 2015 21:20 ]
Post subject:  XPS - Rewrite

Currently toying with the idea of rewriting XPS to on the Orleans runtime (in C#), if anyone would be interested in contribooting, hit me up.

The idea I'm toying is writing this as a generic server framework, and having xenlua interpret data sent, proxying it to xenimus, making a server!

If anyone is aware this is technically what the last versions of XPS did, except it was more "heres xenimus data, please forward to client" just so custom things could be added on.

Also considering making this open source :)

Author:  Andy123456 [ 14 Mar 2015 21:22 ]
Post subject:  Re: XPS - Rewrite

To give an example of how orleans works, basically everything is async, heres some samples I've been messing with.

Code:
using Orleans;
using Orleans.Concurrency;
using Orleans.Providers;
using Orleans.Storage;
using System.Threading.Tasks;
using System;
using System.Collections.Generic;

namespace Server
{
    public class AccountData
    {
        public Int64 id = 0;
        public string name = "NOTSET";
        public string password = "NOTSET";
        public float test_float = 1.0f;
    }

    enum AccountFlags
    {
        AccountFlagNone = 0,
        AccountNotValid = 1,
    }

    [Reentrant]
    public class AccountGrain : Grain, IAccountGrain
    {
        AccountData data;
        AccountFlags flags = AccountFlags.AccountFlagNone;

        public override async Task OnActivateAsync()
        {
            IMySQLGrain mysqlres = MySQLGrainFactory.GetGrain(Guid.Empty);

            var accountData = await mysqlres.QueryResultAsList(string.Format("select * from accounts where `name` = '{0}';", this.GetPrimaryKeyString()));

            if (accountData.Count > 0)
                data = MySQLHelper.ToObject<AccountData>(accountData[0]);
            else
                flags |= AccountFlags.AccountNotValid;

            await base.OnActivateAsync();
        }

        public async Task Save()
        {
            if (data == null)
                return;

            var asDictionary = MySQLHelper.ToDictionary(data);
            string query = MySQLHelper.GenerateReplace("accounts", asDictionary, "id"); //don't include id, it's an incrementer in mysql

            return;
        }

        public async Task<AccountCreateResponse> CreateAccount(string password, float test_float)
        {
            if (data != null)
                return AccountCreateResponse.AccountCreateDataAlreadyExists;

            data = new AccountData();
            data.id = 0; //db generates this
            data.name = this.GetPrimaryKeyString();
            data.password = password;
            data.test_float = test_float;

            //validate this account
            flags &= ~AccountFlags.AccountNotValid;

            Save();
            return AccountCreateResponse.AccountCreateOk;
        }

        public async Task<AccountAuthResponse> Authenticate(string password)
        {
            if ((flags & AccountFlags.AccountNotValid) != 0)
                return AccountAuthResponse.AccountAuthNotValid;

            if (password != data.password)
                return AccountAuthResponse.AccountAuthNoMatch;

            return AccountAuthResponse.AccountAuthOk;
        }

    }
}

Author:  dmzo1 [ 15 Mar 2015 13:33 ]
Post subject:  Re: XPS - Rewrite

This sound interesting, what do you need help with? Is this going to be written for XPS's version or EJ's latest version?

Author:  lawn gnome [ 15 Mar 2015 22:00 ]
Post subject:  Re: XPS - Rewrite

If I knew C# and had more free time id help.

Author:  Underworld [ 16 Mar 2015 17:34 ]
Post subject:  Re: XPS - Rewrite

Is there currently a Private Xenimus Server at the moment?

Author:  Vicious [ 07 Apr 2015 19:23 ]
Post subject:  Re: XPS - Rewrite

77 65 20 6c 6f 76 65 20 79 6f 75 20 61 6e 64 79 21 21 21

=)

Author:  dmzo1 [ 09 Apr 2015 09:46 ]
Post subject:  Re: XPS - Rewrite

49 20 64 6f 75 62 74 20 74 68 69 73 20 69 73 20 61 63 74 75 61 6c 6c 79 20 67 6f 69 6e 67 20 61 68 65 61 64 20 74 68 6f 75 67 68

Author:  Vicious [ 09 Apr 2015 13:49 ]
Post subject:  Re: XPS - Rewrite

dmzo1 wrote:
49 20 64 6f 75 62 74 20 74 68 69 73 20 69 73 20 61 63 74 75 61 6c 6c 79 20 67 6f 69 6e 67 20 61 68 65 61 64 20 74 68 6f 75 67 68

48 61 76 65 20 66 61 69 74 68 2c 20 69 6e 20 61 6e 64 79 20 77 65 20 74 72 75 73 74 21

Author:  Cojiro [ 27 Jun 2015 22:15 ]
Post subject:  Re: XPS - Rewrite

53 6f 2c 20 77 65 27 72 65 20 61 6c 6c 20 74 61 6c 6b 69 6e 67 20 69 6e 20 68 65 78 20 6e 6f 77 3f 20 20 57 68 79 3f

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/