Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
3.4 KiB

  1. # FAQ
  2. ### How to run it?
  3. There's no GUI. Find a directory with Minecraft Anvil files (.mca).
  4. Copy a Minecraft "terrain.png" into that directory (do a google
  5. image search). Run from that directory.
  6. ### How accurate is this as a Minecraft viewer?
  7. Not very. Many Minecraft blocks are not handled correctly:
  8. * No redstone, rails, or other "flat" blocks
  9. * No signs, doors, fences, carpets, or other complicated geometry
  10. * Stairs are turned into ramps
  11. * Upper slabs turn into lower slabs
  12. * Wood types only for blocks, not stairs, slabs, etc
  13. * Colored glass becomes regular glass
  14. * Glass panes become glass blocks
  15. * Water is opaque
  16. * Water level is incorrect
  17. * No biome coloration
  18. * Cactus is not shrunk, shows holes
  19. * Chests are not shrunk
  20. * Double-chests draw as two chests
  21. * Pumpkins etc. are not rotated properly
  22. * Torches are drawn hackily, do not attach to walls
  23. * Incorrect textures for blocks that postdate terrain.png
  24. * Transparent textures have black fringes due to non-premultiplied-alpha
  25. * Skylight and block light are combined in a single value
  26. * Only blocks at y=1..255 are shown (not y=0)
  27. * If a 32x32x256 "quad-chunk" needs more than 800K quads, isn't handled (very unlikely)
  28. Some of these are due to engine limitations, and some of
  29. these are because I didn't make the effort since my
  30. goal was to make a demo for stb_voxel_render.h, not
  31. to make a proper Minecraft viewer.
  32. ### Could this be turned into a proper Minecraft viewer?
  33. Yes and no. Yes, you could do it, but no, it wouldn't
  34. really resemble this code that much anymore.
  35. You could certainly use this engine to
  36. render the parts of Minecraft it works for, but many
  37. of the things it doesn't handle it can't handle at all
  38. (stairs, water, fences, carpets, etc) because it uses
  39. low-precision coordinates to store voxel data.
  40. You would have to render all of the stuff it doesn't
  41. handle through another rendering path. In a game (not
  42. a viewer) you would need such a path for movable entities
  43. like doors and carts anyway, so possibly handling other
  44. things that way wouldn't be so bad.
  45. Rails, ladders, and redstone lines could be implemented by
  46. using tex2 to overlay those effects, but you can't rotate
  47. tex1 and tex2 independently, so there may be cases where
  48. the underlying texture needs a different rotation from the
  49. overlaid texture, which would require separate rendering.
  50. Handling redstone's brightness being different from underlying
  51. block's brightness would require separate rendering.
  52. You can use the face-color effect to do biome coloration,
  53. but the change won't be smooth the way it is in Minecraft.
  54. ### Why isn't building the mesh data faster?
  55. Partly because converting from minecraft data is expensive.
  56. Here is the approximate breakdown of an older version
  57. of this executable and lib that did the building single-threaded.
  58. * 25% loading & parsing minecraft files (4/5ths of this is my crappy zlib)
  59. * 18% converting from minecraft blockids & lighting to stb blockids & lighting
  60. * 10% reordering from data[z][y]\[x] (minecraft-style) to data[y][x]\[z] (stb-style)
  61. * 40% building mesh data
  62. * 7% uploading mesh data to OpenGL
  63. I did do significant optimizations after the above, so the
  64. final breakdown is different, but it should give you some
  65. sense of the costs.