Author Topic: FOnlineServer with Mono  (Read 17262 times)

Offline Bartosz

  • Rotator
  • There'd better be a killer reason...
Re: FOnlineServer with Mono
« Reply #30 on: June 10, 2013, 10:22:36 am »
How does this interface look like? Maybe by looking at methods signatures I could think of something/have better knowledge about those requirements.

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #31 on: June 10, 2013, 10:31:54 am »
This is the current interface of Action in AngelScript (but it is not in its final state):
Code: [Select]
interface Action
{
Action@ GetSuperAction();
void SetSuperAction(Action@ action);
Action@ AddSubAction(Action@ action);
Action@[] GetSubActions();
void CollectListeningActions(Action@[]& collection);
Action@ And(Action@ andAction);
Action@ If(Condition@ condition);
Action@ IfNot(Condition@ condition);
void PerformAndAction(Critter& critter, Critter@ otherCritter, Item@ item);
bool Check(Critter& critter, Critter@ otherCritter, Item@ item);


bool IsRunning();
void SetRunning(bool running);
bool IsListening();
void SetListening(bool listening);

bool Start(Critter& critter);
void Perform(Critter& critter);
void Finish(Critter& critter);
void Cancel(Critter& critter);
void StartNextAction(Critter& critter);

string GetInfo();

void IdleEvent(Critter& critter);
void ShowCritterEvent(Critter& critter, Critter& showCritter);
void HideCritterEvent(Critter& critter, Critter& hideCritter);
bool AttackEvent(Critter& critter, Critter& target);
bool AttackedEvent(Critter& critter, Critter& attacker);
void DeadEvent(Critter& critter, Critter@ killer);
void MessageEvent(Critter& critter, Critter& messenger, int message, int value);
void SeeSomeoneAttackEvent(Critter& critter, Critter& attacker, Critter& attacked);
void SeeSomeoneDeadEvent(Critter& critter, Critter& killed, Critter@ killer);
void SeeSomeoneAttackedEvent(Critter& critter, Critter& attacked, Critter& attacker);
void SeeSomeoneStealingEvent(Critter& critter, Critter& victim, Critter& thief, bool success, Item& item, uint count);
void SeeSomeoneUseSkill(Critter& critter, Critter& skillCritter, int skill, Critter@ onCritter, Item@ onItem, Scenery@ onScenery);
int PlaneBeginEvent(Critter& critter, NpcPlane& plane, int reason, Critter@ someCr, Item@ someItem);
int PlaneRunEvent(Critter& critter, NpcPlane& plane, int reason, uint& result0, uint& result1, uint& result2);
int PlaneEndEvent(Critter& critter, NpcPlane& plane, int reason, Critter@ someCr, Item@ someItem);
}

And Manager has void Start(Critter& critter, Action& action) function, which starts the action for specified critter.

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #32 on: June 25, 2013, 07:21:22 pm »
I am scared to ask, but what "Virtual events did nothing good" means?

Offline Bartosz

  • Rotator
  • There'd better be a killer reason...
Re: FOnlineServer with Mono
« Reply #33 on: June 25, 2013, 11:04:10 pm »
It means I've screwed commit message (commiting from git to svn is tricky).

This commit also involved some project structure refactoring, and it should be described in message instead). Scrapping virtual modifier from events was just minor part of refactor.

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #34 on: June 28, 2013, 02:32:06 pm »
I have problem running Mono server after the latest changes. I tried it on clean version of SDK, rebuild the Mono solution in MonoDevelop, but executing FOnlineServer.exe and pressing Start server will crash the server without dump file created, so I am not sure why it is happening. Did I forget to do something or there might be a bug introduced?

Offline Bartosz

  • Rotator
  • There'd better be a killer reason...
Re: FOnlineServer with Mono
« Reply #35 on: June 29, 2013, 04:34:04 pm »
I think I know, and it wasn't explained in commit message because I screwed it (as you already know).

The project is now refactored into core FOnline.Mono.dll and FOnline.Server.exe which is the entry assembly for server. Your FOnlineServer.cfg should have the

