Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Slow, choppy, shouldn't be  (Read 1038 times)
0 Members and 1 Guest are viewing this topic.
Offline Coinerson

Junior Member




Introducing the world's cutest zombie, Timmy


« Posted 2006-06-05 08:14:28 »

I am new here, not to programming or programming games, but here and programming games in java, which i enjoy.
Not exactly sure where to stick this so ill put it here.

K my game isnt that big, 2d and the graphics are simple, yet if i have more than 7 or so firebats (enemies that drop bombs) it becomes a slow nightmare. It stops collision detecting right, half thet ime i can walk through a hailstorm of the little balls of fire the bats drop and not hit a single one.

I am going to guess that the problem is that my update method handles too much, and i need to make more methods that the update delegates tasks too.

Check out the 4th level, that is the one where it shows how terrible the game is written. Its not that difficult, this is a computer that could render halo 1 max settings perfectly in the day, so really, i must be a bad coder...


http://rapidshare.de/files/22152393/Game.jar.html

As a sidenote you might want to just open the jar right away, and swap maps 4 and 1, so you can see what im talking about, since it is ridiculously hard, or so i am told by everyone who tested it.
Offline SmittyTheSmit

Senior Newbie





« Reply #1 - Posted 2006-06-06 12:30:31 »

why not webstart it ? Tongue
Offline Kova

Senior Member





« Reply #2 - Posted 2006-06-06 12:54:21 »

well I have played it and it wasn't choppy at all... but I have very strong pc (athlon64 3000+, radeon x800gto). Put in a fps counter so we can report resoults.
The difficulity was excellent, a nice challange, but if you're aiming for children make it easier a lot.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Coinerson

Junior Member




Introducing the world's cutest zombie, Timmy


« Reply #3 - Posted 2006-06-06 18:20:47 »

well I have played it and it wasn't choppy at all... but I have very strong pc (athlon64 3000+, radeon x800gto). Put in a fps counter so we can report resoults.
The difficulity was excellent, a nice challange, but if you're aiming for children make it easier a lot.

Yea i took it out a while back, ill put it back and see what i get, i stuck a println that counts the number of active sprites, and when i am getting massive lag it is only 16-17 critters in the map.getSprites linked list.

http://rapidshare.de/files/22370526/Game.jar.html

OK i am getting 30-50 FPS on the levels where collision detection goes out the window. when i played it i could not collide with enemies on level 4 or 5, but on level 5 the bats clump up even though they are moving at the same speed, they seem to teleport a little bit after each bomb they drop, i also made it log smack if you are hit. And when i jumped through the clump of 7 bats it didn't even get hit once.

Something in the updatePlaying method and it's series of collision detection methods is screwy.



Edit: i figured out the inviniciblity problem, if you have your shield on and switch levels, the shieldOn variable stays true between levels but the turnShieldOff method is called so it stops drawing, but you cant be killed.
As for the bats its running at 45 fps while they are jerking around. So it must be something in the bomb creating algorithm that makes them skip, since the same number of normal bats does not do that.


Edit Edit:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
Iterator i = map.getSprites();
        while (i.hasNext()) {
            Sprite sprite = (Sprite)i.next();
         if (sprite instanceof Critter)   {
            Critter critter = (Critter)sprite;
            if (critter.getVelocityX() == 0)   {
               critter.setVelocityX(critter.getMaxSpeed());
            }
            updateCritter(critter, elapsedTime, i);
            if ((critter instanceof BomberBat))   {
               BomberBat bomber = (BomberBat)critter;
               if (bomber.timeToDropBomb() == true)   {
                  Bomb bomb = new Bomb(resourceManager.getAnim(7));
                  bomb.setX(bomber.getX());
                  bomb.setY(bomber.getY());
                  map.addSprite(bomb);
                  i = map.getSprites();
                  bomber.dropedBomb();
               }
            }
         }



Now that i stare at this for the 1345th time, its seems that the first bat will get updated and if it drops a bomb, it will get updated again, since i am reseting my iterator. Is that the problem? How can i work around that?

Maybe later when I have time I will add a linked list of bombs to be added, and add them to the sprite list after all updating is over. So they dont get updated in the same frame as the bat drops them. Will that work?








YAY! I got it to work, i made a list of things to be added and added them at the end of the update method. Can i see some code that shows how other people handle adding and removing projectiles?
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

pw (11 views)
2014-07-24 01:59:36

Riven (10 views)
2014-07-23 21:16:32

Riven (11 views)
2014-07-23 21:07:15

Riven (12 views)
2014-07-23 20:56:16

ctomni231 (42 views)
2014-07-18 06:55:21

Zero Volt (38 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (34 views)
2014-07-16 23:30:00

Cero (49 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!