satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
57 stars 13 forks source link

Entities #26

Open satoshinm opened 7 years ago

satoshinm commented 7 years ago

Objects of arbitrary 3d models not locked to the world grid, unlike blocks.

satoshinm commented 7 years ago

Craft actually already supports a form of entities: players. This includes position/rotation updates with interpolation (P command), naming the entities by id (N), deleting entities when they leave the game (D). Players can roam freely from the world grid, as disembodied cubic heads.

The same existing functionality could be extended and reused for other kinds of "entities", question is, what next? Item drop entities? Mob entities? Projectile entities?

satoshinm commented 7 years ago

Use http://assimp.org Open Asset Import Library (assimp) for asset loading object models files? Supports many types of formats including .stl (stereolithography) common on http://www.thingiverse.com and formats of various 3d modeling software packages. There is a tutorial to use assimp at https://learnopengl.com/#!Model-Loading/Assimp. And then drag-and-drop an object file to load it into the world as an entity.

satoshinm commented 7 years ago

Assimp is not suitable for various reasons, see: https://github.com/satoshinm/NetCraft/pull/139#issuecomment-302745455

Some alternative code to consider, or write anew:

satoshinm commented 7 years ago

https://github.com/nothings/single_file_libs#geometry-file shows some promising model loading libraries in C: https://github.com/joeld42/tk_objfile https://github.com/syoyo/tinyobjloader-c and https://github.com/xelatihy/yocto-gl are for .obj, and https://github.com/ddiakopoulos/tinyply for .ply (C++)

twetzel59 commented 7 years ago

OBJ is one of the easier formats to parse. It would require hard-coding animations, but that may, or may not be an issue.