MonoAssembly=FOnline.Server.exe

line.

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #36 on: June 29, 2013, 04:36:23 pm »
I think I know, and it wasn't explained in commit message because I screwed it (as you already know).

The project is now refactored into core FOnline.Mono.dll and FOnline.Server.exe which is the entry assembly for server. Your FOnlineServer.cfg should have the

MonoAssembly=FOnline.Server.exe

line.
Should I wait for fixed revision or MonoAssembly=FOnline.Server.exe should be enough to fix it?

Offline Bartosz

  • Rotator
  • There'd better be a killer reason...
Re: FOnlineServer with Mono
« Reply #37 on: June 29, 2013, 05:13:56 pm »
Should I wait for fixed revision or MonoAssembly=FOnline.Server.exe should be enough to fix it?

Should be enough

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #38 on: June 30, 2013, 07:10:30 pm »
Should be enough
Didn't help. :(
But the problem seems to be that FOnline.Server.exe is not built in Server directory (or anywhere else) after rebuilding the project (I am trying to rebuild Server using Debug|x86). Any suggestions?

EDIT:
Nevermind, I missed incorrect Output path of Assembly set for FOnline.Server project. :)
« Last Edit: June 30, 2013, 07:35:45 pm by wladimiiir »

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #39 on: July 02, 2013, 09:27:35 am »
When I run mono server, NPC dialogs are not working at all (invoking via scripts or clicking on NPC). Do you know about the problem?

Note: I have tested it also on vanilla SDK.
BTW: Do you have any issue tracker where I could entry such issues?

Offline Bartosz

  • Rotator
  • There'd better be a killer reason...
Re: FOnlineServer with Mono
« Reply #40 on: July 02, 2013, 10:30:19 am »
BTW: Do you have any issue tracker where I could entry such issues?

https://bitbucket.org/rotators/fosrc/issues

Re: FOnlineServer with Mono
« Reply #41 on: July 02, 2013, 01:04:58 pm »
https://bitbucket.org/rotators/fosrc/issues
It is only for issues with mono or for all bugs related to fonline sdk?

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #42 on: July 02, 2013, 10:03:20 pm »
  • Is it safe to create Timer (and use it for managing e.g. controlling Critter's actions)?
  • I am getting Script::GetGlobalContext - Script context stack overflow! Context call stack: (no call stack after). Is this message part of Mono server? Could it be caused by having another (Timer) thread?

Offline Bartosz

  • Rotator
  • There'd better be a killer reason...
Re: FOnlineServer with Mono
« Reply #43 on: July 03, 2013, 09:04:33 am »
Quote
It is only for issues with mono or for all bugs related to fonline sdk?

For now it's a place for mono-related things, but it would definitely be only for engine-related issues.

Any particular thing you've had in mind?

  • Is it safe to create Timer (and use it for managing e.g. controlling Critter's actions)?
  • I am getting Script::GetGlobalContext - Script context stack overflow! Context call stack: (no call stack after). Is this message part of Mono server? Could it be caused by having another (Timer) thread?

  • It's better to stay away from multithreading. The Critter (and other game objects) methods are not thread safe. You could use another thread timer with some thread-safe collection that would then act as message dispatcher (and messages it will got could be handled in main loop). And I think that normal Game Events are still viable option (after all, they are saved).
  • Can I have some code snippet?



Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: FOnlineServer with Mono
« Reply #44 on: July 03, 2013, 09:27:34 am »
  • It's better to stay away from multithreading. The Critter (and other game objects) methods are not thread safe. You could use another thread timer with some thread-safe collection that would then act as message dispatcher (and messages it will got could be handled in main loop). And I think that normal Game Events are still viable option (after all, they are saved).
  • Can I have some code snippet?

  • I wanted to have independent thread not to affect performance (it is for Behavior Trees :) ). But it is easier for me to just use Game events for now, which seem that work fine. I will do some load tests to see if the performance is not an issue.
  • Hm, it looks like doing it in another thread was causing the exception. It is hard to provide some code snippet, but if you want you can check mono_bt branch, where I am doing these changes.