Wasteland
created by Jeremy Skogen
Setting Up Wasteland
- This Section was taken from Brian Johnsons page with permission.
Opening Wasteland
Open the wasteland.zip file and extract the wasteland directory someplace. Start visual studio and select File, Open Web Site. Select the wasteland directory and continue.
After doing that, go to the view menu, and select "Solution Explorer".
Important Files
There are a few main pages that I will briefly explain.
- Default.aspx
This is the login page that the user will start at. If they have a login and password it will forward them to the Main.aspx page. If they dont they are given the option to create a new account. They are taken to the account creater wizard provided by aspx. Once the account is created the character is created at the CharGen.aspx page.
- CharGen.aspx
This page will walk the user through creating thier wasteland account. They pick a name, sex, and class. The classes currently provided are scientist, handyman, and soldier. The submit button must be pressed to enter the information into the database. Once submitted, continue will take them to the main page.
- Main.aspx
This is where the game is played. On the top-middle the users statistics are displayed. These statistics are loaded from the wasteland database. On the left the users inventory is displayed, selecting an item will display that items information below. The center of the screen is an ascii map with buttons that move the character up, down, left, and right. The page is controlled by the underlying C# code in the Main.aspx.cs file.
- Main.aspx.cs
This is the C# code that controls the Main.aspx page. The functions are run when events are triggered such as a form loading, an item in a list being selected, or a button pressed. The labels and buttons can be used as objects in this code. Objects are created in the aspx page in the following format;
<asp:Label ID="LabelUserName" runat="server" Text="Label"></asp:Label>
The ID is what is used as a variable name in the C#.
For database access I used the following code.
SqlConnection thisConnection = new SqlConnection(
@"Server=big-blue\sqlexpress;Integrated Security=True;" +
"Database=wastelandDB");
thisConnection.Open();
SqlCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "SELECT * FROM Char WHERE UserID = '" + User.Identity.Name + "'";
SqlDataReader result = thisCommand.ExecuteReader();
This would only work for one command though. Each aditional command had to do this process again.
Database
The database is provided in the DB folder. The WastelandDB contains all the tables and information for the program. In order to get it to work you must add the database by right clicking on the wasteland project in the top right. Select add an existing file and open the wastelandDB.mdf file.
Future Additions
Since this was a large project there are many places that could be expanded.
- The interface is not customizeable and the user may want to change its appearance.
- There is a crude administrator page that could be expanded to allow remote monitering of users and activities.
- The account creation could be modified to include the character creation as well.
- The ability to open a session and make multiple querys would save much time if implemented.
- There is no way for multiple users to interact at this time, a feature allowing users to see who else is on would be valuable.