Forum > Non-Gaming Discussion > Gaming-related coding project
Gaming-related coding project
avatar
Country: US
Comments: 464
News Posts: 2
Joined: 2008-06-27
 
Sat, 07 Aug 2010 01:45:42
0

I haven't had much coding experience, and I won't before I get my computer science minor and graduate, but I do have a little experience creating windows forms and simple programs with C#. I've been thinking recently about creating an application that would list details about games, such as:

Title
Platforms
Release date for each platform
Developer
Publisher
Age rating (maybe just ESRB at first)

Is there anything I'm missing that you think I should include? Average review score may not be included because of how messy that business is, though I may end up putting it in (e.g. Metacritic score) just to give some sort of indication of how the game is viewed.

What I'm thinking of doing with this is making it so you can search various fields (like the ones listed above) to narrow down results. Then the program could list all the search results in a text file, I guess. It could use a text file to contain all the info on all the games released or announced up to a certain date, using this file to gather the information specified in the search. I don't yet have the know-how to make an updater program that would go online to places and gather information to place in the master text file, so until then, people could just enter the info manually. Of course, this would be for free distribution.

Just an idea. A little ambitious for my current level of skill with C#, and I may not have much time for it and could very well get burnt out before it's finished, but it sounded like a cool little thing to make, just to get more coding experience and for something practical I haven't seen elsewhere.

What does everyone think about this? Suggestions/recommendations are very welcome!

avatar
Country: US
Comments: 6467
News Posts: 413
Joined: 2008-06-21
 
Sat, 07 Aug 2010 02:06:43
0
You'd want to include genre, keep in mind that there can be multiple developers and publishers, and you may want to include tags to improve search results.

You've lost me on the text file notion.  You want to store the information in a database.  A table for games, a table for companies, a table for ESRB ratings, a table for platforms and a table for genres; you may also want an associative table between games and companies.  Visual Studio integrates into SQL Server.  If you're planning on making this a learning experience, make it about learning databases.  Plan it well, use it well.  And make damn sure it's normalized.

C# can do web requests with the HttpWebRequest object, but it's not really a language I'd go with for that task (Perl or PHP are better suited to that, in my opinion), but it's doable.
Edited: Sat, 07 Aug 2010 02:07:17

---

Tell me to get back to rewriting this site so it's not horrible on mobile
avatar
Country: US
Comments: 464
News Posts: 2
Joined: 2008-06-27
 
Sat, 07 Aug 2010 04:00:25
0
I've never done anything with databases or tags. All I have under my belt is 1.x semesters of C#. The only separate files (i.e. things other than buffers) we ever used for storage consistently were simple text files, with each entry on a separate line, and each entry consisting of several different parts, each of which was used for something. That was how I was going to structure the first version of this program, at least. First I'd like to get something that works, and then improve on it, whether or not drastic changes would be implemented.

avatar
Country: US
Comments: 6467
News Posts: 413
Joined: 2008-06-21
 
Sat, 07 Aug 2010 04:22:28
0
That's how I like to work as well -- get something working and go from there.  But seriously now, get right in there with databases.  You can take the same approach.  You can put together something downright ugly and just transcribe what you'd do in a flatfile directly into a single database table to start, but it's worthwhile to get the knowledge.

Whatever you're doing or however you approach it, I'm here to help as well.

---

Tell me to get back to rewriting this site so it's not horrible on mobile
avatar
Country: US
Comments: 464
News Posts: 2
Joined: 2008-06-27
 
Sat, 07 Aug 2010 15:55:20
0
So are you saying I should put the info in a spreadsheet? (Note: My Excel is a little old -- it's the 2003 version. Not sure if that matters. Also, I use Visual C# 2010 Express, so my IDE is up to date.)

I have no idea where to begin with a database. Don't have the slightest clue of what would be involved, code-wise. Do you have any specific tips regarding the code, or is C# not within your area of expertise? If I need to, I'll just browse some coding communities (which is how I was planning on finding coding info and advice in general, anyway).

avatar
Country: US
Comments: 6467
News Posts: 413
Joined: 2008-06-21
 
Sat, 07 Aug 2010 16:25:04
0
Angry_Beaver said:
So are you saying I should put the info in a spreadsheet?

By all that is unholy please no.

Visual Studio Express runs SQL Express.  You can use that for databases.

I'm a bit rusty on the .NET stuff, but conceptually you follow the same patterns regardless.  It sounds as though you're doing a Windows Form project, and not a web project, is that right?

For just connecting once the database and tables already exist...
The general logic for reading from a database in pseudo-code tends to be this,


open database connection
results = execute SQL statment
loop through results
    do something with the row
end loop
close database connection


To interact with the databse, you use Structured Query Language (SQL).  It's not very difficult for most things and is pretty straight-forward.  There are some minor differences between MSSQL and MySQL, for example, but it's generally consistent.

Here's an example in C# that selects the column "title" from the table "games" from the database "MyDatabase", for every title that includes the string "Mario", then goes through an gives you a message box for each game.

string connString = "Data Source=localhostSqlExpress;Initial Catalog=MyDatabase;Integrated Security=True";
SqlConnection conn = new SqlConnection(connString);
conn.Open();

sqlComm = new SqlCommand("SELECT title FROM games WHERE title LIKE '%Mario%'", conn);
SqlDataReader reader = sqlComm.ExecuteReader(CommandBehavior.CloseConnection);
while(reader.Read())
{
    System.Windows.Forms.MessageBox.Show("Game Title: " + reader["title"].ToString());
}
conn.Close();


However, before you get to any of this, you have to actually create your database stuff.  Visual Studio has a panel called the Server Explorer that shows your connection to the database server and all your databases and tables, and allows you to create tables.  Relational database tables are laid out like a spreadsheet (i.e. a table), but no, this is not like working with Excel.

There are GUI tools there for creating everything.  But as an example, here's the MySQL (I'm not 100% sure if there are differences in this example for MSSQL) syntax for creating a table

