Friday, October 22, 2010

A Working Server and Cient

It has been a while since my last post. I have tested the ideas from my last post and I am happy to report that the server and client programs work. I have tasted the code with 3 clients connected on a wired and wireless LAN. Here is a video of just the server and one client connecting to it. Enjoy. If any of you want me to post the code so you can help with the programming effort please comment on this post.





I realize that the video quality is not great, but it should at least give you an idea of what LOOSEIONS looks like.

~ Panos

Saturday, September 11, 2010

Client/Server Interaction Logic

Loose Ions will be a networked game. The initial implementation will assume the players are on the same LAN. It will be a real time game, which requires information about each client/player to be available to every player connected to the server. We will start with the server. The server uses the following SDL libraries:

#include "SDL/SDL_net.h"
#include "SDL/SDL_thread.h"

The first is used to create TCP/IP sockets and the second allows our server to create threads. We also use a vector from the Standard Template Library:

#include <vector>

The vector will be used to hold the individual threads that will be created each time a client connects to the server. Here is the vector initialization within main:

std::vector<SDL_Thread*> clients;

And here is the new thread creation after a new client is connected:

client_sockets[FREE_CLIENT_SLOT] = SDLNet_TCP_Accept(server_socket);
if (client_sockets[FREE_CLIENT_SLOT])
{
clients.push_back(SDL_CreateThread(client_thread, &client_sockets[FREE_CLIENT_SLOT]));
}

The idea is to accept a TCPsocket returned by SDLNet_TCP_Accept and then create and push a thread onto the "clients" vector. Function "client_thread" contains all the logic for accepting game related data from the client and it is also provided with a pointer to the client TCPsocket so it can read the data send by the client.

At this point I think the server has to create a new thread which will create a socket to the client in order for the server to feed information to the client. The reason for that is that the SDL_net library only provides blocked reads for reading socket data. I would feel uncomfortable using just a single socket for passing data back and forth from server and client since both server and client could get to a state where they are waiting for the other side to send data (resulting in a deadlock that would not be easily broken). Here is a graphical representation of the design:



By next week I should have a server with which I can test this design and see if it works for a couple of clients connecting to the server. The above design requires the clients to be themselves servers once they connect to the game server.

If you have experience with such a design please do not hesitate to comment. This is just an exercise so I can stay close to programming with C++ since my work does not require me to write in this language anymore.

~Panos

Monday, August 9, 2010

Born Again...






Hello out there,

I will be writing a game I have been thinking about for a while. The game is called Loose Ions and is based on Solar Winds, a DOS game I used to play when I was young. You are welcome to comment, download and try the game. This is an exercise for me to see how far I can go using C/C++.


Tuesday, July 7, 2009

Game Programming Club Postponed

Hello everyone,

I have decided to postpone the club meetings at least until after the summer is done due to small attendance. Unfortunately, I cannot commit to future meetings (after the summer) at this moment, but maybe the time will be there for me to attend/organize these meetings. If any of you have questions about programming (game or otherwise) feel free to email me. Have a great summer and I hope I see some of you next semester.

~Panos

Tuesday, June 30, 2009

No Meeting Tonight

Just as a reminder, there will be no game programming club meeting tonight.

Wednesday, June 24, 2009

What Do You Want To See???

We are making a strategy game similar to warcraft 2 by Blizzard Entertainment. Here is an example of the gameplay:



This will be a game from scratch. You have a chance to effect what it will look like. Use this post to send your ideas. What would you like to see in a game like this? What should the setting be, what about the time period? Alternate universe? alien world? Humans against Orcs? Humans against Aliens? Aliens against Orcs...? You can submit your ideas, a plot, graphics... whatever you think might make for a good game. This game will be open source so make sure that whatever you post here can be used in the game.

Questions? Email me at pansa99@gmail.com.

Cheers

Tuesday, June 23, 2009

Fifteen Puzzle Not So Simple For Computers

Trying to auto-solve the fifteen problem (even not by an optimal amount of moves) can be hard for the computer. Here is an article that describes the magnitude of the problem, and other AI approaches to puzzle problems like the Rubik's cube.

Link To Article

Have fun reading it!