DogusLogo

 

 

T.C. DOĞUŞ UNIVERSITY

ENGINEERING FACULTY

DEPARTMENT OF COMPUTER ENGINEERING

COME 491

Project

Project Name

BigBang via Internet

 

Erdinc AYDIN

 

Advisor : YRD.DOÇ.DR. YASEMIN KARAGUL


 


 

Preface

 

 

This thesis is based upon studies during October 2009 to February 2010 at the Department of Computer Engineering, Doğuş University, Istanbul. The project which explained blow and subject of the thesis is created in 2008-2009 for come 334 Rapid Application Development with Microsoft .Net. The project is developed as graduation project and this thesis is written to explain the project.

I would like to express my sincere gratitude to my leading supervisor Associate Professor Yasemin KARAGUL for his advice and unique support to this thesis. 

 

Also I would like to thank my old lecturer Mithat KONAR for his support in the creation time of the project.

 

 

 

Istanbul, February 2010                                                                    Erdinç AYDIN


 

 

Abstract

In this thesis, a new version of the bomberman is describes and discussed which is developed by Erdinc AYDIN as graduation project of Dogus University in 2010. The name of the game is changed and the new name of the game is BigBang. This thesis is not include creation of the game, it includes how to make the game multiplayer. This thesis mainly includes UPnP and .Net Remoting technologies.

 

Universal Plug and Play (UPnP) is a set of networking protocols developed by the UPnP Forum in 1999. With UPnP, every network device which has UPnP support can connect and communicate seamlessly. In this thesis, communication between any device which supports NAT and a computer for port forwarding is explained.

 

 .Net Remoting is a technology, which follows a series of protocols, for different applications to communicate with one another in the different systems. This technology belongs to Microsoft, so it only works on Microsoft operating systems like Windows CE, Windows XP, Windows 7.

Özet

 

Tez bomberman adlı oyunun Erdinç AYDIN tarafından Dogus Universitesi için bitirme projesi olarak geliştirilen, yeni bir versiyonunun anlatıyor ve açıklıyor. Oyunun adı BigBang olarak değiştirildi. Bu tez oyunun yapılışını içermiyor, nasıl çok-oyunculu yapıldığını içeriyor. Tez esas olarak UPnP ve .Net Remoting’i  içeriyor.

 

Universal Plug and Play (UPnP), 1999’da UPnP Forum tarafından geliştirilen bir takım ağ iletişimi kurallarıdır. Her UPnP destekleyen aygıt, diğer aygıtlara bağlanabilir ve iletişim kurabilir. Bu tezde, NAT yapabilen her hangi bir aygıtla bir bilgisayarın port yönlendirmek için arasındaki iletişim anlatılacak.

Bir seri protocolü izleyen .Net Remoting, farklı uygulamaların farklı sistemlerdeki diğer bir uygulamayla iletişim kurmasını sağlayan bir teknelojidir. Bu teknoloji Microsofta aittir, dolayısıyla sadece Windows CE, XP, Windows 7 gibi  Microsoftun işletim sistemlerinde çalışır.

LIST OF TABLES

Preface. i

Abstract ii

Özet ii

1.      Introduction. 1

1.1.       How Does it Works. 1

1.2.       Abbreviations. 1

2.      Everything about Project 2

2.1.       Rules of  BigBang. 2

2.2.       Used Technologies. 3

2.2.1.        UPnP (Universal Plug and Play) 3

2.2.1.1.        How to Enable UPnP. 7

2.2.2.        .Net Remoting. 10

3.      What Have Been Done. 14

4.      Playing Game. 19

4.1.       Option Screen. 19

4.2.       Pause Screen. 21

4.3.       GameOver Secreen. 21

4.4.       Game Screen. 22

4.5.       SubForm.. 24

4.5.1.        About Form.. 24

4.5.2.        Help Form.. 24

Biblography. 25

Biography. 26

 

 


 

LIST OF FIGURES

 

2.2.1‑1 Figure. 3

2.2.1‑2 Figure. 3

2.2.1‑3 Figure. 5

2.2.1‑4 Figure. 6

