HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Area loading question  (Read 1647 times)

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Area loading question
« on: Feb 26, 17, 03:57:07 AM »

This is not a problem. Rather just a question.

I need to implement a mechanic when an instance of the area would have been loaded for a particular set of players. Example: an instance of the dueling area. And after it loaded, it must call to all players on the invitee list, they can go into it.
I know that this calls needs to be done from the method HE_PostOnAreaLoad( area as with noderef of Class AreaRoot ).
But where and how I should give this list to the area?
I assume this can be done in the overridden $World script. But in which method? And how exactly? Through the glom of the helper class or something else?


P.S.: sorry for my terrible English :-[.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1144
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Area loading question
« Reply #1 on: Feb 26, 17, 12:58:04 PM »

The list sounds like it could be just a normal list, which then checks when that player tries to enter the area in question. If their character name is on the list, they can enter. If the list is then sent to each player letting them know its ready to enter, it can be similar to sending a /tell to each player on that list. It would need to go thru the server to find them and let them know. That way they could possibly be in any area and still get the /tell. With a pop up letting the character teleport to the area/instance in question, that way they show up in area with just a "click" reply /join.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Area loading question
« Reply #2 on: Feb 26, 17, 01:31:42 PM »

Are you doing seamless or non-seamless travel between areas?
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: Area loading question
« Reply #3 on: Feb 26, 17, 07:32:39 PM »

To FI-ScottZ:

non-seamless

To Thazager:

Well, my design allow me to say - they are in well-known area - let's call it lobby area. And they already accept join. I just need to run new instance of area for them. Special for them. And be sure, they will travel to same instance automatically when loading finished.
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: Area loading question
« Reply #4 on: Feb 27, 17, 01:05:26 PM »

You need to create a system node to handle the player matchmaking system.

That system node will handle the player queue, match set up and game finish.

Create an ARN for anything you want to store like game history.

Create a GUI the players can place themselves into the MatchMaking System Queue.

Once you have enough players ready, i suggest starting at 1v1 for now, you send the remote calls to the player letting them know they will be travelling soon.

Once the area for the matchmaking is set up send the players to the area.

If you have any additional questions please ask.
« Last Edit: Feb 27, 17, 01:14:07 PM by nocake »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1144
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Area loading question
« Reply #5 on: Feb 27, 17, 09:55:04 PM »

Look at server side

  $Travel._ChangeAreaRequest( player as ID, area as ID, instance as String )

Logged

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: Area loading question
« Reply #6 on: Feb 28, 17, 12:00:34 AM »

To Thazager:

Thanks, I already dug this method. And found almost every thing what I need, except one thing.

To nocake:

Great reply. It accurately describes all that I have done. But don't answered main question, sadly.

So, let me try to ask again in other words.

How does my system node know that the area was loaded? I need set up some kind of callback to this system node, but I can't find place where I can do it.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Area loading question
« Reply #7 on: Feb 28, 17, 01:11:42 PM »

    We have such a system set up for our game to be able to send a group of players to a fresh instance of a given game area.  It is rather complex, but here is the gist: (all called on the World Server via remote calls)

    • We determine an instance # of the desired area that is unused. (We use a system node to track the instances of game areas which are reserved)
    • If we find a valid instance, we call LaunchAreaServerInstance().  That could be done via the methods:
      var listener = $WORLD._createAreaLaunchScriptListener(ourCallbackScriptName)
      $WORLD._RequestLaunchAreaServerInstance(areaID, newInst, listener, explicit)

      but we just decided to do it directly via the external call.
    • If that launch function was successful, we add the players that will be going there to the _TravelAccountQueueMap via a call to: (done for each playerID)
      $Travel._ProcessAreaInstanceTravelQueueAddition(playerID, areaID, newinst)
    • We have a system node override for the $TRAVEL system node, and we define the override method:
      method HE_AreaSpinupTravel(areaID as ID, instanceID as ID) as Boolean
      After LaunchAreaServerInstance() is called, this $TRAVEL method is called once the new instance is ready.
      Players in the $Travel.TravelQueueMap will be sent to the area instance automatically AFTER this method.

    There is a comment above the definition of unique method _AreaSpinupTravel:
DEPRECATED: please use ObsListener to catch _systemArea_OnAreaRegister/Unregister/RegisterFailed events, then call _RequestTravelAreaSeamlessLinksForArea.

So, you might want to go ahead and do it like that via the listener.  The difference is then that is asynchronous, while we wanted an approach that synchronous, which is what LaunchAreaServerInstance() is.

Either way, whether by notification via your listener, or handling HE_AreaSpinupTravel() that is when you know the instance has spun up and the players are being sent there.[/list]
« Last Edit: Mar 01, 17, 12:41:59 PM by FI-ScottZ »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: Area loading question
« Reply #8 on: Mar 01, 17, 10:07:05 AM »

FI-ScottZ, thanks for the useful information. It helped.

My final set up the following:
1. System node in instance 1 of my "lobby area" are used to initiate new battle. It save request in list of class battleRequest. This class has fields for every settings of the upcoming battle, including player list, and type of used "map".
2. Then system node call $WORLD._RequestLaunchAreaServerInstance(areaID, newInst, None, explicit), where None mean no listener is used.
3. When area spinup finished, then call area "lobby" instance 1 $BattleLoader.ArenaReady(areaID) from HE_PostOnAreaLoad( area as NodeRef of Class AreaRoot )

Then ArenaReady() method...:
4. ...iterates through the list of pending requests, looking for first which waiting for instance of this areaID.
5. ...sending "battle settings" to ARN in loaded area which used to setup initial values of game-specific variables.
6. Then method call each player account in battleRequest to wrapper of $Travel._ChangeAreaRequest( player as ID, area as ID, instance as String )
7. When ARN confirm that all accounts arrived - match is starting up.

If you see bottlenecks or potential problems in this design I would be happy if you write about it.
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: Area loading question
« Reply #9 on: Mar 01, 17, 06:02:13 PM »

looks good, I would suggest still using the even listener so the code is all under the correct class since the area class is used for all areas.

possible edge case:

If the area doesnt launch then the matchmaking system will never know, make a timer in the matchmaking system to drop players from loading if the area doesnt respond after X seconds

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: Area loading question
« Reply #10 on: Mar 02, 17, 05:25:19 AM »

possible edge case:

If the area doesnt launch then the matchmaking system will never know, make a timer in the matchmaking system to drop players from loading if the area doesnt respond after X seconds


Thanks, I don't thinking about it. Will have to doing something out about that.


Recent tests of the discussed design showed a good result - everything works as it should. But, I'm a little confused - when I initiate the creation of a new combat arena, the system reports the following error:

Quote
[Travel Failure Recovery] SCRIPT ERROR: TravelFailure for 9223372059369021589 area:9223372061780021595 inst: 3 reason:Travel failed unexpectedly while moving 9223372059369021589 to area 9223372061780021595, 3

but then, players traveling without problems to the area that was launched. I have the feeling that something in one of the scripts tries to send the players to the area before it is loaded. But, I checked all my scripts and have not found such attempts. Could something in clean engine do this?
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: Area loading question
« Reply #11 on: Mar 02, 17, 01:59:21 PM »

I have just ignored this error since it still seems to travel anyways. It happens on the first request to travel to a new area.

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: Area loading question
« Reply #12 on: Mar 04, 17, 09:04:12 AM »

I have just ignored this error since it still seems to travel anyways. It happens on the first request to travel to a new area.

Is this mean this error is common and reproducible?
If so - maybe engine's team should check out it? Or, maybe there is advice how to avoid it?

I feel it's all about time. Because while testing, I got situation when travel call was made many times with short time intervals. Five calls to be accurate. And I got four errors. Fifth time was successful.
Logged