Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

380 Neutral

About !Null

  • Rank

Personal Information

  1. !Null

    Networked Game

    Okay so. I'm working on a project for University. It's an FPS.   I have made a basic server and the client and server can communicate via UDP (fairly simple stuff)   My question basically is, how should I deal with sending data from the client to the server and broadcasting the data of all players back to the client.   I've never really done anything like this before so it's all new to me.   Any advice would be appreciated.
  2. !Null

    Networking A Game

    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
  3. !Null

    Networking A Game

    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. [/quote] 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(); [/quote] Also thanks I might move the post over. And i'll have a look a look through there too.
  4. !Null

    Networking A Game

    It's an FPS
  5. !Null

    Networking A Game

    Okay so I'm taking this courses while I'm abroad and our final big project is to build a game (which is fine) and network it. The latter is my concern. We had a lecture / lab on building a echo server in C which i got most of I guess. But now I'm not sure how I'm suppose to mold this to help me network my game. The game is developed using a scripting language developed by the college (which has heavy hints of C++). I'm not looking for you guys to 'do my homework for me' I'd just appreciate some step in the right direction. If you need to know anything just let me know.
  6. !Null

    Switch vs if else

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

    Top Down TBS Tile Selection Help

    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.length; j++) { map[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) { } }
  8. !Null

    Top Down TBS Tile Selection Help

    say you have a map array which is 32x32 (tiles of size 32x32 not a whole picture) and say your screen size was 640x460 this gives you a total number of tiles x:20 y:15 20 x15 = 300 tiles this means that we can do very easy mouse translation. when you click the mouse. get the mouse x and y location of the click/ then do something like int tile = map[ (int)mouseX / 32][(int)mouseY / 32] so to show an example of this. imagine your screen 640x480 and imagine we click at mouse location 450 150 450 / 32 = 14 150 / 32 = 4 so now we have our tile 14 across and 4 down which would select tile 56. as for making the tile brighter im not sure
  9. Sweet. be sure to let us know how you get on
  10. Okay. The simplest way to do a tiled map with textures (images) is simple You have your width of your window and the height of the window (say 640x480) and then you want to assign a tile size. this will be the size you want the 'environment' to be (not the characters or enemies etc) so trees,grass all that stuff. I usually pick either 16x16, 32x32 or 64x64 for my tiles. Then (if we are not using slick and tiled maps) we do the following below. static final int WIDTH = 640; static final int HEIGHT =480; int tileSize = 32; int map[][] map; Random rand = new Random(); public void init() { map = new int[WIDTH / tileSize][HEIGHT / tileSize] for(int i = 0; int i < map.length; i++) { for(int j = 0; j < map.length; j++) { map[j] = rand.nextInt(2); } } } } we create a 2D array for our map (just like a matrix) and the size is basically how many tiles across and down your map is. So 640 / 32 = 20. 480 / 32 = 15. (you can obviously create your own maps and load them in from a text or something but That's too much detail for the moment. after that all you have to do if loop through the code. if the element at index i,j = 0 we draw nothing (or a default tile) and if the element at index i,j = 1 we draw something interesting for(int i = 0; int i < map.length; i++) { for(int j = 0; j < map.length; j++) { switch(map[j]) { case(0): g.drawImage('your default tile',i*32,j*32); break; case(1): g.drawImage('your interesting tile',i*32,j*32); break; default: g.drawImage('default tile',i*32,j*32); break; } } } } and this will draw out your tile map. after which you draw your player after you draw you map, so that the player is rendered on top of the map and not behind. then when you want to move a player between somewhere on the map. you can just to tile movement (eg move it by a tile at a time rather than pixels at a time) The slick2D way is a lot easier in my opinion though. If you make a 2D map using Tiled map editor. you can load and display the map very quickly like this import org.newdawn.slick.*; public class Game extends BasicGame { private TiledMap map; public Game() { super("This is where you put the title"); map = new TiledMap("location") //and some other parameters I can't remember off the top of my head. Check the javadock for slick } public static void main(String[] args) { AppGameContainer gc = new AppGameContainer(new Game()); gc.setDisplayMode(640,480,false); gc.start(); } @Override public void init(GameContainer container) throws SlickException { } @Override public void update(GameContainer container, int delta) throws SlickException { } @Override public void render(GameContainer container, Graphics g) throws SlickException { map.render(); } } Simples ;). and you can still do your gird movement and stuff the same way. Sorry if this is a long winded explanation. if something is unclear just ask. hope this helps
  11. Oh yeah Slick2D is up to date. You just need to download the Nightly build (as that's always the most recent update) I'm just a bit confused as to why you have a grid of buttons. Do you want to select characters with the mouse or whatever and have them move to that point (animating while moving?) If so there are easy ways of doing this. Also you can used Tiled editor to make your tiled maps and loads them into java with the Slick2D methods
  12. !Null

    Integer multiplication, division

    Could you please elaborate on that? What exactly is the factor that causes the calculation to be processed in 16-bit? Shouldn't the program detect that its running out of precision and automatically use a bigger (i.e. 32-bit) temporary buffer? Which variables exactly should be increase in size? EDIT: Is there a way to increase the temporary buffer size without changing the variable data types? [/quote] That's not how it works. Yes there is something that causes the calculation to be processed in 16-bit...its the fact you told it that your values are all 16 bit signed integers. when you get an overflow, instead of crashing your program. The value gets wrapped around. so when you reach the max value, it goes back to 0 and starts counting up again. Is there a reason you chose int16_t or did you copy it from somewhere. Like I said change it to int32_t or higher and see the results
  13. If you are using Java + Netbeans have you had a look at Slick2D. http://slick.cokeandcode.com/ I've used it for many 2d tile based game project. It has support for tiled maps and makes animation easy. If you wan't more info you should have a look at it and you can send me a message or something. or ask more questions here.
  14. !Null

    Integer multiplication, division

    I think you have found your answer from most of these replies. If you don't believe them then change them to int64_t and see the result
  15. !Null

    UDK + Character models

    My profession is Software engineering and I have a part time job writing ASP.NET software. I'm quite advanced with Java, c#. and I am intermediate with c++
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!