Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. reepblue

    Turbo Engine 2D Redux

    So, what about the 3D sprites? What would they be called? Billboards? Overall, this seems much more easier to understand. With SVGs, we can now have round HUD elements without fears of rasterization!
  3. Today
  4. You did link it in at least one other blog.
  5. For some reason this blog has three times as many views as most of my other articles.
  6. Previously, we saw how the new renderer can combine multiple cameras and even multiple worlds in a single render to combine 3D and 2D graphics. During the process of implementing Z-sorting for multiple layers of transparency, I found that Vulkan does in fact respect rasterization order. That is, objects are in fact drawn in the same order you provide draw calls to a command buffer. Furthermore, individual primitives (polygons) are also rendered in the order they are stored in the indice buffer: Now if you were making a 2D game with 1000 zombie sprites onscreen you would undoubtedly want to use 3D-in-2D rendering with an orthographic camera. Batching and depth discard would give you much faster performance when the number of objects goes up. However, the 2D aspect of most games is relatively simple, with only a dozen or so 2D sprites making up the user interface. Given that 2D graphics are not normally going to be much of a bottleneck, and that the biggest performance savings we have achieved was in making text a static object, I decided to rework the 2D rendering system into something that was a little simpler to use. Sprites are no longer a 3D entity, but are a new type of pure 2D object. They act in a similar way as entities with position, rotation, and scale commands, but they only use 2D coordinates: //Create a sprite auto sprite = CreateSprite(world,100,100); //Make blue sprite->SetColor(0,0,1); //Position in upper-left corner of screen sprite->SetPosition(10,10) Sprites have a handle you can set. By default this is in the upper-left corner of the sprite, but you can change it to recenter them. Sprites can also be rotated around the Z axis: //Center the handle sprite->SetHandle(0.5,0.5); //Rotation around center sprite->SetRotation(45); SVG vector images are great for 2D drawing and GUIs because they can scale for different display resolutions. We support these as well, with an optional scale value the image can be rasterized at. auto sprite = LoadSprite(world, "tiger.svg", 0, 2.0); Text is now just another type of sprite: auto text = CreateSprite(world, font, L"Hello, how are you today?\nI am fine.", 72, TEXT_LEFT); These sprites are all displayed within the same world as the 3D rendering, so unlike what I previously wrote about... You do not have to create extra cameras or worlds just to draw 2D graphics. (If you are doing something advanced then the multi-camera method I previously described is a good option, but you have to have very demanding needs for it to make a difference.) Regular old screen coordinates you are used to will be used (coordinate [0,0] is top-left). By default sprites will be drawn in the order they are created. However, I definitely see a need for additional control here and I am open to ideas. Should there be a sprite order value, a MoveToFront() method, or a system of different layers? I'm not sure yet. I'm also not sure how per-camera sprites will be controlled. At this time sprites are stored in a per-world list, but we will want some 2D elements to only appear on some cameras. I am not sure yet how this will be controlled. I am going to try to get an update out soon with these features so you can try them out yourself.
  7. I am working something out that is a little bit more conventional, but retains some of the properties discussed here. Stay tuned...
  8. Yesterday
  9. Confirmed: https://www.khronos.org/registry/vulkan/specs/1.1/html/chap24.html#primrast-order
  10. During implementing of Z-sorting for transparency, I found that Vulkan might actually preserve the rasterization order in render passes, which gives me reason to rethink this. Cameras in Turbo Engine always calculate and send an orthographic matrix to the GPU so it might be better to render 2D primitives simply by switching their shader family to a set of shaders that uses the orthographic matrix instead. In any case, I certainly have learned a lot more about Vulkan in the last couple of days.
  11. That's interesting, Josh did you think at that time about how to build the car AI opponents ? There are so much games having a great car AI. With the Spline tools it is possible to simulate something but without ??? How to make a computer-controlled car follow a road ?
  12. The text is a model, so you can just modify the vertex colors: auto text = CreateText(foreground, font, L"Hello, how are you today?\nI am fine.", 72, TEXT_CENTER); for (int v = 0; v < text->lods[0]->meshes[0]->vertices.size() / 4; ++v) { int r = Random(0, 255); int g = Random(0, 255); int b = Random(0, 255); for (int n = 0; n < 4; ++n) { text->lods[0]->meshes[0]->vertices[v * 4 + n].color[0] = r; text->lods[0]->meshes[0]->vertices[v * 4 + n].color[1] = g; text->lods[0]->meshes[0]->vertices[v * 4 + n].color[2] = b; } } text->lods[0]->meshes[0]->Finalize();
  13. Last week
  14. My current fascination is with coop puzzle games after playing We Were Here Together.  Seems very doable since you don't have to worry about a lot of animations/moves or enemies.  In short it's a coop puzzle game where usually one person is in a different room from the other.

    1. Show previous comments  3 more
    2. gamecreator

      gamecreator

      I don't know either way but there are a TON of puzzles on the internet to borrow from.  A lot of it involves finding visual or numeric patterns or differences but this can be made much more fun if you include sound games, from anything as basic as morse code to various different nature or custom sound patterns.  Puzzle design and the prototyping would be the most fun for me.

    3. Marcousik

      Marcousik

      The best puzzles are the one that force you to change the way your mind is used to think.

      There are tons of puzzles and tons of models on the internet. Yes that sounds great and that is cool, I don't want to complain... but that is exactly the difficulty (first puzzle :lol:) I'm confronted with not to use the prettiest, or the best ones, but to restrict myself and select the ones passing in the game thematic.

      It is a real work to sort this "tons of"

    4. gamecreator

      gamecreator

      Quote

      The best puzzles are the one that force you to change the way your mind is used to think

      I agree completely.  And that's very difficult to design for, especially considering that you'll have players of all ages and intelligences.  You'll want most of them to be able to get to the end with some effort, which means that for the very smartest people, the game will be pretty easy.

  15. What does the code for differently coloured letters look like? Do you call CreateText once for every letter and then position them manually or is there a nicer way?
  16. Here it is working. The text always draws on top of the scene with the blue rectangle under it.
  17. The image above is using a perspective projection btw. You can see the lines converge at a point in the distance.
  18. So I take it you could rotate on the Y axis too, like some games and their UIs do?
  19. Not really. It's mostly just a static thing that sits there.
  20. My bad. I did something else and forgot. The terrain works fine. Sorry about that lol. But is there a way to access the imported terrain in script?
  21. No, I don't think so. Unless it can somehow use the VC compiler.
  22. @gamecreator More info here:
  23. Is there an option to use Code Blocks in windows to program in c++?
  24. Thx the model I used in the video is from sketchfab. https://sketchfab.com/3d-models/generic-triple-motorcycle-0897a975845647919728095d117a6255 But for the workshop I need a cco model, because as far as I know Josh doesn't accept the "must credit the author" in the workshop. To avoid possibly complications I think.
  25. I can't carry a mesh in Leadwerks. Bot.fbx
  26. I don't know about CC0 but there are a ton here available for free even for commercial use: https://sketchfab.com/search?features=downloadable&q=motorcycle&sort_by=-pertinence&type=models
  1. Load more activity
×
×
  • Create New...