Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

Part 4: Portals and UI changes

Sign in to follow this  



In games you find something that take you to other maps, sometimes this is called a Portal. On the server side Portals are just scriptable objects like NPCs. The game script adds Portals like it would add an NPC:

-- Game start up
function onStart()
  local portal = self:AddNpc("/scripts/creatures/logic/portal.lua")
  if (portal ~= nil) then
    -- Map ID where this portal leads to
    portal:SetVarString("destination", "75e3dfcf-479a-11e8-ad09-02100700d6f0")
    -- Will call onTrigger() when it collides
    -- Set position of portal
    local x = -20.059
    local z = -0.00870347
    local y = 26.7
    portal:SetPosition(x, y, z)
  -- ...

The script for the portal is similar to a script for an NPC:

name = "Temple of Athene"
level = 20
modelIndex = 11
sex = 0
creatureState = 1
prof1Index = 0
prof2Index = 0

function onInit()
  -- Player collides with BB. Make it a bit larger than the default BB.
  self:SetBoundingBox(-1, -1, -1, 1, 1, 1)
  return true

function onTrigger(creature)
  local player = creature:AsPlayer()
  if (player ~= nil) then

The process for changing a game instance is a bit complicated. The player is only connected to the game server when he/she is in a game instance. When you click on a map in the map window the client disconnects from the game server and connects to it again, telling the game server which map it would like to access. The game server creates an instance of this map, and adds the player to this instance.

A Portal is a bit different, because the server initiates the switch to a different map. Also we must distinguish whether the client enters an existing instance—which is always the case when using the map window and the instance is not full, because these are outposts where people can meet—or the server creates a new instance. This is the case when entering a battle field, which is exclusive for a party or two, e.g. a PvP combat. But when it comes to gameplay and game mechanics, nothing has been implemented yet.


UI changes

Several small changes to the UI were made. The people from Urho3D have updated the UI texture and styles, which I really like, it is so friendly and ... green xD. A big Thank You to the Urho3D developers for this great library!

Additionally the position of the health bar above the characters looks now more natural and speech bubbles have been added.



Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!