MS .Net Framework with emphasis on online gaming - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

MS .Net Framework with emphasis on online gaming

Description:

Server/Client (request/response through one point) ... Dependent on hardware/operating ... Multi-Player Game Programming (Barron) Understanding .Net (Chappell) ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 11
Provided by: ed9164
Learn more at: http://www.cs.uccs.edu
Category:

less

Transcript and Presenter's Notes

Title: MS .Net Framework with emphasis on online gaming


1
MS .Net Framework with emphasis on online gaming
  • Ed Mucker
  • CS522
  • 9 Dec 02

2
Overview
  • Online Gaming
  • MS .Net Framework
  • .Net Framework Class Library
  • Project Implementation

3
Online Gaming
  • Architecture
  • Server/Client (request/response through one
    point)
  • Peer to peer (client responsible for sending all
    messages)
  • Transport Protocol
  • TCP - connection with server
  • UDP - communication with other players (chat
    functions)
  • Number of users
  • Dependent on hardware/operating system
    (hundreds/thousands)
  • Use of zones to distribute load (one zone per
    server)
  • Threading techniques used to accommodate multiple
    users

4
MS .Net Framework
  • Java architecture for Windows
  • Common Language Runtime (JVM)
  • MS Intermediate Language (Java Byte Code)
  • Executable code machine dependent (MS OS only)
  • CLR based languages
  • C (very similar to Java)
  • VB .Net/Visual C .Net/JScript .Net
  • Class interoperability between languages (CLS)
  • CLR services
  • Automatic garbage collection
  • Assemblies/metadata (manifest)

5
MS .Net Framework Class Library
  • Namespaces
  • Similar to packages in Java
  • Consists of subordinate namespaces and classes
  • Root namespace is System
  • Common Subordinate namespaces
  • IO, Net, Threading, Runtime.Serialization,
    Windows.Forms
  • Use within CLR languages
  • Syntax using System.XXXX
  • Similar to import statements in Java
  • .Net/User defined

6
Project Implementation
  • Client/Server Architecture
  • Generate simple multi-user TCP socket program
  • Implementation done in C
  • MS .Net Namespaces used
  • IO (reader stream)
  • Net (Network stream class)
  • Net.Sockets (TCP listener/client classes)
  • Threading (Thread class)
  • Safe Code - Delegates (pointer to function)
  • Asynchronous communication with multiple users

7
C Programming Example - TCP Listener
  • using System.Threading
  • public static void Main()
  • //var declaration code
  • TcpListener listener new TcpListener(8080)
  • listener.Start()
  • TcpClient client listener.AcceptTcpClient()
  • ClientHandler cHandler new ClientHandler()
  • cHandler.clientsocket client
  • ThreadStart t new ThreadStart(cHandler.RunClient
    )
  • Thread clientThread new Thread(t)
  • clientThread.Start()
  • listener.Stop()

8
C Programming Example - RunClient()
  • using System.Text using System.Net
  • public static void RunClient()
  • StreamReader read
  • new StreamReader (clientSocket.GetStream())
  • NetworkStream write clientSocket.GetStream()
  • string returndata read.ReadLine()
  • System.Console.WriteLine(returndata)//write data
    to screen
  • byte datawrite Encoding.ASCII.GetBytes(return
    data)
  • write.Write(datawrite, 0, datawrite.Length)
  • clientSocket.Close()

9
References
  • Multi-Player Game Programming (Barron)
  • Understanding .Net (Chappell)
  • Professional .Net Network Programming (multiple
    authors)
  • Mastering Visual C .Net (Price)

10
Questions????
Write a Comment
User Comments (0)
About PowerShow.com