Wednesday, September 4, 2013

Scrolling and Jumping... ish

The plan is I should have a git repository online tonight. I will post the link to that later.

But for now I made a quick run a scrolling the background and moving a little dude around the screen left and right with basic, basic jumping. The code is a mess though and it definitely doesn't do what I actually need it to yet but it's something.

//END OF LINE

Friday, August 30, 2013

Super Doctor Who Update 1

I got to work on it a little bit today. I don't have a link to the project yet because it's not quite up on any svn/git system yet... Hopefully it will be by early next week.

But I have decided to do my project in C# using XNA. I've used this before and I love it. Visual Studios is my favorite IDE. So I got the project started and I have a menu system set up. It just has a timed title screen that goes into what will be the menu which then goes into the "game screen" (it's just a placeholder image for now) and that one has a pause screen. I used these little things called enums.

   enum GameState
   {
      TitleScreen,
      MenuScreen,
      GameScreen,
      PauseScreen
   }

And then you can just use a simple switch case to differentiate in the Update and Draw methods. Pretty easy. I've started some designing of how I'm going to set up the game, I'll update on that when I have more to say.

//END OF LINE

Thursday, August 29, 2013

50th post

For my 50th post I'd thought I'd let everyone I'm still alive. And I know I always say this but I'm planning on posting more regularly... At least I'll put more effort into it.

So my last post I posted this picture:

I've finally decided to run with it. I really have nothing to lose but my valuable time that I seem to be wasting mostly on watching some really good TV shows and crochet projects.

I have a busy weekend ahead of me and I won't be able to do much. But my goal is to get a Menu system up and running by the end of next week. After that I'll start work on the core of the game and getting a level scrolling across and people/baddies moving around on it.

So a really tentative schedule:
Week 1: Menu System
Week 2: Basic Scrolling Level and Moving Dudes
Week 3: Physics such as jumping and moving around and falling
Week 4: Graphics and Music???
Week 5: Misc. Stuff

This will just start of being a single level game but I'm hoping that if I build it the right way it should be easy enough to continue on and add new levels and baddies and such. I'll try to remember to keep updating my problems and progress.

//END OF LINE

Tuesday, March 5, 2013

Full of Ideas.

I have a couple of ideas I've been throwing around but I haven't found one I'm enough in love with to actually start the project. The closest one is based off of this image:



Actually doing something with it is going to take some time and effort... both of which I'm lacking at the moment.

//END OF LINE

Saturday, January 19, 2013

Interesting Tutorial

I've been working through this tutorial here. We'll see how things go with it, if they go anywhere.
I'll update as soon as I have something more to show than the programs that have been installed!

//END OF LINE

Tuesday, January 15, 2013

I'm still breathing.

I just haven't found time to work on any exciting projects now that I have a full time job and have discovered the joys of British TV shows. Unfortunately, I've caught up on my Doctor Who and Sherlock and have to wait until April for anything new (curse you Moffat!!!). Hopefully I'll have some willpower and motivation to get something created and built to brag about in my small social circles.

//END OF LINE

Wednesday, July 18, 2012

Simple Chat Program

For my final project in networking I created a simple Server/Client Chat Program. This is the final version of the server side code.


//Necessary Libraries
import java.io.*;
import java.net.*;
import java.util.*;


//The Server Class contains all the classes and functions that
//this Chat Server needs to run
//Start this Class by calling the startHostingServer Function
class Server
{
    //Holds the Socket connections with the Clients
    private ArrayList connections;
    
    private ArrayList dirtyWords;
        
    //Class that will Handle the Client Connection
    //This is a thread to allow multiple clients to
    //be handled concurrently
    public class ClientHandler implements Runnable
    {
        //Buffered reader for input from the Client
        BufferedReader reader;
        
        //The socket connection to the Client
        Socket sock;
        
        //The Constructor that will be used when creating a instance
        //of this class.  It takes as a parameter the Socket that
        //has been set up with the Client
        public ClientHandler(Socket clientSocket)
        {
            try
            {
                //Sets up sock and reader
                sock = clientSocket;
                InputStreamReader isReader = new InputStreamReader(sock.getInputStream());
                reader = new BufferedReader(isReader);
            }
            catch(Exception ex)
            {
                ex.printStackTrace();
            }
        }
        
        //This is what is run when the Thread is started
        //Gets any messages from the client and lets all the other clients
        //on this server know what the message is
        public void run()
        {
            String message;
            try
            {
                while((message = reader.readLine()) != null)
                {
                    tellEveryone(filterMessage(message));
                }
            }
            catch(Exception ex)
            {
                ex.printStackTrace();
            }
        }
    }
    
    //This is what is called to start the server
    //Creates a new StartServer and starts the getConnections
    //function
    //This is called by the StartHosting Class
    public void startHostingServer(int portNumber)
    {
        StartServer server = new StartServer();
        server.setupDirtyWords();
        server.getConnections(portNumber);
    }
    
    //This is the StartServer Class
    //This starts the server and gets connections to the clients
    public class StartServer
    {
        //This Sets up the dictionary that will be used to filter out
        //the dirty words that may be used
        public void setupDirtyWords()
        {
            dirtyWords = new ArrayList();
            try
            {
                //This is the file where the list of dirty words
                //are located at
                File dwFile = new File("dirtyWords.txt");
                FileReader fileReader = new FileReader(dwFile);
                BufferedReader bufReader = new BufferedReader(fileReader);
                
                String word;
                while((word = bufReader.readLine()) != null)
                {
                    dirtyWords.add(word + " ");
                }
                bufReader.close();
                
            }
            catch(Exception ex)
            {
                ex.printStackTrace();
            }
        }
        
        //Accepts Client Connections to the Server
        public void getConnections(int portNumber)
        {
            
            try
            {
                //Create the WelcomSocket for the Server to recieve Connections
                ServerSocket welcomeSocket;
                welcomeSocket = new ServerSocket(portNumber);
                
                //Initializes the connections ArrayList
                connections = new ArrayList();
            
                //This is continually run to continue accepting connections for
                //any host that may want to join
                while(true)
                {
                    Socket clientSocket = welcomeSocket.accept();
                    PrintWriter writer = new PrintWriter(clientSocket.getOutputStream());
                    connections.add(writer);
                    Thread t = new Thread(new ClientHandler(clientSocket));
                    t.start();
                }
            }
            catch(Exception ex)
            {
                ex.printStackTrace();
            }
        }
        
    }
    
    //send the message to everyone
    public void tellEveryone(String message)
    {
        Iterator it = connections.iterator();
        while(it.hasNext())
        {
            try
            {
                PrintWriter writer = (PrintWriter) it.next();
                writer.println(message);
                writer.flush();
            }
            catch(Exception ex)
            {
                ex.printStackTrace();
            }
        }
    }
    
    //This is the actual filtering of the message
    //This goes through the list of dirty words and makes sure
    //none of those words are present in the message
    public String filterMessage(String message)
    {
        for (int loop = 0; loop < dirtyWords.size(); loop++)
        {
            message = message.replaceAll(dirtyWords.get(loop).toString(), "*censored*");
        }
        return message;
    }
}


//END OF LINE