Marleys Ghost Posted August 6, 2010 Share Posted August 6, 2010 First, how did I set up the overhead labels for the NPC's (and player) as seen in this video. I think this was the easiest part of that particular exercise. It was managed in the 2D drawing section of the main loop (just before the Flip() command) using the CameraUnproject command: SetBlend(BLEND_ALPHA) SetColor(Vec4(0,1,0,1)) Local Label:TVec3 = EntityPosition(player) Local playerlabel:TVec3 = CameraUnproject(fw.Main.camera, Vec3(Label.x, Label.y+5, Label.z)) DrawText("Player", playerlabel.x, playerlabel.y) SetColor(Vec4(1,1,1,1)) SetBlend(0) For the NPC's I added a check to see if that particular NPC was culled or not, otherwise you end up with NPC labels floating all over the place like a swarm of bees. This was easy to implement using the EntityCulled command: SetBlend(BLEND_ALPHA) SetColor(Vec4(1,0,0,1)) Local Label:TVec3 = EntityPosition(BUG) Local NPClabel:TVec3 = CameraUnproject(fw.Main.camera, Vec3(Label.x, Label.y+4, Label.z)) If EntityCulled( BUG, fw.Main.camera) = 0 DrawText("Bug", NPClabel.x, NPClabel.y) End If SetColor(Vec4(1,1,1,1)) SetBlend(0) The main reason I was using labels was basically to keep an eye on what a bug was "thinking". I hope this will be of some use to someone. The second request was for a demo .exe of the app from the video, I have uploaded a demo here: http://www.megaupload.com/?d=OL1WYURM Set the screen resolution, number of bugs, post FX, music and stats via the applications launcher. WASD to move shift to run space to jump. Or use my lazy move by pressing the right mouse button. The mouse wheel will zoom in and out from a first person POV to third and then on to CIA spy satellite mode lol One of the best ways to learn the engine, for me was to go through all the commands found HERE one at a time, see what they do, have a play and think about how they could be used. 1 Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
GIMPY73 Posted August 6, 2010 Share Posted August 6, 2010 Cheers MG Thanks Gimpy73 Quote http://www.fallingpixel.com/mac10-3d-model/26203 (MAC-10) http://www.fallingpixel.com/glock17-3d-model/26471 (Glock-17) http://www.youtube.com/user/MRGIMPY73 Link to comment Share on other sites More sharing options...
macklebee Posted August 6, 2010 Share Posted August 6, 2010 +1 for Benny! Thanks MG... some good stuff! Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 11, 2010 Author Share Posted August 11, 2010 Additional tip: If you want to centre your label, above the models origin, in this instance for the player, change: DrawText("Player", playerlabel.x, playerlabel.y) to: DrawText("Player", playerlabel.x-TextWidth("Player")/2, playerlabel.y) Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Pixel Perfect Posted August 13, 2010 Share Posted August 13, 2010 Great to see you back and active in the forums again MG. Thanks for sharing this very useful code, much appreciated. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 14, 2010 Author Share Posted August 14, 2010 Hi Pix, well I never really left, just busy with my project "elsewhere" so to speak, but had to go through a load of assets to convert to a "particular" format and came across my Bmax code archives and thought some might be of use to others in the Bmax community here, glad it was. Have some more for later and will probably stumble across other things tucked away. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.