Jump to content

  • Log In with Google      Sign In   
  • Create Account


Final Year Project


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Alon3k   Members   -  Reputation: 115

Like
1Likes
Like

Posted 09 November 2012 - 07:27 AM

Hi,

I'm looking on some advice on my final year project.
I'm trying to create a simple 2D Shooter game with destructible environment (e.g. Liero/Worms) and I'm quite capable of doing this.
Problem is I want to have a LAN game mode and i am totally new to this topic. My main coding
language is C++ I do have experience with Java/Allegro 5. During this year i am doing few projects based on DirectX11 but I'm still learning it... for
that reason I'm looking advice on:

- what would be the best library to use for networking ( fast and easy to learn )
- maybe you know any good tutorials that are worth looking into
- should I still use Allegro 5 for that project since I'm familiar with it or should I go for some other library that is quite easy to learn and I could use it for my destructible world ( mostly working on pixels, disjoint and flooding algorithms)
- is it possible to achieve that under 400 working hours?

I would like to make it really simple but the main focus of my project is create networked game.

If you need more information just ask.

Thanks

Sponsor:

#2 slayemin   Members   -  Reputation: 2425

Like
7Likes
Like

Posted 09 November 2012 - 04:12 PM

Considering your C++ background, I'd recommend picking up C# and going with XNA. You can have a simple game up and running in hours or a day (simple, like asteroids).

The net coding isn't too hard in C#, but it will take some planning and effort. Here are some questions to think about:
-What data do you want to send to other players? How are you going to organize it? (you're going to have to serialize and deserialize data off of a "stream")
-What happens if a player loses their connection?
-What if there is a data mismatch and your game states get out of synch?
-Are you going to use a peer-to-peer model or a client-server model? If client-server, how do you decide who is the server?

These are areas you shouldn't waste your time on:
-Shrinking the size of a data packet (you're on a LAN)
-Network and application security (This is a school project, not a public release)
-data validation (Use TCP/IP and just trust your clients)

My recommendation is to get something super simple up and running first. Then build the networking component, then make the game more complicated.
Example: Get two player controlled tanks to sit on flat terrain, each taking turns to shoot each other. Keep it simple. It should take a couple hours. Then, write the net code to get the games to connect and talk on a LAN, and then sharing game state data. You've now got a basic, networked, multiplayer game! Now, you can add features, update the network protocol, and see the changes in game play.

As far as network coding is concerned, most of the answers you're looking for a a google search away...
the basic outline is something like this:
1. Create a thread which listens for connections on a port
2. When a connection comes in, handle it and then wait for more connections
3. When a connection is established, think of both ends as reading and writing data from a file stream which can change under your feet. Before you write data out to the network stream, it has to be converted into an array of bytes (serialization). What those bytes mean is up to you to decide. When you get a stream of bytes, its up to you to decode and decipher their meaning as well. So, the common practice is to create a "header" which contains something to identify the type of data being sent, the byte length of the data, and then the data itself.
Trivial example:
suppose I have a "Mage" class like so:

class Mage
{
unsigned int ID = 1;
string Name;
}
If I want to send an instance of the Mage who has the name "Tim" to another computer, my serialized data would be:
[ID][Length][Name]
[1][3][Tim]
(but all the data would be converted to bytes)

The receiving computer will get an array of bytes containing this data. It reads the first byte, which is the ID. Then it says, "Aha, I know that I'm going to be deserializing a Mage object! The next item will be the length!", and then it reads off the value "3". Then it says, "Aha! The next value will be the data and its length will be three bytes! This data is going to be the name of the mage, so I should read it as a string!" and then it reads the next three bytes and converts them into characters which form the name "Tim".

You can also add extra metadata to handle the basic C.R.U.D. principles of all your objects (create, read, update, delete). You're also going to have to decide how you want to handle weird shit, like you sent a "Create" command for an object, followed by an "Update" command, but the "Update" command gets there first, so its trying to update an object which doesn't exist yet (which suggests adding frame numbers to the packet meta data and storing actions in a queue, but that may be getting unnecessarily complicated). It's great fun :)

Eric Nevala

Indie Developer | Dev blog


#3 rocklobster   Members   -  Reputation: 415

Like
1Likes
Like

Posted 10 November 2012 - 02:29 AM

If you do end up going with c++, have a look at Raknet.

Also, there is a networking and multiplayer section of these forums, probably already has your answers.

Edited by rocklobster, 10 November 2012 - 02:34 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS