• Content count

  • Joined

  • Last visited

  • Days Won


Kylotan last won the day on September 20

Kylotan had the most liked content!

Community Reputation

10008 Excellent


About Kylotan

  • Rank
    Moderator - Scripting Languages and Game Mods

Personal Information


  • Steam
  1. And learning extra languages is an effective way to understand how to do that better.
  2. C++ Player out of tile map

    Before this line: if (map[y][x] != "0,0") you need to check if x is within the map bounds. If not, skip that block.
  3. Making Breakout - Code Structure help requested

    Handle game specific input in Game->Update() if you like. You probably need to start a new thread if you have input-specific questions.
  4. I'm not a big fan of things being linear, because it can feel like I'm just clicking my way through a movie. Perhaps what I'd like to see are more interesting ideas of how writers and designers can work together to make it feel like I was able to take major choices and alter the course of the game, without needing to implement an expensive branching structure that demands a lot of developer time and resources.
  5. Making Breakout - Code Structure help requested

    The whole point is that you're saying "here is the image I want you to show, and I want you to show it when the graphics system is ready to display it with no tearing or other potential visual artifacts". The graphics system has to wait. You're right in saying that the CPU doesn't have to stop doing anything at that point, and that it can start getting on with the next frame. And that's usually exactly what happens. The interesting part is when that second frame is finished - has the graphics system finished that first frame yet? If not, we either have to wait for that first frame to be displayed before we can send the second, so eventually, the CPU does have to wait on the GPU. Most graphics APIs allow you to tweak this various ways - such as opting to discard and replace a queued frame instead of waiting for it to render, or using extra memory to queue up additional frames so that things are smoothed out if certain frames take much longer than others to be generated. But ultimately any synchronisation involves something waiting for something else. That's what you're asking for when you enable VSYNC. Regarding your actual problem, the thing that I see being wrong is that you're thinking about "when we actually execute the game state update", which is completely irrelevant. All that matters is "how many updates we should have done by now". Your interpolation function should not have the current time in it, because this interpolaton method is not designed to be a function you can call from arbitrary parts of the code. You should be storing the time at the start of the loop, running as many updates as you can to 'catch up' to that time without running any partial updates, and use that remainder - i.e. how much of a partial update you'd have to perform - to inform the rendering system to improve the smoothness of the rendering.
  6. Sure, it's not turtles all the way down. We layer higher level languages on lower level ones. But as computers get more powerful, we're able to write less in the bottom layers.
  7. Tons of commercial games are already being made in C#. If you're more focused on lower-level languages that can be direct replacements at the system programming level, then I'd say that since the demand for that is dropping, C and C++ are adequate. Maybe Rust/Go/Swift will be a worthy competitor in future, but I don't think there is enough critical mass.
  8. "If you have an "updatePhysics" method on your entity, how does it know about the other entities? It needs something else." - An entity can ask the world, or the physics manager, or some other interface of your choice, for a list of other physics entities. That's one extra object, the same as you'd need if you had a standalone System. Nobody is seriously suggesting that, for a complex physics based game, you'd have your complex physics in Entity::Update or Entity::UpdatePhysics. You'd have a PhysicsSystem that handles it. But that does not require that all your data lives outside of the Entity. Even if you did want your physics data outside the Entity - i.e. the way that most games do, with it tucked away inside PhysX or Havok - that's completely unrelated to how the entity itself is structured. You do not, and never did, require an 'ECS' in order for there to be additional systems that help with complex parts of your gameplay. Entities in old-fashioned systems were never expected to handle absolutely every part of behaviour that affects an entity. They have their own methods and data and they collaborate with other objects to get things done, just like pretty much all software does. The main problem is the constant use on these forums (not by you, but by a series of people) of strawman arguments to support following these entity/component patterns, suggesting that they solve problems that often don't exist, and often just by moving the problem anyway.
  9. What do you think about JAI

    C++ is also a replacement for C and it already exists. I don't think it's worthwhile looking at any language in a vacuum where other alternatives are ignored.
  10. That doesn't makes any sense. There is no reason why 2 actors containing physics data can't interact just as easily as 2 pieces of isolated physics data that live outside of the actor. It's not complex. Thousands of games have managed it. Sometimes the physics has been pushed out to a completely separate system but that has no bearing on how the rest of the entity is structured.
  11. Making Breakout - Code Structure help requested

    Vsync affects how long it takes to render. There is no way it can affect the timing of the main update code. I have no idea what those pictures are supposed to represent, but whatever you're measuring, it's wrong. The fact you're talking about a fixed update as if it's meant to happen every 40ms, or like it's a thing to be scheduled, implies you don't understand what the system is doing. Fixed updates do not occur every X milliseconds. They happen whenever they happen, but they represent X milliseconds. You need to perform as many of them as needed to 'catch up' to the current time, and the remainder is what makes up the interpolation or extrapolation value for extra rendering smoothness. Having vsync on does, by definition, imply that your rendering will take slightly longer, as it has to wait to synchronise the rendered frames with the update rate of the display hardware. This is not a bug, but a feature. Frame times will be larger on average, but usually much more regular. This may mean that you end up performing more fixed-step updates per rendering frame, as you have more time to make up between each one. Again, this is a feature, not a bug.
  12. What do you think about JAI

    Smart pointers and automatic memory management in general. I think C and C++ are pretty much the only major languages that force manual memory management on the user. Even Rust, which has the user manually allocate memory, can still automatically free it for you. Exceptions are another. Return codes are not ideal. And polymorphism. It's not entirely clear to me whether Jai has polymorphism since the writing on it is unclear, and one example seems to rebrand function overloading as polymorphism, but object polymorphism is a useful tool that most game developers use in some way. I also can't find out if there's any sane way of handling Unicode, or whether there's a useful standard library included. It's difficult to talk very meaningfully about the language when most of the information is locked up in very long videos.
  13. What do you think about JAI

    Unfortunately it's lacking a lot of stuff which most programmers want. It's fascinating that one of the statements in the Jai Primer is "Automatic memory management is a non-starter for game programmers who need direct control over their memory layouts" when it's increasingly clear that game programmers are demanding that level of control less and less often. Unreal and Unity are garbage collected! I'm sure Jonathan will be very productive with it, and it has many good aspects, but I don't see it ever seeing serious use by more than a double-digit number of developers.
  14. Making Breakout - Code Structure help requested

    Wow, I leave a thread for a few hours and it goes well off the rails. I think Unity is the only game engine I've seen that has separate FixedUpdate and Update functions. Unreal likes to just have a single Tick. And not every engine uses explicit Updates - sometimes they expect you to register a callback on a timer, which gives you more control over your updates. Since low level stuff such as physics and animation is usually being handled separately (probably with fixed timesteps), this makes a lot of sense. Marcus, you're still insisting that Vsync is messing up the interpolation value, and I think I told you right back on page 1, twice, that it's not. You're just measuring it incorrectly, at the wrong time. The only time that interpolation value needs to be calculated is immediately after the fixed update loop ends, and that tells you how the next render call needs to be adjusted. It doesn't make sense to calculate it again after the rendering because obviously more time will have passed. That will be taken into account on the next loop iteration.