Jump to content
Sign in to follow this  
  • entries
    4
  • comments
    2
  • views
    548

Part 4: Portals and UI changes

Sign in to follow this  
trill41

558 views

Portals

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
    portal:SetTrigger(true)
    -- Set position of portal
    local x = -20.059
    local z = -0.00870347
    local y = 26.7
    portal:SetPosition(x, y, z)
  end
  
  -- ...
end

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
end

function onTrigger(creature)
  local player = creature:AsPlayer()
  if (player ~= nil) then
    player:ChangeGame(self:GetVarString("destination"))
  end
end

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.

Video

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.

fw2018-09-15-09-18-33.thumb.png.c90c2498d0104bb56d5d92a542d4e7ba.png

 

Sign in to follow this  


0 Comments


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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!