首页 > > 详细

辅导R、R设计辅导留学生、解析R编程、R编程解析、辅导留学生R设计

Introduction
This prototype version of StahrWars is intended to test the concept and rules for a multi-user new game. The prototype
version uses a GUI to display a sector of space. This document describes the game concept, the internal design, the
current prototype implementation of the game, and extensions to the prototype that are needed.
Concept of the Game

StahrWars takes place in space. It allows “unlimited” players to navigate through space and “interact” with one
another.
The universe consists of a grid of 16 x 16 (256) Sectors. Each Sector consists of a grid of 10x10 cells. For
navigation purposes, the cells and sectors use column-row format (A5), as illustrated below.
Although the universe appears to have boundaries, it actually wraps around on itself from top to bottom and side to side.
Thus, for example, when traveling east from Sector P8 Cell J1, the next cell encountered would be Sector A8 Cell A1.
This would be denoted (as a return call from the server) as Loc:A8:A1 Where “Loc” means location, “A8” is the sector,
and “A1” is the cell in the sector you as a player is located.

Places in space consists of: ships, stars, planets, black holes, and treasure.

Each player is given a ship and placed in a cell in a sector. Stars, planets, and black holes are randomly scattered
throughout the universe.
Sending data to and from the server and client should be as small as possible. We can discuss options in class but you
may want to consider other forms of the data.

1. Ship
a. Has 100 life power
b. Has 15 shields.
c. Has 50 fuel pods. One fuel pod is used per cell
d. Has 50 phasors shots and 10 torpedoes. Phasors do 5 points of damage and Torpedoes do 15
e. Can rotate
f. Can fire a phasor or a torpedo in the current direction they are facing.
g. Can move (1 cell at a time)
h. Can hyperspace (this will place you at a random position in the universe and consume 5 fuel pods)
i. Will be destroyed if they hit a star or land on a star using Hyperspace
j. Will regenerate fuel, phasors, torpedoes, shields, and life if landing on a planet (same cell as a planet)
k. Cannot move or shoot when shields are up but can hyperspace to a random location in the universe.
l. Commands:
i. j:username join game
ii. quit quit game
iii. v:{ sector || u } (eg, v:N14 or v:u) view sector or universe
iv. f:{ p || t } fire phasor or torpedo
v. m:{ 1-3 || h } (eg, m:3 or m:h) move 1-3 cells or jump to hyperspace
vi. s:{1 || 0 } turn shield on (1) or off (0)
vii. r:{ n || s || e || w } rotate ship N, S, E, or W
viii. me :{ l || v } me:[l]ocation or me:[v]itals

2. Star
a. Are solid and will destroy anything that touches it.
b. Are randomly placed around the universe

3. Planet
a. Are used to regenerate all health and equipment (life, shields, fuel pods, phasors, and torpedoes)
b. Are randomly placed around the universe

4. Black Hole
a. Are teleports to random locations in the universe


The Server

As you know, the server should contain the “full” game. This means that it should act like a stand-alone game with a
full data structure of all universe objects. The server will be in charge of “answering” all questions asked of it by the
clients. Remember, when a client sends a request to do something the server must receive that message, process it, and
echo the request back to the client so the client knows the server has received and processed the request. Below is a list
of some potential messages that could come from the server:
1. connected:true:sector:col:row ......................Server telling player they are connected and their sector/cell location
2. connected:false:message ....................................Server telling player they are not in the game and the reason why
3. quit ...............................................................................Server telling client to either quit or disconnect from game
4. treasure:{amount}................................................................................... Server telling client they received treasure
CSE-383 M. Stahr
Due: no later than 5-15-2018 @ 3:00pm StahrWars Inspired by Dr. Troy’s 1997’s SpaceWar project

5. damage:{amount}:message ................................................ Server telling client they were damaged and the reason
6. loc:sector:col:row:{ n || s || e || w }............................. Server telling user giving client their location and direction
7. sec:sector:{data} ................................................. sector in column/row form. (eg., A5). “data” format listed below
8. uni:{data} ................................................................................“data” will describe the universe and is listed below

Server “data” stream

The “data” that follows the sec: or the uni: should be formatted as follows:
For both sectors and universe data we can describe all we need in 2 bytes per occupied cell. A byte can store
values 0 to 255 so 1 byte can indicate every sector in the universe. The 2nd byte indicates what object is located at
that location – you have 256 options you could choose from. The nice thing about only using 2 bytes per cell is
the server only needs to send the cells that contain objects. If a cell is empty then we do not need to include it. Ths
will save on network traffic.
Sector byte information example:
In the example to the right you’ll see there are a total of 11 objects
the server needs to report on when asked the status of a sector. The bytes
sent would look something like:

[0-3][2-2][11-1][28-1][34-4][47-3][56-1][63-1][88-2][90-1][91-3]

Stars = 1
Planet = 2
Ships = 3
Black Hole = 4

Note: You would convert each of the 2 bytes (eg., [88-2]) to a two byte string. You would not literally send “88-2”
as part of a string. An example of the above would look like this:

byte[] sector = { 0,3,2,2,11,1,28,1,34,4,47,3,56,1,63,1,88,2,90,1,91,3 };

and, assuming the sector the server is reporting on is A5, you
would send the data like:


server.Reply(System.Text.Encoding.UTF8.GetString("sec:A5:" +
sector));

Universe byte information example:
The data for a universe will follow the same thought pattern
as the sector example except that the data will return the number
of opponents located at each sector.

The data in the example to the right would be constructed as such:
server.Reply(
System.Text.Encoding.UTF8.GetString(
"uni:" + sector
)
);
1. You must turn in a “manual” for the game. This manual will give instructions on how to play your version of
the game. This will include what calls a client can make to the server as well as what data structure will be
returned from the server.
2. Use my starter code or start from scratch
a. You can either create a Window’s GUI or console app. .......................................... no difference in grade
b. Expand on my code or your code with little or no OOP implementation........................Max grade of 90%
c. Expand on my code or your code with OOP implementation .........................................Max grade of 95%
d. Expand on my code or your code with OOP implementation and convert to TCP .......Max grade of 100%
3. You may implement other server-side method options; however, you must clearly document your additions.
This document may not be finished…

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!