Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2005
Offline Last Active Today, 03:28 PM

#5293143 Confused About Frames Per Second

Posted by frob on Yesterday, 09:22 PM

It is often a little confusing to people who haven't worked on modern games.


Many games have simulators that operate in the future as far as the human is concerned.  


The simulator advances time occasionally as needed, usually thinking about the near future. The display shows somewhere in the past on the timeline at an approximate location between the previous simulated location and the approximated future simulation. User input generally gets inserted into the game simulation, in many modern games the simulation rewinds time a little, inserts the commands back where the player expects, then replays the future with the new input.


Although it sounds rather complex, in practice it means a few hundred kilobytes or possibly a couple megabytes of data gets kept around between simulation steps, and rendering gets a tad more work.

#5293094 Confused About Frames Per Second

Posted by frob on Yesterday, 12:38 PM

You're right, I did actually modify it so that the render call only happens when it runs an update of the game state, because why render if nothing has changed?
I'm not sure what you mean by tweening though.

Assuming animation is happening, you still need to render when nothing has changed because something HAS changed.
Tweening is an old animation term, drawing the frames in between key frames.  It applies here because something HAS changed.
That something is time.
If you reread the "Fix Your Timestep" article, you'll see this near the bottom:


What this means is that we’re displaying the state of the physics simulation at a time value slightly different from the render time. This causes a subtle but visually unpleasant stuttering of the physics simulation

The solution is to draw as though you were pat of the way through.  
Imagine you have simulation time steps simulated at simulator time step 2973 and 2986, and your rendering is taking place at simulator time step 2976. That means you don't draw 2973 because that is too far in the past, and you don't draw 2986, that is too far in the future.  You draw 23% of the distance between the past and the present.  If your next render takes place at simulator time step 2985 you still don't need to update the simulation, but you draw at 92% of the distance between the past and the present.
Decoupling your rendering step from your simulation step is part of the solution.  Once it is decoupled so you are no longer simulating every frame, generally you need a somewhat more difficult step of triggering the rendering interpolating between two simulator steps.

#5292958 Confused About Frames Per Second

Posted by frob on 22 May 2016 - 06:27 PM

> What I don't understand is, if most games run at 60FPS, why does mine feel so off? It seems like it should still run smoothly either way,


Not all frames-per-seconds are equal.


Create another trio of timers, updated every second:


Min ms / Avg ms / Max ms


That is, the fastest frame time in milliseconds, the shortest frame time in milliseconds, and the average frame time.


60FPS means 16.6 milliseconds per frame, but with those three numbers you can see quite a lot more.


60FPS can give 16.4 / 16.6 / 16.6

60FPS can give 12.8 / 16.6 / 38.3

60FPS can give 1.4 / 16.6 / 143.8


All are at 60 frames per second. The first is rock solid.  The second has at least one small hiccup, a frame taking 2 frames worth of time and others making up for it.  The last one, however, indicates some fairly erratic behavior is going on.



Even better, have several sets of timers.  One for the full time including the page swap, another one for just your render time.  And perhaps another for your simulation times. And perhaps another for your physics times.  You'll probably want those timers in microseconds or even nanoseconds rather than milliseconds.


Before long, you'll have enough profiling data that you can start to make informed decisions about the performance of your game.

#5292899 APP with GPS and GOOGLE MAPS

Posted by frob on 22 May 2016 - 12:34 PM

> Could I make the app with java?


If you want.


> Should I use Android?


If you want.


> which API can you recommend me for the GPS and the interfaces


If you are developing for Android devices, probably android.location.*

#5292897 Terrain Rendering

Posted by frob on 22 May 2016 - 12:26 PM

Terrain clipmaps doing LOD on GPU terrains from GPU Gems 2 book


Much more complex terrain generated by GPU from GPU Gems 3 book


There are many more articles and examples and videos and tutorials on it, and those articles are a little dated, but they should serve as a good launching point for learning.

#5292796 Terrain Rendering

Posted by frob on 21 May 2016 - 05:35 PM