2.2.1.1‑1 Figure. 7

2.2.1.1‑2 Figure. 7

2.2.1.1‑3 Figure. 8

2.2.1.1‑4 Figure. 8

2.2.1.1‑5 Figure. 9

2.2.1.1‑6 Figure. 9

2.2.2‑1 Figure. 10

2.2.2‑2 Figure. 11

4.1‑1 Figure. 19

4.1‑2 Figure. 20

4.2‑1 Figure. 21

4.3‑1 Figure. 21

4.4‑1 Figure. 22

4.4‑2 Figure. 23

4.4‑3 Figure. 23

4.4‑4 Figure. 23

4.5‑1 Figure. 24

4.5.1‑1 Figure. 24

4.5.2‑1 Figure. 24

 


 


1.                Introduction

This project is about a game (BigBang) and its actual name is bomberman. “Bomberman is a strategic, maze-based computer and video game franchise originally developed by Hudson Soft. The original game was published in 1983 and new games in the series are still being published to this day.” (http://en.wikipedia.org/wiki/Bomberman_(series)) This game is still very popular; there are single and multiplayer versions of the game. Game generally doesn’t require high graphics so lots of computer can run the game.

Story of the game is about another planet which is called Planet Bomber. Robots make bombs in this planet and robots called as bomberman. There is a challenge to see who makes best bombs, survivor wins the competition and proofs it is the best. (http://en.wikipedia.org/wiki/Bomberman_(series)#Story)

 

This project have been written in .Net C# and developed with Microsoft Visual Studio 2008.

1.1.         How Does it Works

This game works via internet and two players can play game in different computer in different locations. NAT is necessary for to play via internet. Server is reached with network address translation and public IP. .Net Remoting provides communication between client and servers.

1.2.         Abbreviations

This game only works on computers and Microsoft operating system windows XP and later including Servers. If player wants to play on internet NAT must be done. But some network administrator will not let UPnP to realize that and some router cannot use UPnP so players have to make NAT manually. All computers cannot run this game, so it is not possible to play in every computers like netbooks. But test showed that lots of computer can run this game.

 

 

 


 

2.                Everything about Project

 

Project is a game which is called BigBang. The game is created for another project by me. Now, two player can play this game from different computers via Internet. Old version of game doesn’t support this. Players had to share same keyboard so they had to be in the same computer and same location. There were two bugs and now, new version of the game doesn’t include these bugs too.

 

2.1.         Rules of  BigBang

 

·        This game just can be played with two player

·        Need two computer

·        Can be played in a private network or via Internet

·        If players are in public network, public IP should be known and

Port Forwarding should be done

·         If players are in private network, private IP should be known  

·        Player cannot cross boxes, other player and walls.

·        If gift box blows off in effect of bomb 3 gift can be appear

o   More health

o   More Bomb

o   More effect for bombs

·        If a open gift blows off, it disappears

·        Close gifts and boxes have same appearance 

·        Normal boxes won’t give any gifts

·        Normal boxes can be blow off with bombs

·        Every gift can be picked by any player

·        Players start with 100 health, 1 bomb with 1 square effect

·        Maximum 20 bomb can be dropped by one player at the same time

·         One bomb can be not enough to kill other player. Distance of player and bomb, which goes off, is important to hurt other player more. 

·        When one bomb goes off, all bombs goes off too if they are in its effect

·        Players must kill each others before all boxes and gifts gone

·        No object can be moved by players

·        Only one player can win the game or none can win


 

2.2.         Used Technologies

For game, three important technologies have been used. C# for developing game the game , UPnP to making NAT (Network Address Translation) without users attempt and .Net Remoting to access to server and share status of the game with remote machine.

 

2.2.1. UPnP (Universal Plug and Play)

http://upload.wikimedia.org/wikipedia/en/thumb/c/cb/UPnP_logo.svg/180px-UPnP_logo.svg.png

2.2.11 Figure

 

Universal Plug and Play is Plug_and_play over network. A plug and play device is ready when it is plugged. It loads its software and get ready to be used. UPnP allow a device to communicate, learn other devices capabilities and use these capabilities. UPnP is independent from any programming language and platform. That’s why it is widely usable. Before UPnP devices had to know their protocols to communicate so it was impossible to communicate with all devices. In 1999 UPnP forum developed UPnP, now most of devices support UPnP and can communicate over UPnP Protocol.

 

http://www.deviceforge.com/files/article036/it06031_g2.gif

2.2.12 Figure

(Jeronimo & Weast, 2003) http://www.deviceforge.com/articles/AT9110123456.html )


 

UPnP Protocol works in six steps. Steps are:

1 -)Addressing

2 -)Discovery

