About Zone and Creation in SmartFoxServer2X With Code Snippets


zones example

Zone:- Zone is a collection of rooms, in the earlier session we discussed what is a room in smartfoxserver2x, if we collect/categorize different rooms under one roof/section that part can be considered as zone.

What Zone refers and What it consists

  • Zone consists various games/rooms.
  • When a player wants to join/play a game/room they need to join first in zone Means Player (Login->Zone Join -> Room Join).
  • The entire Zone related information held in zones folder of smartfoxserver2x with .zone.xml extension. (like casinogames.zone.xml, pokergames.zone.xml etc..)
  • Zone will control the rooms means Zone will acts as a parent and room is a child of zone.
  • If the user need to interact/control the zone we can control it programmatically.
  • We can’t create the zones at runtime, where as we can create the rooms at runtime of SmartfoxServer2x.

Zone Creation

  • We can create the zones manually by creating zone.xml files under zones folder
  • We can create the zones using SmartfoxAdminTool in easy GUI manner.
  • Simple code to create room from Server side:
  • Simple code to create room at Client side:

>When we have rooms why we need zones? Example

Let me explain Zone-Room with an example:-

I have the following games and I need to run those games in smartfoxserver2x those are

1. Star Wars (MMO game) 2. Lord of Rings (MMO game) 3. Roulette36 (Casino Game)
4. Dice Twister (Casino game) 5. Roulette18(Casino game 6. Joker World (Video Poker casino)
7. Lucky 74(Video Poker casino) 8. NoHolds(VideoPoker Casino) 9. TeenPati(Poker variant)
10. Texas Hold’em (poker Variant) 11. Omaha (poker variant)) 12. 7-card Stud(poker variant)

If you observe the above games there are mainly 4 categories like

  1. MMO Games
  2. Casino Games
  3. Video Poker Games
  4. Poker Games.

Now If all the games are clubbed as one group then

  1. Monitoring of users for a particular type is difficult.
  2. A Player can’t play multiple games at a time. Etc.,

So each Game Category can be considered as a Zone means MMOZone (Holds MMO Games), CASINOZone (Holds Casino Games), VIDEOPOKERZone(Holds VideoPoker games), POKERZone (Holds Poker games).

zones example

>Zone Level Events

  • SFSEventType.USER_JOIN_ZONE is the only event which is related to zone at server side.
  • ZoneJoinRequest() is the only request avail at client side related to zone.

> Zone Level Events Code Snippets