Terrain via heightmap textures was one of the first big uses of programmable GPUs.


Incidentally, it also destroyed my masters thesis work where I was working on continuous level of detail for terrain at the time. People in my lab said "You need to see this announcement." It was a press release for the GeForce 3, and the demo video was about 100 square miles worth of terrain being processed with newfangled "shaders".  


With a single shader and a heightmap, the card does all the work to display all the ground geometry for an enormous area. No terrain mesh needed, just the height map that the shader uses to figure out all the heights.  You still need to throw on textures and modeled objects, but those are not that difficult.

#5292722 how much PC do you need to build a given game?

Posted by frob on 20 May 2016 - 09:06 PM

Right now, any standard commodity PC is powerful enough for building a modern game.


A typical off-the-shelf machine is more than enough for any hobby game an individual can build.


You may not be able to reach some of the highest-end, most cutting-edge features, but you aren't making that type of game without a multi-million-dollar budget anyway.

#5292721 can a generic engine do something like skyrim?

Posted by frob on 20 May 2016 - 09:03 PM

Unreal and Unity out of the box could come close enough for hobby work, where you also are not going to do as much world processing.


You would need lots of assets, lots of custom shaders, lots of programming work.  Performance-wise such a system would struggle on a brand new machine. You could not reach the raw performance numbers without modifying the engine's source and fixing up a few things. Both engines are fairly poor at multiprocessing out of the box, and neither is designed to take advantage of the most modern video cards like Skyrim does, but the engine can be modified easily enough.  


It would still need a couple thousand development-years of effort, and a 9-digit dollar cost.


If you're paying hundreds of millions of dollars for people's salary, paying five or possibly six figures for engine source is cheap, then you can fine-tune as you see fit.

#5292515 How should I organize Java Classes?

Posted by frob on 19 May 2016 - 10:48 AM

> Often you'll find you have a class that wants or sometimes needs to do multiple things, and you won't know what to name it to reflect that. 



Single Responsibility Principle helps with that. When it does more than one thing, make more than one thing.


You still have the struggle of naming the things. "Manager" is a banned object name at my present and my most recent past employer, partly at my recommendation. 

#5292504 Process of audio dev for games in 80's-90's?

Posted by frob on 19 May 2016 - 09:47 AM

> So from what I understand, on those consoles, they had to "code" the music/sound while programming the game, typing in certain codes to make certain sound.
True, but you still have to do that today. You type in codes, they get compiled, built into software, it sends data to audio hardware, and headphones/speakers make noise.
In the oldest systems, those dating in the 1970s, typically there was so little processing power that the notes were given to the programmer (or the programmer came up with the notes themselves) and needed to figure out exactly where there were CPU cycles to insert the tone generation commands.
But anything after the 1970s, and on the three systems listed (NES, Sega Genesis, SNES) there were standardized audio formats that they could play and had relatively sophisticated audio chips for their era.
>  I heard even in those days, actual instruments were involved in the development, mainly synth keyboards.
Yes. MIDI has been around since 1983, and before that there were vendor-specific keyboard interfaces. 
> did they just have composers make music with those instruments then record them (Tapes or on computers?) and hand them to whoever was writing the game's code for them to listen to it so they could translate it step by step, matching the notes played in the recorded music into the best batching sound making code lines the console could do? Or did they somehow connect their keyboards to a workstation computer to map the keyboard keys to play different sounds from certain console codes on the computer?
Even back in the 1970s there was music editing software.
It was quite common for musicians to have music keyboards plugged in to their computer, it was also common for people to enter music into the software directly with number codes.  Even back on my 286 there was a port where I attached a music keyboard, and games that used MIDI would play the music through the keyboard when it was attached.  Most people didn't have synth keyboards, but if you had one you could certainly use it.
MIDI files are typical of the '70s and '80s audio style. The audio can have a definition of what instruments exist, sets the tempo, and plays notes based on timestamps along the interval. Beyond just the key that was hit there is information for how hard the key was pressed, the duration of the note, and certain effects to use.  In earlier formats the instrument definitions were left off, leaving you to whatever instrument definitions were part of your hardware's tone generation.
Usually the data was good but the tone generators on early sound chips was terrible. Back then many chips had tone generators that were flat tones or badly-sampled approximations of real instruments. You could buy them with beautiful instrument banks, but they were more expensive than most people wanted to buy.  Even back then there was a night-and-day difference between what my computer generated on its own and what was generated by my music keyboard even though both processed the same MIDI stream. Today you can replay the old well-written MIDI music and instead of sounding like beeps and boops from those familiar with the 1980's sound banks, the modern chips have beautifully sampled instruments recorded from actual masterwork instruments, so the built-in MIDI player can sound like a real symphonic band or orchestra.
Another style of music was similar and popular in the late 1980s to mid 1990s.  Rather than relying on hardware banks for sound generation, they would provide their own samples. MOD, STM, S3M, and similar formats were quite common. They took more processing power because they were manually mixing all the parts, but they tended to sound nicer than the MIDI hardware most people owned.
> It must of been hard if they had to translate the music's notes step by step, were they able to write their own software to help convert the music?
Yes, software existed.
> I'm also wondering if the case was any different on Genesis, or other consoles with FM chips. Was it possible to use any of those FM synths like Yamaha keyboards from the 80's to compose straight to the Genesis's sound chip since they were both FM based, or would that composed FM music still need to be translated indifferently?
The composer may have used the synth keyboard for data entry, but they would (and still do) edit the results before passing it along.

#5292499 Understanding Peer 2 Peer

Posted by frob on 19 May 2016 - 09:13 AM

> dos/ddosing that user. 


Yes, it is possible.  A centralized star architecture where players only know the address of the server does not necessarily expose the addresses of other players.


Attacks are possible from anyone on the public Internet, so that is nothing new.  Anybody can attempt a denial of service attack on any IP address.


>  Player B sniffed Player A's IP address and then connected to them and just starting to send movement signals all over the place. (Without even being in a game).


Not likely.  Each connection is a 4-tuple of {source IP, source port, dest IP, dest port}. For connection-based systems when the game ends the connection will end too. Establishing a new connection will require a new handshake which you don't have.  Your own game is going to have its own protocol and rules to follow, so being outside the game and influencing the game is not something they can do unless you build that in to your protocol.


It is possible for someone to introduce their own proxy and play the game through the proxy, then maliciously introduce additional commands while they are in the game.  That is a standard attack vector. The solution there is to never trust anything coming over the wire, always validate all input, no exceptions.


> (P2P = Hacking/Cheating/abuse is inevitable), 100%?


There are attack vectors in all networked software. When the software is popular enough someone will want to attack it.  


Defending against all possible attacks is not really possible.  Figure out what the most realistic attacks are against your system. Then either design your system so the attacks do nothing, or write code that defends against those attacks. Don't worry about the rest.

#5292488 What is the top factor for MMO engines limiting world size?

Posted by frob on 19 May 2016 - 08:19 AM

So MMO, around 200,000 to 500,000 players. The difficulty there remains one of content. The world-limiting size is still the limits of creating compelling content.

You stick 500,000 active players inside a 10 square mile area and your population is so dense you can hardly move. A density of 50,000 per square mile, or about 20,000 per square kilomter, gets you at about the top 30 most dense places in the world in real life.  It would be so crowded you could hardly move.

You stick 500,000 active players inside a 20 square mile area, and on the same list it drops you to a population density similar to New York City.  Dense enough there is always interesting stuff going on, but still a little crowded for a video game.
The same 500,000 active players inside a 30 square mile area, now you're looking at a population density similar to most comfortably livable larger cities around the world. About 15K per square mile, or about 6000 per square kilometer. 
Few MMOs hit a half million active players at once.  And they don't do it by offering completely novel areas for every player.  
Even in the large games you replay the same quests each with slight variations to them, in the same areas you have walked time and again. Often the areas are blocked off; this quest uses zones 1,2,3,6,7, that quest uses zones 2,3,5,7,9, the other quest uses zones 1,2,4,5,8, but still heavy on the reuse.
When people start talking about Earth-sized worlds, 200 million square miles, and are talking of a few thousand concurrent players in the world, that's on the order of one person per 200,000 miles.  You might potentially interact with another human at some point in the game, but it is not enough for teams and cities and guilds and such.
If you've only got a few thousand concurrent players (four digits) then you need to focus on a small amount of quality content. 1000 people is not enough even for a small real-world town. If you create a bigger world, a world size of 20 square miles for those 1000 people, about 50 per square mile or 20 per square kilometer, and you barely have enough people that they can greet each other in towns, let alone naturally form groups to run quests and guilds and adventures together.




Bringing it back, it is really hard to have worlds that are bigger than that.  You can procedurally generate them but it is hard to fill them with interesting stuff. Even if you manage it, you need an enormous number of players to keep the cities vibrant. Without the players, the cities are empty ghost towns full of idle content, as much of WoW is today.

#5292417 Need mentorship from a veteran programmer

Posted by frob on 19 May 2016 - 12:23 AM

I talked to some HR people from PlayStation at GDC. They did tell me they use automated resume scanners.


The use of resume scanners does not mean the a big ugly block of keywords is the right solution.  Use the names if you, want but put them with the projects.


While the really huge companies like Sony do use resume scanners, they also employ real live humans to look at job applications.  And if you are smart and work your social network, you'll be getting your resume transferred by friends and friends-of-friends and friends-of-friends-of-friends, who will give the resume directly to the team lead because the team lead hates the automated system as much as you do.  (Working your social network is about 10 times more effective than applying to big corporate recruiting systems. That is, one hour finding friends-of-friends is worth about 10 hours of applying to the company's career site. You'll want to do both, but if you can do both for one hour, one is far better than the other.)


Even when companies do use resume scanners rather than actual humans for the first pass, for the second pass real humans are involved.  Real humans see the line "C and C++ (Proficient)" and realize it is trash. Proficient in what way? Compared to whom? Proficient compared to other students who can barely program? Proficient compared to industry veterans who were working with C++ since the '80s and have followed every major revision of the language?  You need to give context to say where you actually used it.


As it is, you've got big ugly blocks with no context. They only satisfy buzzwords, they do not communicate your level of competence nor experience:  "Rapid prototyping, Agile development, Debugging, Porting & Integration, C and C++ (Proficient), C# (Proficient), Java, Python (Prior Experience), Visual Studio, Eclipse, Subversion, Git, HTML5, Javascript, ..."


You can include those same keywords in your descriptions.  "Developed a rapid prototype in Unity and C# for initial pitch over two weeks which was successfully approved. Followed agile processes for the remaining 8 months, using Unreal Engine 4 and C++ for most development. ..."


That satisfies both the robot overlord scanners and the real humans who will eventually look at them.

#5292355 What is the top factor for MMO engines limiting world size?

Posted by frob on 18 May 2016 - 04:09 PM

There have been write-ups of world sizes.


WoW is currently on the order of 60 square miles of actual content. Most of the older areas are vacant ghost-towns, content that is no longer played even though they have millions of people.


Skyrim and Dragon Age: Inquisition are both on the order of 20 square miles of actual content.


GTA 5 covered about 100 square miles, but the vast majority of it was fake/duplicate buildings. It was probably around 2-3 square miles of actual modeled stuff plus about 10 miles of modeled roadway segments.


Filling virtual worlds with compelling content is hard.  Filling them up with generic formulaic terrain isn't that difficult and has been done many times, but typically doesn't make for good RPG material.

#5292353 How should I organize Java Classes?

Posted by frob on 18 May 2016 - 04:03 PM

While you are still learning and a beginner, order them in any way that makes sense to you.


Big code bases tend to subdivide code by broad feature areas (simulation, world, physics, assets, math, rendering, network, etc) then subdivide again, sometimes multiple additional layers, by functionality other criteria. 


The exact details are unique to every project. Naming things is a hard problem in computer science.