Tag Info

Hot answers tagged

2

As others have said, the first step is separating logic that's shared from logic that's not. While it's great to draw that line wherever it's clear, your addendum illustrates that sometimes you don't have a clean line to split the code down. So, how do we solve cases where the client and server want to do semantically the same thing (play a sound), but take ...


2

Extract any shared code to a library which you maintain separately. Then implement your client and server as a separate applications which implement anything specific themselves and reference the library for any shared functionality.


2

You're wasting CPU cycles. That means lower battery time on notebooks, tablets and phones, higher electricity bills, more heat generated by the machine, noisier fans. Also, you may be eating cycles from other important system processes (e.g. the window server could become jerky), which could then affect gameplay. Some system schedulers on today's pre-emptive ...


1

Your map[][] is static so the three objects (layers) will access the same map (and overwrite it). You should make it nonstatic to allow each object to have it's own. Secondly the fileParser() method is private so you will have to either make it public or call it inside the class.


1

It looks like you are first rendering the buffered image with bilinear interpolation and the result is later stretched with nearest neighbor filtering. It's hard to say without seeing the rest of the rendering code. When I copied your code and used it to fill the background of a JFrame, I got either large solid color quads or fully smooth image depending ...


1

Most likely it is antialiasing the image, in an attempt to avoid looking pixelated. If you have a Graphics2D called g2, then you can modify the settings: g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); The abstract Graphics class does not have this method, but the Graphics object you have ...



Only top voted, non community-wiki answers of a minimum length are eligible