Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Networking & Multiplayer / Re: Database for gameserver on: 2012-06-03 16:27:02
Thanks, will keep that in mind Wink
2  Game Development / Networking & Multiplayer / Database for gameserver on: 2012-06-03 15:56:10
Hello, back again, I got a question, Me and some friends are creating a Game where there (hopefully) will be 1000 user's online.

I was thinking that the database would be on heavy load (our game is sort of mmorpg-ish).

and researched a bit, and found no sql.

But is this really worth the effort?

or is mysql(or h2) + hibrenate enough for that amount of people?

thanks!
3  Game Development / Newbie & Debugging Questions / Re: [SLICK]Seperate class image on: 2012-05-13 10:25:16
Here is my gameloop.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
@Override
    public void init(GameContainer gc, StateBasedGame sb)
            throws SlickException {
      player = new Image("res/player.png");
      if(!map.exists()){
         try {
            System.out.println("Creating file");
            map.createNewFile();
            } catch (IOException e) {
               // TODO Auto-generated catch block
              e.printStackTrace();
            }
      }else{
         try {
               WorldMap wmap = new WorldMap(map);
               System.out.println("Creating World!");
            } catch (FileNotFoundException e) {
               // TODO Auto-generated catch block
              e.printStackTrace();
            }

      }

      }

   @Override
    public void render(GameContainer gc, StateBasedGame sb, Graphics g)
            throws SlickException {
       // TODO Auto-generated method stub
     player.draw(0,0);
    }


Thanks.
4  Game Development / Newbie & Debugging Questions / Re: [SLICK]Seperate class image on: 2012-05-13 10:22:29
Not. (:

I changed some things to let it draw.

But it still doesn't show.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
public Graphics g;

   for(int x = 0; x < mapWidth;x++){
         for (int y = 0; y< mapHeight;y++){
            GrassBlock block = new GrassBlock(x,y);

            Entities.add(block);
            block.drawImage(g);
         }
      }

//----------------------------------------------Grassblock class------//
  public GrassBlock(int x,int y) throws SlickException{
      System.out.println("Created grass block at X:" + x + "Y:" + y +".");
      grass = new Image("res/grass.png");
      this.x = x;
      this.y = y;
      this.poly = new Polygon(new float[]{
            x+1,y+1,
            x+17,y+1,
            x+17,y+17,
            x+1,y+1

      });

}

   public void drawImage(Graphics g){
      g.drawImage(grass, x*16, y*16);
    }
 



Hope you can help! Smiley
5  Games Center / WIP games, tools & toy projects / Re: [HARDLY WIP] WorldOfCube on: 2012-05-13 10:17:57
Verry nice! Some friends and I are planning to create the same type of game, but a bit diffrent Wink.

Have fun programming you're game and good luck!
6  Game Development / Newbie & Debugging Questions / Re: [SLICK]Seperate class image on: 2012-05-13 09:43:38
No.

But do I need to do it in a render loop?

(Code for searching map (not completed yet, and just create's grass blocks)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public WorldMap(File f) throws SlickException, FileNotFoundException{
      Entities = new ArrayList<Object>();
      mapWidth = 100;
      mapHeight = 100;


      for(int x = 0; x < mapWidth;x++){
         for (int y = 0; y< mapHeight;y++){
            Entities.add(new GrassBlock(x,y));
         }
      }
   }


Here I call the method:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
private File map = new File("maps/alpha.grind");
      if(!map.exists()){
         try {
            System.out.println("Creating file");
            map.createNewFile();
            } catch (IOException e) {
               // TODO Auto-generated catch block
              e.printStackTrace();
            }
      }else{
         try {
               WorldMap wmap = new WorldMap(map);
               System.out.println("Creating World!");
            } catch (FileNotFoundException e) {
               // TODO Auto-generated catch block
              e.printStackTrace();
            }

    }


Do I need to put the drawImage method in the render loop?

And how should I do that?

Thanks!
7  Game Development / Newbie & Debugging Questions / Re: [SLICK]Seperate class image on: 2012-05-13 09:07:21
I did this:
1  
2  
3  
   public void drawImage(Graphics g){
      g.drawImage(grass, x*16, y*16);
   }

But it doesn't seem to work, I get this as result:
http://imgur.com/631fs
8  Game Development / Newbie & Debugging Questions / [SLICK]Seperate class image on: 2012-05-13 08:42:47
Hello, I have a question for you guys.
I'm making a small game where the world is generated and it is read and then it places block's (where needed)
Example:
If there is a 1 in my file I do this:
1  
new GrassBlock(x,y);

In my GrassBlock I have this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public class GrassBlock{

   private Image grass;
   private Polygon poly;
   private int x;
   private int y;
   public GrassBlock(int x,int y) throws SlickException{
      System.out.println("Created grass block at X:" + x + "Y:" + y +".");
      grass = new Image("res/grass.png");
      this.x = x;
      this.y = y;
   }

   public void draw(Graphics g,int x,int y){
      g.drawImage(grass, x, y);
   }


It print this out:
Created grass block at X:99Y:98.

but it doesn't show, Any help why?

Thanks!
9  Game Development / Networking & Multiplayer / Re: World server on: 2012-04-08 19:51:37
so create a Player class and then when I go into the thread create a player and just send those paramaters via getters and setters?

10  Game Development / Networking & Multiplayer / Re: World server on: 2012-04-08 19:34:57
Thanks for the reply.

But it doesn't seems to work,

I use this line
1  
    RealmWorldServer.clients.sendMessage("pc| |X| 200 |Y| 200");


to send to the client(player) a message that he needs to create a player a X 200 y 200

But I do that when the client runs what means that it just gona create a user.

The problem is that I don't know how I should check all user's on connected and then draw them all.

thanks!
11  Discussions / General Discussions / Re: Bugfixes on: 2012-04-08 17:43:36
Good work!
12  Game Development / Networking & Multiplayer / World server on: 2012-04-08 17:03:48
hi, I'm working on a world server.
I'm sturgeling with getting player's already online and show them.
What I now do is create a worldsendThread (a listener for movement and connecting) and add it to a
1  
List<worldsendThread>

then in the
1  
2  
3  
public worldsendThread(Socket client){
//here i add the thread to a list
}


Here is the actual code:
 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
   private Socket client;
   public static PrintWriter out;
   public static BufferedReader in;
   public WorldSendThread(Socket worldClient){
      this.client = worldClient;
      RealmWorldServer.clients.addThread(this);
   }
   
   
   @Override
   public void run(){
      try {
          out = new PrintWriter(client.getOutputStream(),true);
          in = new BufferedReader(new InputStreamReader(client.getInputStream()));
         String line = "";
         while ((line = in.readLine()) != null){
         System.out.println(line);
         Scanner sc = new Scanner(line);
         
         RealmWorldServer.clients.sendMessage("create player X 200 Y 200");
         
         
         }

         out.close();
         in.close();
      } catch (IOException e) {
         
         e.printStackTrace();
      }
     
   }
   
   
   public void sendMessage(String message){
      out.println(message);
   }


The problem is with this code, when I connect It draws a player without anyone else being that player.

Anybode knows how to solve this?


Thanks!
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (18 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (70 views)
2014-08-11 02:49:23

BurntPizza (47 views)
2014-08-09 21:09:32

BurntPizza (38 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!