3 -)Description

4 -)Control

5 -)Event notification

6-) Presentation

 

Addressing

 

Every device in a network must have an IP address. All devices, UPnP device must have an IP. Firstly, It searches for a service DHCP (Dynamic Host Configuration Protocol) . If It finds a DHCP then gets its IP from this service. If not It gets a suitable IP as “AutoIP” from UPnP Device Architecture.

 

Discovery

 

In this step a protocol is in action SSDP (Simple Service Discovery Protocol). According to this protocol a UPnP device should advertise itself and share its control points to others when they added itself to the network and an UPnP device can get other devices’ control points with use of this protocol.

 

SSDP IP: Multicast 239.255.255.250 in IPv4

SSDP Port: UDP 1900

 

Description

 

After getting control points, If this device needed to use, more information about that device is getting from a XML file. URL of that XML file is advertises, XML files contains model name and numbers, serial number etc. Also Description includes embedded devices and services as well as control eventing and more importantly commands for every UPnP supported services.

 

Control

 

After Description received, UPnP device is now ready to send commands to other UPnP device. These control messages must be in a format of XML using the SOAP (Simple Object Access Protocol).Device knows what to send according to information from description.

 

 


 

Event notification

 

Every UPnP device should send periodic event notifications. This protocol is defined in the UPnP Device Architecture is known as GENA (General Event Notification Architecture). Aim of these messages are to inform all UPnP devices what the state of its services are and new updates of services.  When a new device is joins to the network, it sends a special message to inform names and values for all evented variables and its state of services.

 

Presentation

 

A device can have a URL for presentation, the control point can retrieve a page from this URL, depending on the capabilities of the page, allow a user to control the device and/or view device status. The degree to which each of these can be accomplished depends on the specific capabilities of the presentation page and device.

 

2.2.13 Figure