CREATE TABLE games (
    id INT AUTO_INCREMENT,
    title VARCHAR(100),
    score DECIMAL(3,1),
    PRIMARY KEY(id)
);


AUTO_INCREMENT specifies that when you add a new row, the id is generated automatically to be unique, VARCHAR is a text field, the number beside it is the max length; it differs from CHAR in that if you use say 5 characters, VARCHAR will just store the 5 characters, whereas CHAR will pad the remaining 95 characters with spaces. DECIMAL(3,1) indicates 3 digits with one decimal place, that is 00.0.  And PRIMARY KEY indicates the primary key, which is the unique identifier for each row.
Edited: Sat, 07 Aug 2010 16:26:56

---

Tell me to get back to rewriting this site so it's not horrible on mobile
avatar
Country: US
Comments: 464
News Posts: 2
Joined: 2008-06-27
 
Sat, 07 Aug 2010 21:39:09
0
I just had an idea: This could be integrated directly into this site! In that case, what language would I need to use?

avatar
Country: US
Comments: 6467
News Posts: 413
Joined: 2008-06-21
 
Sat, 07 Aug 2010 22:02:32
0
This site is written in PHP and MySQL.  If you can come up with something with a games database, that would be handy, as I am actually looking into adding collections to this site.

You can install WAMP (stands for Windows, Apache, MySQL and PHP) for Windows development in PHP.

Do whatever interests you and/or whatever is most important towards your future goals.  If you do head into PHP territory, I can provide you with some tools get you ahead -- probably the most useful being a database class to greatly simplify querying a database.

An example
<?php
require_once('Database.class.php');
$db = Database::getDatabase();
$rows = $db->query("SELECT title FROM games WHERE MATCH(title) AGAINST(?)", $_GET['search']);
print_r($rows);
?>


If you want some examples of good PHP code, I have a few open-source projects you can see here: http://github.com/derekhamilton/.  I'd recommend taking a look at LazyStructure, which is meant to be a launching point for websites, and I did my damndest to keep the code as clean and proper as possible.

---

Tell me to get back to rewriting this site so it's not horrible on mobile
avatar
Country: US
Comments: 464
News Posts: 2
Joined: 2008-06-27
 
Sun, 08 Aug 2010 00:33:12
0
Well, I was thinking that this could be a pretty complete game info thingamabob, with spaces of a sort for each game. Anyone who provides the site with news updates could link them to the respective game. And then everything important about the game, including news, could be discovered with the search feature that was more or less my initial idea.

The whole thing sounds like a massive task to this coding novice, though, so if you're eager to add an included feature to the site, don't hold your breath for me -- go ahead and do it at your leisure. Nyaa

avatar
Country: US
Comments: 6467
News Posts: 413
Joined: 2008-06-21
 
Sun, 08 Aug 2010 00:41:44
Angry_Beaver said:
Well, I was thinking that this could be a pretty complete game info thingamabob, with spaces of a sort for each game. Anyone who provides the site with news updates could link them to the respective game. And then everything important about the game, including news, could be discovered with the search feature that was more or less my initial idea.

The whole thing sounds like a massive task to this coding novice, though, so if you're eager to add an included feature to the site, don't hold your breath for me -- go ahead and do it at your leisure. Nyaa

I've already been pushing my luck just getting people to click categories.  Getting them to associate games ain't gonna fly.  Gotta be automated in some fashion -- tricky, but not impossible.

Anything even remotely resembling this is on the back-burner anyway.  Whole lot of redesigning taking precedence, but additional projects.

Edited: Sun, 08 Aug 2010 00:42:10

---

Tell me to get back to rewriting this site so it's not horrible on mobile
Log in or Register for free to comment
Recently Spotted:
Login @ The VG Press
Username:
Password:
Remember me?