Marleys Ghost Posted May 13, 2010 Share Posted May 13, 2010 After four hours I tracked the problem of entity picks causing EAV errors and crashing my app, this is a pickfilter: Function PickF%(entity:TEntity) If GetEntityType(entity) = 0 Return 0 Else Return 1 End If End Function It works for both 2.31 and 2.32, but I use a custom pickfilter to add an extra layer of selection for certain picks like this: Function PickF%(entity:TEntity) If GetEntityType(entity) = 0 Local EType:String = GetEntityKey(entity.parent,"name") If Etype = "whatever" Return 0 Else Return 1 EndIf Else Return 1 End If End Function This works 100% in 2.31 and does what it was intended to do brilliantly, but is the cause of the EAV's with 2.32 and my currently elevated annoyance status. If I change: GetEntityKey(entity.parent,"name") to: GetEntityKey(entity,"name") There is no error but then the name of the object itself is not retuned but the mesh name such as U3D_MESH which is the name for about 99.9% of all my models. adding .parent got the name of the entity like oildrum_1 or Box_01 or Blobby_2 which is what is needed. so has something changed? 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 Using certain entity keys, like "name" and "class" can be very confusing since the engine keeps changing their content during LoadScene(). I use custom names like "type" and "classname" to have correctly working entity keys. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 Using certain entity keys, like "name" and "class" can be very confusing since the engine keeps changing their content during LoadScene(). I use custom names like "type" and "classname" to have correctly working entity keys. hence my Q, whats changed? this worked perfectly in 2.31 and now does not. and its the first of several problems. It is a razor thin line at the moment whether I stick with LE or move on. 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 I think a simple entity.parent is not sufficient, since the mesh can be deeper down in the hierarchy of the model. The tutorials and gamelib provide a function called GetMeshModel() which correctly returns the top level entity in all cases. I've never had problems with that. So, it shouldn't matter what has changed internally in the engine (=undocumented things), when you use methods which work always (=documented things), no matter how it has changed internally, since they use a way which will never change. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 a simple entity.parent is not sufficient? it was thats the point and this is not about it not returning the correct name but it crashes the app when used in the pick filter. 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 You should check if entity.parent is NULL. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 why? It was not an issue BEFORE. Why would it be an issue NOW? do you see a pattern forming here Mika? 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 Yes, I see the pattern that something undocumented has changed, which happens in all programs. That's why they are undocumented and should not be used. You see: 1) It is documented that the model is a parent of the mesh (but not necessarily the nearest parent). The model is identified (and the resursion is stopped) when the parent's entitykey is "class"=="Model". 2) It is undocumented that the model is the nearest parent to the mesh. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 But I can get the parent outside of the filterpick. GetEntityKey( pick.entity.parent, "name" ) works ... But then it all worked in 2.31 you keep on about documented and undocumented I have only been using the wiki. Basically what you are saying is you dont really know and I need rewrite the whole thing without knowing what has changed between the two releases as its probably undocumented? 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 No, I know exactly how you should do it Use the GetMeshModel() function, since in 2.32 it might be possible that you can also pick models, which was not earlier possible in 2.31. So your entity.parent will not work correctly if the picked model is already the model. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 So your entity.parent will not work correctly if the picked model is already the model. You know you make things as clear as mud. you did read the part where I said "I can get the parent outside of the filterpick. GetEntityKey( pick.entity.parent, "name" ) works " 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 That could mean that the pickfilter function already gets the model as entity in its parameter, and not the mesh as earlier. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 "could", "might be possible" too many vague qualifiers. I think the razor thin line just evaporated. 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 Just use this function and there is no need to change your code in future, as we don't know how things change internally and don't need to know: TBody GetMeshModel(TEntity entity) { string classname; while (entity!=0) { classname=GetEntityKey(entity,"class"); if (classname=="Model") { return entity; } entity=GetParent(entity); } return 0; } Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 I have been changing my code for the last 7 months, and dont expect that to change in the future despite your "rosey" claim. 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 The idea of GameLib is also that your own code never needs to change, since GameLib works with all new and old LE versions (LE 2.3x is tested). It has helped me at least a lot since I only need to update GameLib, and don't need to change my game code, or at least a minimum until I have put those remaining functions into GameLib too. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 I'm not using Gamelib ... so how does that even remotely help? makes no odds now anyway. 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...
Canardia Posted May 14, 2010 Share Posted May 14, 2010 I was just pointing out that by using standard libraries and functions you don't need to change your game code each time the engine changes. Game code should have nothing engine, hardware or OS specific in them, as you might want to use the same source with minimal changes on other systems also. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 14, 2010 Author Share Posted May 14, 2010 standard libraries and functions IS what I have been trying to build! but as I said it makes no odds now. 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...
macklebee Posted May 15, 2010 Share Posted May 15, 2010 I was just pointing out that by using standard libraries and functions you don't need to change your game code each time the engine changes. Game code should have nothing engine, hardware or OS specific in them, as you might want to use the same source with minimal changes on other systems also. Lumooja, just hush. He is asking a legitimate question and you do not know the answer to it. Your ramblings telling people to use gamelib is not an answer to the question. The only person that can answer his question is Josh. And he is not the only person that has issue with this constant redoing perfectly working code every time a new release comes out. If something like this gets changed on how it functions for no obvious reason, it gets quite annoying to constantly go back and redo code that worked just fine the previous version. 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...
Josh Posted May 15, 2010 Share Posted May 15, 2010 I believe there could very well be a problem you have found, but looking at the engine code, everything seems like it should be working, and I have found no problems in my own usage. I would like to see an example of the error. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 15, 2010 Share Posted May 15, 2010 I think I know what's going on. The pick filter function is being called for entities it used to not get called on, like cameras or pivots, anything with a pickable subchild. The parent probably does not exist. So your filter previously had sort of an error, but the engine didn't make it come up. And it's not really necessary for those entities that are currently causing the error. The solution is I will fix the behavior in the engine, and you should fix your code to make sure a parent exists. Always write code with error checks like that, and you will save a lot of time, with any programming SDK. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 15, 2010 Share Posted May 15, 2010 Give this DLL a try. engine.zip Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Pixel Perfect Posted May 16, 2010 Share Posted May 16, 2010 I have to admit that Lumooja's posted code does seem to offer a safer way of determining that the entity returned is indeed the top level model. Note, there should still be a check for a NULL Entity prior to supplying it to any function. 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 May 16, 2010 Author Share Posted May 16, 2010 well I had a quick try with the new .dll but after an hour I had the error notify sorted but as the light_directional_1 is the first picked item the filter bypassed the extra "if's". Which it would do when using a null check. But as I said makes no odds as for the time being I am pursuing another avenue for the project I am working on. 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.