With use of UPnP Protocol a device can register itself in a network and use or control other network devices according to their abilities over UPnP. In this project, UPnP will be used to configure Router to make a Port Forwarding – can be known as NAT (Network Address Translation) – to use a port over a public internet. Luckily, .Net has a library for UPnP API Reference "NATUPnP 1.0 Type Library". ( (Pietschmann, 2009) http://pietschsoft.com/post/2009/02/05/NET-Framework-Communicate-through-NAT-Router-via-UPnP.aspx) So in C# it is easy to use this library to make a NAT. Almost all routers supports this technology – Of course exception of router which is produced before 1999. – and it generally UPnP is enabled in these routers as default.

 

If router supports and enabled UPnP and computer which is connected to network allows UPnP (If firewall of operating system allows), with few simple codes NAT can be realized. Blow an example of router which NAT have been applied.

 

There is an example blow in figure 3.2.1-4. Machine erdoi (192.168.1.168) have used UPnP to make Port Forwaring in port TCP 1200.

 

2.2.14 Figure


 

There are lots of program which uses UPnP to make NAT like MSN, SKYPE, P2P Programs. Especially Pear To Pear programs use UPnP to make port forwarding. They need to be reached from internet so they have to open and forward to pc which they are installed. But many users don’t know how to make NAT, even they cannot open configuration of their router. Even though an alternative way exists, it requires a middle computer and less effective than port forwarding.  That’s why first option is UPnP NAT for lots of program. But if UPnP is not supported, enabled or allowed in firewall rules still these programs can work.

Unfortunately, UPnP can be seen as a security risk. An unwanted program can control user’s router. Open ports to outside of private network. But if user lets a program which is not trustable, then that program can do anything. So again user is the key. If user doesn’t trust a program she/he shouldn’t allow this program. Otherwise UPnP can create a security risk. To sum up, UPnP is not a security risk, user is.

2.2.1.1.                 How to Enable UPnP

 

Firstly UPnP should be enabled from router. All routers have different configuration interfaces so there is not a simple way to do this. Blow I will show how to enable UPnP in PİRELLİ DİSCUS DRG A226G MODEM.

2.2.1.11 Figure

Open configuration page from internet explorer, then entering router password. Click to Advance menu and click Universal Pug and Play. (In 2.2.1.1‑1 Figure)

2.2.1.12 Figure

Click “let other network devices to control network properties” then, click OK (In 2.2.1.1‑2 Figure), to enable UPnP to be advertise in network.

Secondly, if any firewall exists on the way to router, you should let UPnP in all of them. For Windows XP, Windows 7, configuration of firewall is shown blow.

Windows 7

1        Click on Start button, then select Control Panel

2        Click on Network Internet Access

3        Click on Network and Sharing Center

4        Change advanced sharing settings (2.2.2‑3 Figure)

5        Click “ Turn on network discovery” to enable UPnP  (2.2.2‑4 Figure)

2.2.1.13 Figure

2.2.1.14 Figure

Windows XP

1        Click on Start button, then select Control Panel

2        Click on Windows Firewall

3        Open Exceptions Tab

4        Make checked UPnP Framework


 

                     2.2.1.15 Figure

 

To check UPnP is allowed in windows firewall. Check SSDP Network Discovery is enabled or not. Port of SSDP is UDP 1900. You can check SSDP Service is working or not too.

2.2.1.16 Figure

If UPnP service is not installed, visit site of Microsoft to learn how to enable UPnP ( http://support.microsoft.com/kb/941206 ). Otherwise UPnP is now ready to use. Game can control router to make port forwarding now. But if users are in a private network UPnP is not needed at all.

One other important point is that, this game uses TCP 1200, if this port is in use for another service or application. UPnP in the game shouldn’t be used. If another computer uses this port and game makes port forwarding, other application can be stop working. If another application in the same computer uses same port, then one of them must change working port. For this XML files should be changed more on this will be discussed later in .Net Remoting part.

To see ports used in a computer, a simple program like “CurrPorts” can be used. CurrPorts is network monitoring software which displays lists of all currently opened TCP and UDP ports on user’s local computer. For each port in the list, information about the process that opened the port is also displayed, including the process name, full path of the process, version information of the process. This program can also save the list in an XML or HTML file and can kill processes to stop using that port. User can see if TCP 1200 is in use or not.

2.2.2. .Net Remoting

 

.NET Remoting is a system for different applications to communicate with one another. These applications can be in same computer or different computer in the same or different networks (via Internet). Applications can be run by different operating system and can be written in different programming languages. So .Net Remoting is not platform depended. This property gives a big advantage. You can get information from a Server 2008 to a pocket PC with different programming languages. Unfortunately, you cannot use any language or OS which is not Microsoft. 

 

http://www.yazgelistir.com/images/cenk_remoting/2.gif

2.2.21 Figure

(http://www.bilgininadresi.net/Madde/543/.Net-Remoting---Bölüm-2 )

 

Messages, which are transported over channel, are coded and encoded with binary or soap. Message is coding and encoded according to protocols of selected channel. If TCP channel is selected messages should be serialized with binary. If HTTP channel is selected messages should be serialized with SOAP which means messages must be in XML format.

Objects can be gotten by remote program with two kind, copying and references (Marshal by value & Marshal by reference). In Marshal by value, a copy of object is serialized and sent to remote application and remote application keeps a copy of these objects. In  Marshal by reference, a proxy is created and if an object is needed a metadata in proxy is used to get reference of that object.


 

 

2.2.22 Figure

 

When a call is made between objects in the same Application Domain, only a normal local call is required; however, a call across Application Domains requires a remote call. In order to facilitate a remote call, a proxy is introduced by the .NET framework at the client side. This proxy is an instance of the TransparentProxy class, directly available to the client to communicate with the remote object. Generally, a proxy object is an object that acts in place of some other object. The proxy object ensures that all calls made on the proxy are forwarded to the correct remote object instance. In .NET Remoting, the proxy manages the marshaling process and the other tasks required to make cross-boundary calls. The .NET Remoting infrastructure automatically handles the creation and management of proxies.

The .NET Remoting Framework uses two proxy objects to accomplish its work of making a remote call from a client object to a remote server object: a RealProxy object and a TransparentProxy object. The RealProxy object does the work of actually sending messages to the remote object and receiving response messages from the remote object. The TransparentProxy interacts with the client, and does the work of intercepting the remote method call made by the client.

(Hassan, 2006) http://www.codeproject.com/KB/IP/Net_Remoting.aspx )


 

There is two ways to create a server to respond clients “Singleton” and “SingleCall”. Singleton is that for every client request, only one server-side object is used and same reference is sent to clients. In SingleCall for every client request one new server-side object is created and reference is sent to clients. In my project, It is not important because just one client is exist. 

There are two ways to configure remote object. One way is embedded in code, other way is putting in a XML file. In my project, configuration is made by XML file. Advantage of this method is that every time configuration is changed, another compilation is not needed. So user can change port if it is necessary. Configuration file must be in a extension of “.config” and both server and client must have different configuration files.

Client Side < client.config >

<?xml version="1.0"?>

<!--Changing this file can broke game-->

<configuration>

            <system.runtime.remoting>

                        <application  name="Istemci">

                                   <client>

 

                                               <wellknown type="RemoteObject.RemoteBigBang,RemoteObject" url="tcp://192.168.1.168:1200/RemoteObject" />

 

                                   </client>

                        <channels>

                                   <channel ref="tcp client" />

                        </channels>

                        </application >

            </system.runtime.remoting>

</configuration>

 

It has:

·        name of client application

·        Remote class and namespace

·        IP of server machine

·        Port of server application

·         Used Channel (TCP\HTTP)


 

 

Server Side < server.config >

<configuration>

  <system.runtime.remoting>

    <application name="ProjectDotNet">

      <service>

        <wellknown mode="SingleCall" type="RemoteObject.RemoteBigBang,RemoteObject" objectUri="RemoteObject"/>

      </service>

      <channels>

        <channel ref="tcp server" port="1200"/>

      </channels>

    </application>

  </system.runtime.remoting>

</configuration>

 

It has:

·        name of server application

·        Remote class and namespace

·        Server mode (SingleTon \ SingleCall)

·        Port of server application

·         Used Channel (TCP\HTTP)

 

If this port is not proper for that computer user can use another port number or even another channel. But she/he cannot make UPnP NAT, she/he have to make NAT manually, if they want to play in the internet. To change port of game both client and server side of configuration file must be modified. Blow underlined parts should be changed to use a different port.

 

Server :  <channel ref="tcp server" port="1200"/>

 

Client : <wellknown type="RemoteObject.RemoteBigBang,RemoteObject" url="tcp://192.168.1.168:1200/RemoteObject" />

 

It is better to give port numbers bigger than 1024. Because 0 – 1024 is well-known ports, other ports are for applications.


 

3.                What Have Been Done

This game have been developed for another come project and old version had some problems like bugs and difficulties to play. Blow all new changes will be discussed.

Old version of the game had two bugs, One of the bug was that player could not move one way after in milliseconds of moving other way. It was because of work protocol of the “key pressed” event. When a key pressed, that function will not be called again about a half of second. To avoid that I have used four variables which represent directions (Up, Right, Down, Left). Then I create a timer to control these variables. If one of them is one (true), this means that direction is wanted to go. So there was no delay on directions.

class PressedDir

    {

        public static int P1Up = 0;

        public static int P1Right = 0;

        public static int P1Down = 0;

        public static int P1Left = 0;

        public static int P1Bomb = 0;

 

        public static int P2Up = 0;

        public static int P2Right = 0;

        public static int P2Down = 0;

        public static int P2Left = 0;

        public static int P2Bomb = 0;

    }

In the play class

if (tmr1Direction.Enabled == false && blLockP1 == false)

            {

                if (e.KeyCode == Keys.W)

                {

                    blLockP1 = true;

                    currentDirP1 = GameControler.Direction.P1Up;

                    control.playerDirection(GameControler.Direction.P1Up);

                    tmr1Direction.Start();

 

 

                } . . .

if (tmr1Direction.Enabled == false && blLockP1 == false )

            {

               

                if (PressedDir.P1Up == 1)

                {

                    blLockP1 = true;

                    currentDirP1 = GameControler.Direction.P1Up;

                    control.playerDirection(GameControler.Direction.P1Up);

                    tmr1Direction.Start();

                   

                    return;

           . . .

 

            if (e.KeyCode == Keys.W)

            {

                PressedDir.P1Up = 1;       

} . . .


 

One other bug was that, when a player move one duplication of player could be created on the game field. Reason of this problem is that movement of a player controls with three functions (Play, GameController and Player) and in Player function there is a timer to give movement effect. That’s why before completing movement a new movement could be started and this caused duplicated player on the game field. Those duplications were impossible to erase before restarting game too. To get rid of this bug, I have created a lock mechanism. This mechanism locks when a direction is selected in Player form and unlocks when movement is done in Player form. During lock no new movement is accepted in Player form. This new update destroyed the old bug.

Lock mechanism in player class

public static bool blLockP1 = false;

        public static bool blLockP2 = false;

        public static bool blP2Arrived = false;

 

 

        private static bool blnP1Move=true;

        private static bool blnP2Move = true;

        public static bool blnPlayer1Move // Changed by Player in timer

        {

            get { return blnPlayer1Move; }

            set

            {

                if (value == true)

                {

                    blnP1Move = true;

                    control.changeLocation(currentDirP1);

                    //remoteObjs.setblGameFieldChanged(true);

                }

                else

                    blnP1Move = false;

            }

        }

        public static bool blnPlayer2Move// Changed by Player in timer

        {

            get { return blnPlayer2Move; }

            set

            {

                if (value == true)

                {

                    blnP2Move = true;

                    control.changeLocation(currentDirP2);

 

                }

                else

                {

                    blnP2Move = false;

                  

                }

 

            }

        }


 

 

 And at the movement in the GameController class

…

      }

            if (arrGameField[P2newLoc.X, P2newLoc.Y] != RemoteObject.RemoteBigBang.GameObjects.Bomb)

                arrGameField[P2newLoc.X, P2newLoc.Y] = RemoteObject.RemoteBigBang.GameObjects.Player2;

            if (arrGameField[P2newLoc.X, P2newLoc.Y] == RemoteObject.RemoteBigBang.GameObjects.Bomb)

                arrGameField[P2newLoc.X, P2newLoc.Y] = RemoteObject.RemoteBigBang.GameObjects.BombAndPlayer2;

           

            Play.RemoteNewLocP2(new Point(P2newLoc.X, P2newLoc.Y));

            Play.blLockP2 = false;

            return;

        }

             

Old version of the game doesn’t support two keyboards and two computers. I have created a new form client and change lots of class (Player, Play, GameController) I manage to use two computer. Most importantly, I have use .Net Remoting to communicate two computers for this game. All game status and movements have been shared with server and got from server with .Net Remoting. More on 2.2.2 .Net Remoting

As an example of usage of remote object, in the client class

RemotingConfiguration.Configure(Application.StartupPath + @"\client.config", false);

                remoteObj = new RemoteBigBang();

                Application.DoEvents();

 

                if (P2name==null || P2name == "")

                    P2name = "Player2";

                remoteObj.setP2Name(P2name);

                remoteObj.setPause(false);

 

                //this.Parent.Hide();

                gameArray = remoteObj.getGameField();

 

                GameControler.gameSize.X = remoteObj.getGameSize();

                GameControler.gameSize.Y = remoteObj.getGameSize();

                gameScreenC.Size = new Size(remoteObj.getGameScreenSize(), remoteObj.getGameScreenSize());

                this.ClientSize = new Size(gameScreenC.Size.Width, gameScreenC.Size.Height + 50);

                oldGameArray = new

                    RemoteBigBang.GameObjects[GameControler.gameSize.X, GameControler.gameSize.Y];

                oldGameArray = remoteObj.getGameField();

               


 

 

Below The Remote Object of the game listed. The functions are not listed but they are just get and set methods for the variables which listed in blow. Both server and client reach the same variables with get and set methods. Both server and client have same objects.

  private static bool blStopP2 = false;

        public static GameObjects[,] arrGameField;

        private static int P1_Moved = 0;

        private static int P2_Moved = 0;

        private static bool blRemoteLockP2 = false;

        private static bool blRemoteLockP1 = false;

        public enum GameObjects // This Array Keep What is in that Point

        {               // Box,Player , gift .. When we need to diplay all of that

            Empty = 0, 

            Gifts = 2,

            Box = 1,

            Wall = 4,

            Player1 = 5,

            Player2 = 6,

            Bomb = 7,

            BombAndPlayer1 = 8,

            BombAndPlayer2 = 9,

 

            FlameMid = 10,

            FlameSide = 11,

            FlameFaB = 12,

            FlameMidAndGift = 13,

            FlameSideAndGift = 14,

            FlameFaBAndGift = 15,

            GiftMoreBomb = 16,

            GiftMoreEffect = 17,

            GiftMoreHeath = 18,

            FlameAndPlayer1 = 19,

            FlameAndPlayer2 = 20,

        };

        private static int GameSize;

        private static int GameScreenSize;

        private static string P1Name = "";

        private static string P2Name = "";

        private static Point locP1;

        private static Point locP2;

        private static string status;

        private static bool blClose = false;

        private static bool blPause = false;

        private static int gameOver = 0;


 

 

Old version of the game doesn’t support playing via internet too. After completing server/client of the game I have used UPnP to reach server in the internet. With UPnP and .Net Remoting, it is possible to play with two separate computers in two different locations. More on 2.2.1 UPnP (Universal Plug and Play).

 

 

                NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();

                NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;

                label1.Text = findMyIp();

                if (checkThisIp(findMyIp()) == false)

                {

                    MessageBox.Show("There is an error: IP is not correct " + findMyIp()

                    , "BigBang", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    btnUPnP.Enabled = true;

                    return;

                }

 

                try { mappings.Remove(1200, "TCP"); }

                catch { } // Delete if this port is in use probably closing problem

                mappings.Add(1200, "TCP", 1200, findMyIp(), true, "BigBang UPnP (TCP:1200)");

               

            }

            catch

            {

                btnUPnP.Enabled = true;

                MessageBox.Show("There is an error: Check firewall in Operating System & Router\n"+

                    "Check UPnP is supported and enabled on router"

                    , "BigBang", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

 

IP is taken with a function, findMyIp(), and it just finds IPv4 IP and it forwards to port 1200. If TCP:1200 is used before it deletes firstly and then makes port forwarding. If a firewall blocks or there is no UPnP supported NAT device, user gets an error.

4.                Playing Game

Playing game is very simple. You have to choose few setting then you are ready to play. All port forwarding and .Net Remoting is covered by program. Two player can play game at the same time. One must be server and it has to open a port over internet if they want to play via internet. Otherwise NAT is not necessary. Client must know what client IP is to join the game. Options of the game are selected by server side of game.

4.1.         Option Screen

In Option screen server must choose Size Of Field, Quantity Of Boxes and Quantity Of Gifts.

To become a client, player has to

·         Click Server button

·         Select game Options

·         Enable UPnP if necessary 

·         Click picture of bomberman

Size Of Field : Small , Medium, Big

Quantity Of Boxes: Few, Medium,Many

Quantity Of Gifts: Few, Medium,Many

 

Private IP of server is written on form text but public IP must be learned by user.

 

4.11 Figure


 

For Client side,Client cannot start a new game. To start a new game player must be server. Client can only join in a game which server created before. Client cannot select any game options but she/he has to know server IP. To become a client, player has to

·         Click Client button

·         Enter IP of server

·         Click picture of bomberman

4.12 Figure

 

When player selects Client - As seen in the figure 4.1‑2 Figure all game properties and UPnP gone and IP blocks comes. IP belongs to server side. If player are in a private network IP can be a private IP but if they are playing over Internet they have to use public IP and make NAT in the router.

Ping First is used to check if server is reachable or not. If server is not reachable, this game freezes for about a minute. That’s why pinging first is important. But some network and/or system administrators can disable pinging. That’s why player can disable pinging too.

If player makes right click on option screen, it can reach to help and about screen of the game. In about screen there is information about game and references which includes where pictures have been taken from. In the help screen players can learn keys and what the rules of the game are.

If no name is entered, names will be player1 for server and player2 for client player. IP must be a unicast IP address otherwise program will show an error message and till you enter a unicast IP, game will not be started.

After clicking picture of bomberman, game will start in a few seconds, after animation of bomberman ends.


4.2.         Pause Screen

When server starts game it has to wait remote player to join to the game. Pause screen comes after server start game and dissapears when client enters to game. If server wants to quit wating it has to press to escape.This will end remote connection and application itself. Server side can make pauses every time she/he wants with escape key on the game. Pause screen will appear on the client side too and game will pause. Client cannot escape or create a pause, only server can control pauses. To stop a pause server can just press any key and they can continue to play the game.

4.21 Figure

 

If one of player left game while it is on, other side gets an information dialog box and close program. If one player wins both gets a dialog form which informs winner and then closes program.

4.3.         GameOver Secreen

This screen appears when game is over and indicate player who is the winner of the game. To exit this screen, players can click to close button or press a key in the keyboard. Both server and client sees winner of the game and then game close itself.

4.31 Figure

 

4.4.         Game Screen

Two player, client and server side, see same game field and they have same advantages. So they have same fair game. They can follow their health and how many box & gift left in the status screen in the blow of play screen.

In this game Players have to use Keys;

Direction:

           W

            ↑

A    ←     →   S

           ↓        

           D

Bomb dropping:                     Space

Pause (just for server):           Escape   (in Client, it draws screen again)

4.41 Figure


 

Gifts in the Game

MoreBomb Gift : At the beginning of the game each player can have one just one bomb. If a player picks this gift, it can drop one more bombs at a same time.

4.42 Figure

MoreEffect Gift : At the beginning of the game each player can have one square effect with one bomb. If a player picks this gift, it can have one more square effect for its bombs.

4.43 Figure

MoreHeath Gift : At the beginning of the game each player can have 100 heath. Bombs can hurt player and if a player picks this gift, its heath rises.

4.44 Figure


 

4.5.         SubForm

Players can reach subForms with right clicking on the Option screen. Starting game and closing game are options in this context menu strip. Help and About are the subForms which are for helping players.

                          4.51 Figure

4.5.1. About Form

About Form is designed to show users information about game and where pictures are taken from.

4.5.11 Figure

4.5.2. Help Form

Help Form is designed to show users keys and rules about playing the game.

4.5.21 Figure

 

Biblography

 

Hassan, S. N. (2006, Juyl 12). .NET Remoting with an easy example. Retrieved January 14, 2010, from codeproject.: http://www.codeproject.com/KB/IP/Net_Remoting.aspx

Jeronimo, M., & Weast, J. (2003, June 6). Universal Plug and Play -- the Foundation of the Digital Home. Retrieved January 12, 2010, from deviceforge: http://www.deviceforge.com/articles/AT9110123456.html

Pietschmann, C. (2009, february 5). .NET Framework: Communicate through NAT Router via UPnP (Universal Plug and Play). Retrieved January 12, 2010, from pietschsoft.com: http://pietschsoft.com/post/2009/02/05/NET-Framework-Communicate-through-NAT-Router-via-UPnP.aspx

 


 

Biography

 

Erdinç AYDIN was born on September 22, 1988 in İstanbul. He graduated from Ataşehir Lisesi in 2005. After that he entered the Department of Computer Engineering in Doğuş University. He still continues his education in Dogus University as a   Computer Engineering student. He wants to develop himself at the area of software engineering and management information systems.