Jump to content

  • Log In with Google      Sign In   
  • Create Account


!Null

Member Since 26 Jun 2012
Offline Last Active Apr 22 2013 06:44 AM
-----

Posts I've Made

In Topic: Networking A Game

29 November 2012 - 11:54 AM

Thanks guys for all the support. I'll continue to try to make this work and when I'm done i'll post the result (after its submitted otherwise It wont get marked at all)

Goran Milovanovic
Thanks I'll have a look at it :)

In Topic: Networking A Game

27 November 2012 - 02:18 PM


It's an FPS


Wait a second. From a one lecture that teaches you an Echo Server, you're supposed to know how to program an FPS networked game? I think something is missing here. Is it just a 2 player game or a true multiplayer (ie, 2 - 16)?

FWIW, creating a truly robust FPS Networked game is PRETTY FRIGGING HARD. Now, you can create a protocol that runs good over LAN, but would do poorly over the internet that's not too difficult (not too difficult for someone who understand networking protocols at least).

BTW, there's a networking forum here that has loads of information that you may want to look over all the posts there.


yep you got it right.

We haven't been given the exact spec yet but i get the impression that a 1v1 would be enough but even if you got a 1v1 going it would be just as 'easy' to get more players going.

If i could get it working over LAN that would at least be a step. I do know a little about networking but if I'mhonest I don't really like doing it from a programmatic stand point.

I've been looking through some of the functions and stumbled through some networking functions

NetAcceptTCP();
NetClose();
NetConnectTCP();
NetCreateChannel();
NetCreateChannelTCP();
NetDataReady();
NetGetIP();
NetReceiveFrom();
NetReceiveFromTCP();
NetSendTo();
NetSendToTCP();
NetSetMulticastIP();
NetVarReceiveFrom();
NetVarReceiveFromTCP();
NetVarSendTo();
NetVarSendToTCP();


Also thanks I might move the post over. And i'll have a look a look through there too.

In Topic: Networking A Game

27 November 2012 - 11:54 AM

It's an FPS

In Topic: Switch vs if else

11 November 2012 - 01:19 PM

While this might be language-dependent, you can't normally switch-case objects like strings. switch-case could only be used on integers, as it creates a jump/branch table. Additonally, in some languages, you are allowed to fall through a case statement.

switch (x) {
	 case 0:
	 	 doSomething();
	 case 1:
	 	 doSomethingElse();
	 	 break;
	 default:
	 	 doDefault();
	 	 break;
}

if x = 0, doSomething() and doSomethingElse() are executed. This style of coding could be useful in certain cases (no pun intended).


You are right. This is a language dependent thing because i know that in java 1.7 switch statements support strings

In Topic: Top Down TBS Tile Selection Help

03 November 2012 - 04:31 PM

here a quick example I wrote up. the code is java but the idea is the same

package example;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.*;
import javax.swing.*;

public class Main implements MouseListener
{
    private final static int SCREEN_WIDTH = 640;
    private final static int SCREEN_HEIGHT = 480;
    private final static int tile_size = 32;
    private int map[][];
    private int mousex, mousey;
    private JFrame frame;
    private JPanel panel;
   
    public Main()
    {
	    map = new int[SCREEN_WIDTH / tile_size][SCREEN_HEIGHT / tile_size];
	    frame = new JFrame();
	    panel = new JPanel();
	   
	    panel.setBackground(Color.red);
	   
	    frame.setSize(new Dimension(640,480));
	    frame.setContentPane(panel);
	    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	   
	    frame.addMouseListener(this);
	    frame.setVisible(true);
	   
	    int k = 0;
	    for(int i = 0; i < map.length; i++)
	    {
		    for(int j = 0; j < map[i].length; j++)
		    {
			    map[i][j] = k;
			    k++;
		    }
	    }
    }
    public static void main(String[] args)
    {
	    Main main = new Main();
	   
    }
    @Override
    public void mouseClicked(MouseEvent e)
    {
	    System.out.println(map[e.getX() / tile_size][e.getY() / tile_size]);
    }
    @Override
    public void mousePressed(MouseEvent e) {
    }
    @Override
    public void mouseReleased(MouseEvent e) {
    }
    @Override
    public void mouseEntered(MouseEvent e) {
    }
    @Override
    public void mouseExited(MouseEvent e) {
    }
}

PARTNERS