Advertisement Jump to content
  • Advertisement

Leaderboard


Popular Content

Showing content with the highest reputation since 12/16/18 in all areas

  1. 4 points
    Or it can be running in a different thread. The audio often has multiple tiles to this audio buffer, and you fill one or several as they become free, perhaps in a callback. If you don't fill them on time you might get audio glitches as the audio plays tiles that contain old data. The size and number of tiles can affect the audio latency (the gap between playing a sound and hearing it). With a small buffer you can get small latency but you need to ensure it is filled 'on time'. With a larger buffer there is less need to keep it filled in a timely fashion. If the audio is running on a different thread, the effect of frame rate may be rather to affect the 'granularity' of sound effects playing in the game, unless the audio wrapper and system specifically compensates for this. Typically a game might issue a command like PlaySound(GUNSHOT) .. if it is running at 1fps, a bunch of these may be issued at the same time rather than spread out over the second. More likely to be the other way around if anything. If you can query your audio how far through it is, you know how far to advance your game. However with an accurate general timer this is less likely to be an issue, as most games are designed to be frame rate independent, i.e. they use their general timer to know how far to advance the game. The longer the audio the more the possibility of drift between general purpose timer and audio player rate, and afaik different sample players are not exact. This is more likely to be an issue in audio / music apps than in games though. Also note that you could in theory change the rate that audio plays, but this normally gives a change in pitch, which might be noticeable, especially with a varying frame rate. You can also do time stretching on audio, to shift the play rate without changing pitch, but that would probably be a very messy solution to this particular problem.
  2. 3 points
    This is completely wrong. In Java, only the native types (boolean, int, and float like types, written all lower case) have enough internal storage to store their value. Everything else, including boxed types like Integer are objects. Object variables do not contain object data, they are references to heap-allocated memory. In C++ you'd call them pointers. Every 'new' creates a new object of the given type. In other words, each "new Monster();" makes a new fresh object. Java has automatic garbage collection. it removes objects that cannot be longer accessed. You can access an object if there exists a variable that references the object. after "monster = new Monster();" the "monster" variable references the Monster object, so it will not be removed. Variables also exist in objects, This system thus extends to object variables in objects as well. If you have a "Room room" variable in your Monster (the room it currently is), then that room will not be removed, since the Monster object refers to it, and the Monster object is not removable too (since "monster" refers to it.) So what you want is somewhat already possible. If you write "monster = new Monster()", the 'monster' variable now refers to the new Monster object. It does no refer to the previous Monster oibject any more. If no other variable in your program refers to the old Monster object with that assignment (ie "monster" was the last variable refering to the old Monster), the old Monster object will be removed from the program. You cannot forcibly de-allocate an object in Java. Imagine what would happen: // 1 object Monster, and 2 variables both refering to the same object. Monster monster = new Monster(); Monster monster2 = monster; deallocate monster; // Say we could de-allocate // The Monster object is now gone, what would monster2 refer to now? // Garbage? Note that you can also remove the Monster object reference from the monster variable by a simple "monster = null;" assignment. "null" points to no object at all, and thus also not to the Monster object. This is not often needed though. Normally, you either assign a new object, or you drop the variable from the scope (ie you cannot access the variable itself any more), for example by leaving the function that had the (local) monster variable in it. I agree with others that garbage collection is a non-issue in a text-based game, so just don't worry about it at all. If you want to re-use the Monster object, you "new" it once at the start of the program, and then for each next monster, you re-initialize the object, like "monster,restart();". Note that in this way the game always has a monster object, so if the player can kill it, you need some sort of inactive or 'dead' state for the monster for the time between the kill and the respawn.
  3. 3 points
    Audio has its own frame rate of usually around up to around 48000 FPS If your game is running at 60Hz, that means that there's about 800 "audio frames" per "visual frame". To deal with this, your audio library will create a buffer to pre-compute at least 800 "audio frames" ahead of time, to make sure it's always got data ready to stream out to the speakers/etc... To be safe, it might buffer a lot more than this - maybe even buffering up to 5000 "audio frames" ahead of time just to make sure that the speakers always have data ready to go without any gaps in playback. If your game runs at a slower framerate, your "audio buffer" just needs to be longer. As above, if audio is at 48kHz and the game at 60Hz, then the buffer needs to be at least 800 audio samples in length. If the game is running at 30Hz, the audio buffer needs to be at least 1600 audio samples in length. In practice, most game audio products will just use some conservative buffer length like 5000 samples by default to be safe.
  4. 2 points
    Part of it may be the file size. When you upload these the server starts background processing those files (stripping EXIF, managing compression, creating thumbnails and other scaled sizes, etc.). When it happened yesterday I noticed a lot of processing causing the 502, but I didn't know the cause until putting it together that large gifs/videos were being uploaded. So yeah, looks like there's a bottleneck in the system there that needs to be worked out.
  5. 2 points
    Sorry, ting lim. We do not permit homework help here. Talk with your fellow students and your professor. Good luck!
  6. 1 point
    I'm using java not c++ so I don't think I can use any libraries? I'm keeping the mesh data stored client side, but I'm using drawarrays not drawelements (I always had trouble with texturing with draw elements). I guess I could grab the face index list when I'm parsing the obj, though. But if the point in polygon test doesnt need them I'll try that first. I'm curious how it works. Of course a navmesh sounds really cool now. I'll attempt it in the next couple days and keep checking and rereading. So thanks again!
  7. 1 point
    How big is the lake, do you keep the whole thing loaded at once? Is the edge represented as a mesh or a texture? Do you need to accurately follow triangles in the mesh, or could you use bilinear control points to define the edge? Do you want to reflect, bounce or collide n slide, or something more complicated like get some air or crash? How much do you like maths?
  8. 1 point
    Hi everyone. First time here, not sure I have this post in the right thread, so forgive me if I do not. I write in several languages, depends on needs and mood LOL, Currently I've been visiting my DOS DAYS of gaming and wrote a few quick ones. Currently working on a text adventure. Like those of old days (Get key, open box etc...part of the fun was figuring out two word combos), but with modern story line and mechanics. So am curious where could I find the right type of gamer that likes these types of game to test it. The story line is weak as it is just a rough draft while I complete it both the engine and the game. What I would be looking for is the interaction part. Do the rooms link up right, do the puzzles make sense, do they even fit with the story line etc... There will be tyupos in the story (did you catch that LOL ). Once the game can be played in its entirety, I will go back and flesh out the story better. So if anyone is interest.. let me know. The release will be far apart, as I am working on a few other projects as well, not to mention I take care of several properties and that keeps me busy, The story is called "The Apartment", and is a haunted thriller about a girl (who you play) that got stuck in this abandon apartment while jogging to escape a freak storm, only to find herself stuck there. Find your way out, and what coincident pulled you there (wooooooooo...). Since I am a huge gamer (600+ games in steam alone), I pulled several mechanics and story lines from some of the best games and made a new one. I think it works (even nabbed on idea from a great movie). thanks again if you read this far..
  9. 1 point
    At first: Try to use glGetShaderInfoLog function after shader linking code and glGetError for error detection. Second: Your "every frame code" is so bad. Sorry. FOR loop 3 times with same logic in render method (int i = 0; i < 4; i++) it's not cool. In my mind you need to set glVertexAttribPointer firstly and then glEnableVertexAttribArray. Third: Did you understand how glBufferData method working? Are you sure that buffer.size() returned good value? P.S. Sorry for my english. I hope you will succeed I do most of this things one time in initialize method and just when buffers have changes: public void Initialize(BufferUsageHint bufferUsageHint = BufferUsageHint.StaticDraw) { VBO_ID = GL.GenBuffer(); VAO_ID = GL.GenVertexArray(); EBO_ID = GL.GenBuffer(); GL.BindVertexArray(VAO_ID); GL.BindBuffer(BufferTarget.ArrayBuffer, VBO_ID); GL.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * DrawVertices.Length, DrawVertices, bufferUsageHint); // Coords attribute GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, sizeof(float) * 8, 0); GL.EnableVertexAttribArray(0); // Textures attribute GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, sizeof(float) * 8, sizeof(float) * 3); GL.EnableVertexAttribArray(1); // Normals attribute GL.VertexAttribPointer(2, 3, VertexAttribPointerType.Float, false, sizeof(float) * 8, sizeof(float) * 5); GL.EnableVertexAttribArray(2); // Indices buffer GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBO_ID); GL.BufferData(BufferTarget.ElementArrayBuffer, sizeof(int) * Indices.Length, Indices, bufferUsageHint); } And my draw method looks like this: public void Draw(ShaderProgram shaderProgram, BeginMode beginMode = BeginMode.Triangles) { // SHADER SET UNIFORMS... GL.BindVertexArray(VAO_ID); GL.DrawElements(beginMode, Indices.Length, DrawElementsType.UnsignedInt, 0); GL.BindVertexArray(0); }
  10. 1 point
    No problem, I would highly recommend Brackey's channel, which will take you to a pretty good level of understanding of the engine. For more advanced tutorials you can have a look at Sebastian Lague's videos. Both links below. https://www.youtube.com/channel/UCYbK_tjZ2OrIZFBvU6CCMiA https://www.youtube.com/channel/UCmtyQOKKmrMVaKuRXz02jbQ
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!