Jump to content

  • Log In with Google      Sign In   
  • Create Account

2d game lagging.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 zodaz   Members   -  Reputation: 104

Like
0Likes
Like

Posted 02 August 2014 - 11:05 AM

So, i'm making a 2d rpg tile scrolling game in java, everything went smooth until about a week ago. The rendering area in the game is based on the player coords, when the player moves, the rendering area moves. About a week ago everything "scrolled" perfectly smooth, but  now the scrolling "lags". The rendering area moves like 1 pixel back and forth very quickly for about 3 sec, then for 0.5 sec it's very smooth. I've searched my code for a week to try and find any rendering issues, but nothing found. Then i played realm of the mad god and i saw the exact same thing there(never been there before), is there something wrong with my computer?, what should i do?, has anyone else experienced this? My pc is not too slow, the game is running @ 4800fps.


Edited by zodaz, 02 August 2014 - 11:13 AM.


Sponsor:

#2 timgranstrom   Members   -  Reputation: 520

Like
2Likes
Like

Posted 02 August 2014 - 11:38 AM

Off the top of my head I would say it's not Java related in the sense that Java needs to be reinstalled, since rotmg is created in flash. I would probably try to reinstall the graphics drivers, maybe something went wrong during an update.

Edit:
If this doesn't work, maybe you should make sure that you are clearing the memory in the game so that you don't just continuously allocate more and more memory just because u aren't flushing/clearing ur graphics after each redraw or something like that.

Otherwise I think we need more information, when exactly did it start, what's the difference between the code when it worked and the week that didn't work etc. What did you add? Without this it's extremely difficult to give an accurate answer.

#3 zodaz   Members   -  Reputation: 104

Like
0Likes
Like

Posted 02 August 2014 - 12:03 PM

Off the top of my head I would say it's not Java related in the sense that Java needs to be reinstalled, since rotmg is created in flash. I would probably try to reinstall the graphics drivers, maybe something went wrong during an update.

Edit:
If this doesn't work, maybe you should make sure that you are clearing the memory in the game so that you don't just continuously allocate more and more memory just because u aren't flushing/clearing ur graphics after each redraw or something like that.

Otherwise I think we need more information, when exactly did it start, what's the difference between the code when it worked and the week that didn't work etc. What did you add? Without this it's extremely difficult to give an accurate answer.

Tried to reinstall drivers, didn't work, i'm clearing memory, and never seen any fps drops. It worked fine before i implemented online multiplayer i think, but i have backups from before that and they lag the same way now, so i don't think it's the code, none of my friends i tested multiplayer experienced any lag. So i think it's my computer, i've installed some random games lately, might try to remove some..

 

Edit: Didn't work.


Edited by zodaz, 02 August 2014 - 12:19 PM.


#4 timgranstrom   Members   -  Reputation: 520

Like
0Likes
Like

Posted 02 August 2014 - 12:19 PM

Alright, if no one else experiences it then it's definitely related to something local on us computer. Hope you find the culprit :)

#5 LAURENT*   Members   -  Reputation: 217

Like
0Likes
Like

Posted 03 August 2014 - 10:30 AM

Have you had any program running for a long time or use frequently?



#6 Glass_Knife   Moderators   -  Reputation: 4417

Like
2Likes
Like

Posted 03 August 2014 - 11:18 AM

1.  Figure out how to repeat the behavior.

2.  Use the jconsole utility that comes with the jdk to profile what is happening.

3.  Assume that it is your code, and not Java (this is really hard).


I think, therefore I am. I think? - "George Carlin"
Indie Game Programming

#7 pkash16   Members   -  Reputation: 127

Like
0Likes
Like

Posted 03 August 2014 - 01:44 PM

I know this is gonna sound dumb, but have you restarted your computer and cleared unnecessary start up programs? XD lol

 

Just my 2 cents. 



#8 aregee   Members   -  Reputation: 1022

Like
0Likes
Like

Posted 03 August 2014 - 02:02 PM

This sound to me like one of these times you did an obvious change somewhere in the code, a change that you thought wouldn't alter anything (but it did), and you left it untested because you thought you just made a cosmetic change.  Then maybe you wrote a bunch of new code, and then suddenly the game starts behaving in weird ways, and now you forgot exactly what changes you did...

 

I have done that myself a few times, swearing at not checking my code in to the SVC system more often than I do, since it would be trivial to do a DIFF to find exactly what changes I have actually done lately...

 

Sometimes I even play my code backwards to find out what exactly I have done (lots of undos - if I even have the change in the undo buffer), in desperation to see what changes I actually did.

 

Morale of the story is to use the SVC system as often as reasonable. (For every logical unit of change.)

 

Oh, and on the undo - game, make sure you make a full copy of your source before you do a massive undo, since even a touch of a wrong key will make you lose everything so you can't redo it again.  (Or even if the IDE crashes for some reason.)



#9 Avilius   Members   -  Reputation: 214

Like
0Likes
Like

Posted 04 August 2014 - 07:07 AM

This sound to me like one of these times you did an obvious change somewhere in the code, a change that you thought wouldn't alter anything (but it did), and you left it untested because you thought you just made a cosmetic change.  Then maybe you wrote a bunch of new code, and then suddenly the game starts behaving in weird ways, and now you forgot exactly what changes you did...

 

I have done that myself a few times, swearing at not checking my code in to the SVC system more often than I do, since it would be trivial to do a DIFF to find exactly what changes I have actually done lately...

 

Sometimes I even play my code backwards to find out what exactly I have done (lots of undos - if I even have the change in the undo buffer), in desperation to see what changes I actually did.

 

Morale of the story is to use the SVC system as often as reasonable. (For every logical unit of change.)

 

Oh, and on the undo - game, make sure you make a full copy of your source before you do a massive undo, since even a touch of a wrong key will make you lose everything so you can't redo it again.  (Or even if the IDE crashes for some reason.)

He has already stated that this happens with previous builds as well:

 


Tried to reinstall drivers, didn't work, i'm clearing memory, and never seen any fps drops. It worked fine before i implemented online multiplayer i think, but i have backups from before that and they lag the same way now, so i don't think it's the code, none of my friends i tested multiplayer experienced any lag. So i think it's my computer...



#10 Sporniket   Members   -  Reputation: 344

Like
2Likes
Like

Posted 07 August 2014 - 06:04 AM

I would start by tracing the coordinates of the rendered area vs the player coordinate, just to be sure that it behave as expected.

 

If the trace shows that coordinates changes smoothly, then there is a problem with the rendering. If not, then there is a problem in the scrolling code.


Space Zig-Zag, a casual game of skill for Android by Sporniket-Studio.com


#11 aregee   Members   -  Reputation: 1022

Like
0Likes
Like

Posted 07 August 2014 - 07:39 PM

He has already stated that this happens with previous builds as well:

 

 


Tried to reinstall drivers, didn't work, i'm clearing memory, and never seen any fps drops. It worked fine before i implemented online multiplayer i think, but i have backups from before that and they lag the same way now, so i don't think it's the code, none of my friends i tested multiplayer experienced any lag. So i think it's my computer...

 

 

Oh didn't notice that part.  Sorry.  Zodaz: Do you have any restore points from before you installed all those games you tried?






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS