Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 07 Jun 2012
Offline Last Active Feb 24 2015 01:27 AM

Topics I've Started

Subtraction Problem in Java

22 February 2015 - 09:10 PM

Why is System.out.println(1.4-1) producing "0.3999999999999999" as the difference in Java?


In Math, 1.4 - 1 is 0.4.


Would this be considered duplicate code?

22 January 2015 - 09:49 PM

From what I can gathered about duplicate code, it is if the list of code that occurs more than once. Okay, based on what context? Is a duplicate code based on the similar appearance of the code?


In the below case, I have a character state animation driven by key press events and enum that hold states or behavior denoted by constants.


The reason is the first and second code are the similar in appearance and in functionality but they used different state and key presses to execute this functionality of the game character.


if(direction == Direction.RIGHT && state == ActionState.RUNNING)
state = ActionState.IDLE;
if(direction == Direction.LEFT && state == ActionState.RUNNING)
state = ActionState.IDLE;

About computer instruction in relation to RAM consumption

10 January 2015 - 12:05 PM

1) Why does a program(i.e. Internet Browser) gets loaded into the RAM(I think it is called lv1 cache from the CPU correct me if I am wrong) from hard disk? Why not just access it from the hard disk since that is where the program originated from after installation?


2) Does a computer instruction that takes longer to execute use more RAM?


3) If an instruction needs to create a stack frame does it use RAM and when the stack frame gets popped off, is that when RAM gets released?


4) Since RAM does not seem to be an issue (I assume even people with a tight budget use Windows 7 or a Mac, why is there a need to optimize a function when there is a bottleneck?


5) Are all bottlenecks linked to consuming too much RAM or is it much more than that? I have not experienced a bottleneck (maybe it is because I never used a profiler before or maybe I just know how to write computer instruction that supposedly used less RAM? if that makes any sense)


6) To access the data in RAM, the processor takes a nanosecond scale. Meanwhile, to access the data on the HDD, the time taken in milliseconds scale. I'm confused I thought millisecond or 0.001 was MORE than nanosecond or 0.000000001. Shouldn't accessing RAM take less time than accessing from HDD? Here is the source: http://new-ones.blogspot.com/2012/08/ram-function-for-performance-pc-and.html 


7) How much CPU usage should a video game generally used up? I programmed a 2D RPG game and it uses up 15-17% CPU usage and 100 MB of RAM based on the data I am seeing from my Macbook Air's Activity Monitor.


Edit: I hate anonymous down votes...I just want to learn on a deep level

Should I learn C before learning Objective C

07 January 2015 - 03:39 PM

I read Objective C was built on the C programming language. So my initial thought was maybe I should learn C first before learning Objective C so I don't wind up shooting myself in the foot. Or worse, blow my whole leg off using the language.


Originally i tried learning game programming in Swift(thinking I can handle it since I made games using Java). But this does not seem to be the case. There is so much mental overhead and quirks in terms of how the code is presented. It is vastly different from Java.


On a side note, does learning C making C++ more understandable?





Real-time games move very small amounts of data in milliseconds? Really?

07 January 2015 - 03:26 PM

Charlie Hauser at Riot Games states "Real-time games move very small amounts of data in milliseconds".


My take: I thought real time games had to update a lot of data in that short amount of time. Every user running the client needs their moving character to be updated(their position, their animation frame, animation texture changes ) same applies to their character projectiles, game logic etc.


Seems like a whole lot of data being passed through the traffic on their network, right?


On a side note: what makes Youtube and Netflix a buffered application?