Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 23rd, 2006, 5:27 PM   #1
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
Question C++ game help

My first assignment for my software engineering degree is to make a game in C++. I would like to make a Civilization style turn based game that can be played over the internet. However, for this I need two machines to be able to communicate the game data between them.

The programming language I know is PHP. I know that if I were making this in PHP I would use a MySQL database to hold the game data so that each instance of the game could access it from a web browser.

I have been told that I cannot use c++ on the actual server (not sure if my host would allow it anyway) so I'm just wondering if there is anyway that the two programmes running on different machines could share the data as I believe for C++ to be able to communicate with an online database there will need to be C++ running on the actual server??

Any suggestions would be greatly appreciated.




Ta Ade
__________________
Don't wound what you can't kill
Ade is offline   Reply With Quote
Old Mar 23rd, 2006, 5:49 PM   #2
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
I couldn't see a first assignment being a game... isn't that usually the project which either passes you or fails you, at the end of your course? I'm guessing you're only talking about a 2d game though since you want to make it in php I assume?
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Mar 23rd, 2006, 5:52 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Presuming you wish to communicate with the normal http protocol, you address the server with that protocol, however you wish to do that, and with whatever language. The server has no inkling of that; it only knows that it got a request for a resource. You may provide that resource with whatever facilities the server has available. Presuming that you have access to the server for purposes of putting the matching software there, you may mix and match to your heart's content. That's why there's a protocol.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 23rd, 2006, 7:26 PM   #4
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
Jayme this assignment is basically 100% of my programming module for my first year so that's why it's a big one. It doesn't have to be as complicated as what I'm looking at but I want a first! It has to be in C++, I only mentioned PHP as that is the language I have knowledge in working with Databases.

So Dawei, if I have a hosting account with a company that lists "PHP / Perl / C / SSI" under the details of the hosting account could I put some software written in C on there that would be able to communicate with the C++ programme on any computer and allow the exchange of data between it and the database?
__________________
Don't wound what you can't kill
Ade is offline   Reply With Quote
Old Mar 23rd, 2006, 7:57 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
You missed my point, maybe. The server code doesn't have to be in the same language as the client code. Unless your assignment requires it, you can use PHP or whatever. Your first step is to design your app. What goes on the client? What goes on the server? What will be passed between the two? On the server, what is passed between the server-local tiers (server code and DB)? You can't possibly make an effective and timely application without doing these things first. You'll wind up with a sow's ear sometime next year.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 23rd, 2006, 8:07 PM   #6
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
Sorry for all the stupid questions, you'll have to forgive my ignorance.

So what you are saying is that I would be able to write a PHP programme for the server and a C++ programme for the client and they would be able to communicate with each other to place data into and extract data from a database, say MySQL?

Client's computer Server Database
c++ prog. >> php prog. >> MySql
and
c++ prog. << php prog. << MySql

<< / >> is meant to equal data flow.

I might be being really retarded and have missed the point again completly.


Basically what I need is to get data about the game such as where one of the player's units are and share it with all the clients running the game via (I assume the internet and as far as I can see a database).


Thanks a lot for your help man.
__________________
Don't wound what you can't kill
Ade is offline   Reply With Quote
Old Mar 23rd, 2006, 8:39 PM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
You have the picture right as far as the data flow, now. To conduct business with two clients in the same game, you might want to go to a non-typical transaction, such as chat clients might use. Keeping track of more than a couple players with the standard request/response thangy could get a tad hairy. I'm not denigrating you here, but you have a lot to get your head around other than C/C++, if you're starting essentially from scratch.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 24th, 2006, 2:23 AM   #8
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
Yeh I totally understand that, I may have to scale down and think about using the same machine as it is a turn based game. Having said that I am a very quick learner and I do have six weeks to do this, the support of my lecturers and no other work at all.

Last question I promise.....

If I were getting the clients to talk directly to each other (I assume that's how a chat client works) what should I research?



Thank you so much
Ade
__________________
Don't wound what you can't kill
Ade is offline   Reply With Quote
Old Mar 24th, 2006, 7:49 AM   #9
Seif
Hobbyist Programmer
 
Seif's Avatar
 
Join Date: Jan 2006
Location: UK
Posts: 214
Rep Power: 3 Seif is on a distinguished road
what uni are you at? sounds like a harsh assignment for the 1st year! I'm doing software engineering at swansea, and I didnt have to do anything that tough until i got to my second year (where i am now), which only involved making a sudoku program.
Seif is offline   Reply With Quote
Old Mar 24th, 2006, 7:51 AM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Actually, chat clients typically talk to each other through a common server, which handles the traffic. Nothing says you can't rig up two machines to talk to each other, though, just about any way you like. You need to research sockets. Here's a link to Beej. Even though it's Unix specific, it's highly applicable to Windows machines, also, with just a little effort.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC