Show Posts
|
|
Pages: [1]
|
|
1
|
Game Development / Game Play & Game Design / (Sports) Manager Games
|
on: 2010-03-20 10:18:11
|
|
Hello all,
I´m currently making a football manager game. I started to make the simulation of the game engine so it's gonna be like - real time, where you see every action that happens on the field - like the ea sports games, but you cant control any players, just watch em go.
Well. I found out its gonna be a bit hard / complicated to make the gameplay look good.
So, I thought I use some alternate style to simulate the matches.
Problem is, I dont play much manager games. I liked the old "Manager". It was a soccer manager game with really simple simulation showing only the highlights of the game.
Have you made or played a manager game? What kind of way you chose to make the simulation? Was it any fun to play?
Any thoughts?
|
|
|
|
|
2
|
Game Development / Newbie & Debugging Questions / Re: Graphics flickering
|
on: 2010-01-06 15:10:55
|
Im starting to find the problem  The doublebuffering is working ok, im quite sure, and allways was working. I tried to draw every players name under them and it worked ok  no flickering. There must be some bug in the codes between the ball and the player carrying it, that causes it not to draw the text every cycle. Well, thanks for your help anyways  status = feeling dumb;
|
|
|
|
|
3
|
Game Development / Newbie & Debugging Questions / Re: Graphics flickering
|
on: 2010-01-06 13:01:31
|
|
I tried to use your constructor code.
I had to move the buferstategy codes to last, because they caused the game to crash. It said something like "component must have a valid peer".
Now the game behaves like it did before.
I draw black text and background that dont move. Those look great. The players on the field are ok. I think they flicker a bit. Not much. But the white text under the ball carrying player that indicates his name flickers like mad.
if ( ball.state == 1 || ball.state == 2 ) { g.setColor(Color.white); g.drawString(messageballcarrier,(int)ball.x -20,(int)ball.y + 20); }
I started to think that maybe I am doing doublebuffermode ok, but the ball.x double to int coordinate conversion could make some flickering kind of effect?
My current constructor code: public ThegameFrame() { JFrame frame = new JFrame("Death Match Manager"); frame.setIgnoreRepaint( true ); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Canvas canvas = new Canvas(); canvas.setBounds(0, 0, 1024, 768); canvas.setIgnoreRepaint(true); // canvas.createBufferStrategy(2); // canvas.addMouseListener(new MouseControl()); canvas.addMouseListener(this); canvas.addKeyListener(new KeyInputHandler()); // strategy = canvas.getBufferStrategy(); JPanel panel = (JPanel) frame.getContentPane(); panel.setPreferredSize(new Dimension(1024, 768)); panel.setLayout(null); panel.add(canvas); frame.pack(); frame.setResizable(false); frame.setVisible(true); panel.setVisible(true); canvas.setVisible(true); canvas.requestFocus();
// nämä piti siirtää setvisiblen alle canvas.createBufferStrategy(2); strategy = canvas.getBufferStrategy(); //OMAAA gamestate = 1; // 1 = Setup phase, 2 = Game on, // score1 = 0; // score2 = 0; matchon = true; for ( int i = 0; i < 8; i++) message = " "; // add a key input system (defined below) to our canvas // so we can respond to key pressed // request the focus so key events come to us // requestFocus(); Random generator = new Random(); // ALUSTETAAN DEBUGGAUS JOUKKUEET Player player = new Player(this,"ogrelay.png",370,350,1); player.makeOgre(); player.name = "Ogre dude"; entities.add(player); for ( int i = 0; i < 9; i++) { player = new Player(this,"lay.png",generator.nextInt(300),generator.nextInt(768),1); player.makeHuman(); entities.add(player); player.name = "Lineman dude"; if ( i == 6) { player.name = "Wing dude"; player.position = 3; //WING } if ( i == 5) { player.name = "Thrower dude"; player.position = 2; //THrower } } player.name = "Wing dude 2"; player.position = 3; //WING for ( int i = 0; i < 10; i++) { player = new Player(this,"xlay.png",(generator.nextInt(300)+700),generator.nextInt(768),2); player.makeHuman(); entities.add(player); player.name = "Lineman dude"; if ( i == 6) { player.name = "Wing dude"; player.position = 3; //WING } if ( i == 5) { player.name = "Thrower dude"; player.position = 2; //THrower } } player.name = "Wing dude 2"; player.position = 3; //WING
// container.setIgnoreRepaint(true); // panel.setIgnoreRepaint(true);
}
|
|
|
|
|
4
|
Game Development / Newbie & Debugging Questions / Re: Graphics flickering
|
on: 2010-01-06 00:47:21
|
|
Theres some of the code. Its based on coke and coke Space invaders tutorial. I couldnt post it all. Theres a 10000 character limit...
public class ThegameFrame extends Canvas implements MouseListener { /** The stragey that allows us to use accelerate page flipping */ private BufferStrategy strategy;
public ThegameFrame() { JFrame container = new JFrame("Death Match"); // get hold the content of the frame and set up the resolution of the game JPanel panel = (JPanel) container.getContentPane(); panel.setPreferredSize(new Dimension(1024,768)); panel.setLayout(null); // setup our canvas size and put it into the content of the frame setBounds(0,0,1024,768); panel.add(this); addMouseListener(this);
// finally make the window visible container.pack(); container.setResizable(false); container.setVisible(true); setIgnoreRepaint(true); container.setIgnoreRepaint(true); panel.setIgnoreRepaint(true); //Setting up Double Buffering createBufferStrategy(2); BufferStrategy strategy = getBufferStrategy(); // add a listener to respond to the user closing the window. If they // do we'd like to exit the game container.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
public void gameLoop() { long lastLoopTime = System.currentTimeMillis(); // long animtimer = System.currentTimeMillis(); // long delta = System.currentTimeMillis(); Random generator = new Random();
while (matchon) { // work out how long its been since the last update, this // will be used to calculate how far the entities should // move this loop long delta = System.currentTimeMillis() - lastLoopTime; lastLoopTime = System.currentTimeMillis(); if (strategy == null) { createBufferStrategy(2); strategy = getBufferStrategy(); }
// Get hold of a graphics context for the accelerated // surface and blank it out
Graphics g = null; g = strategy.getDrawGraphics(); g.setColor(Color.white); // g.fillRect(0,0,1024,768); g.fillRect(0,0,1024,200); g.fillRect(0,570,1024,198);
LOTS OF DRAWING AND COUNTING HERE
g.dispose(); // drawScreen(); if (!strategy.contentsLost()) { strategy.show(); Toolkit.getDefaultToolkit().sync(); }
// finally pause for a bit. Note: this should run us at about // 100 fps but on windows this might vary each loop due to // a bad implementation of timer try { Thread.sleep(10); } catch (Exception e) {} } }
|
|
|
|
|
5
|
Game Development / Newbie & Debugging Questions / Re: Graphics flickering
|
on: 2010-01-05 23:54:28
|
Huh, I searched for lots of tutorials about this and they only made it worse. I finally found this one which is almost the same as my original code. http://www.idevgames.com/forum/showthread.php?t=5301 near the bottom is an example code and it makes the text flicker like it did before, but the game runs fine. I tried other ways also, where i used Buffered offscreen image and it caused the game to slow down very dramatically. And it didnt even look like doublebuffered. The text was flickering but very slowly.
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Graphics flickering
|
on: 2010-01-05 02:05:37
|
|
Hello,
Im quite new to java programmming, but i made a dos tetris game about 10 years ago with c++ so i know some programming.
Im currently making my first javagame. It needs 2d graphics so im using graphics 2d. I understand it makes a doublebuffer but my graphics are still flickering.
I get no flickering on the graphics that are not moving. But moving my players on the field makes them flicker a bit. And if I try to use g.drawString(player.name,player.x,player.y); to show the players name under the player while he is moving, the text flickers like mad.
My game runs in windowed mode.
So, any ideas why my doublebuffered game graphics are flickering?
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|