Woot! 2D stuffs. I do love me some 2D stuffs. Thanks, aster2013!
Been waiting for it to reach master branch and eager to check it out immediately. I tried both the cpp and Lua samples. On my Linux 64-bit machine, the cpp sample runs fine initially but occasionally segfault on exit; after that it is kind of alternating between running and core-dump on starting. The Lua sample segfault more often than cpp sample. It is late here now, so I think I will continue to check it tomorrow when I am free. Regardless, kudos to Aster!
wow! i am going to get testing on this stuff as soon as i get a free moment. now that we have the base we can iterate! <3
Thanks, I will give two 2D sample in C++ Lua and AngelScript.
Nice! I will get to test the code during weekend.
Sorry for the delay. I had been away to continue to debug the seg fault issue. I am not entirely sure yet, but I think it has something to do with Drawable2D::UpdateMaterial() method. I notice two things:
- The material_ instance variable never get assigned in the cpp sample. I fail to see where SetMaterial() is being or should be called.
- The UpdateMaterial() method is being referenced by UpdateBatches() which may be called from worker threads. Current implementation may not be thread-safe. If I run the sample by forcing it to run in a single threaded mode then it does not crash in my system. If I run it normally (I have a 4-core machine) then it crashes mainly in this method - double releasing refcounted object.
Now got to test this as well. Excellent work!
I found the same that it would randomly segfault when run with threads on. UpdateBatches() is indeed not a good place to be creating objects or cloning them, because SharedPtr / WeakPtr refcounts are not thread-safe. Rather, I think the material update can be moved to happen on-demand in the setter functions, so that when it’s time for the render update, the material is already correct.
EDIT: it shouldn’t crash any more.
Btw. if you want to improve the instancing and render queue behavior, there could be a “material cache” for Drawable2D’s that you’d request materials from (base material + texture + blendmode) and it would look up if one already exists and not clone / create more than once. Now, when each material is unique, it creates a separate batch group for each without being able to benefit from instancing. The same could be done for vertex buffers, if their content is the same.
I can confirm it is not crashing on my system anymore. Thanks for the quick fix!
I have also observed one peculiarity with Lua sample (24_Urho2DSprite.lua) which I could not yet explain or understand why it happens, the flower movement is not all the way smooth. It is more pronounce when the Urho3DPlayer is built using Debug configuration but it is also observable using Release configuration. Using profiling tool, I can see the max FPS is alternating between 200 (cap) and 190, back and forth. So, there is a noticeable small jump in the flower movement every now and then. This symptom does not occur on the cpp and AngeScript implementation on the same sample. So, it could be more to do with Lua/LuaJIT then to Urho2D subsystem. Anyone else also seeing this?
I noticed it either (I thought it was coming from my old computer). Translation is globally less fluid (slightly blured) and becomes jerky from time to time.
Perfect for C++ and AS.
It is that we current use Vector3 in Lua, when call Vector3::operator+ or Vector3::operator*, it will return new Vector3 with Lua GC. so the FPS not smooth.
I have do some change, just use Node::GetPositionXYZ function and SetPositionXYZ replace old source, It will not new User data in Lua.
Thanks Aster, everything is perfect for me
This is not the best solution.
The better solution may be like we dispose Vector<> and PODVector<> to Lua table. We can create a table call Vector3 in Lua, and build the mapping between Lua and C++.
If add 2D why not add 2D physics with Box2D ?
Aster had Box2D once added into 2D branch but the integration is incomplete. At least that is how I understand it. I don’t think Box2D integration will make it into the coming release, which should be any time now.
Do you want to make 2D game with Urho3D? Box2D suport will be add later.
Another thing that came to my mind is that the 2D features will need documentation in the Doxygen pages. It doesn’t need to be very fancy or long, but to just explain how the new resources and new components work. For now I’ll just add the 2D drawables to the list on the “Rendering” page. Aster, if you make the documentation (as you actually know the features best) others can then help with grammar / editing, if necessary.
Do you want to make 2D game with Urho3D? Box2D suport will be add later.[/quote]
Oh, no at this moment i have other 2D games engines, but at see the 2D topic i give the idea, for 2D games i use SDL or SFML with custom basic engine only for 2D, and i have the Gamemaker Studio purchased for make a fast 2D game,
but i like make 3D game in near future with (Urho or Ogre) for make the custom base engine with the game on this, and if this is impossible with (Unity or UDK) if don’t see advantages here. I prefer the Urho build of graphics + network + all and networked physics is rather for me than basic of Ogre, but Ogre have more worked graphics and gui (I’m waiting for 2.0 version with Opengl 3.2) and you can build all structure, the Urho structure for me not good (for me), i like more the structure of Id Tech3 or 4 or Cryengine (The file system (locations, shaders, scripts, paks, commands) (Old school, no for mobile devices)) the Tesseract engine structure (external) is ok for example (but need pak the files and the engine no support LODs or networked physics…).
The Urho editor idea of show nodes, don’t is he best idea and need channels and folders, because if you make a normal map for a pc game you add from 200 nodes to 100.000? that is insane.
See at GTKRadiant or Cryengine (Editors) structure.
For the 3D i need the network physics(already), a tutorial about how add models (static, dynamic, physics, character with bones and collision), FPS and TPS camera, basic support of animations with kinematics (if is possible), scripting of the maps for animated models in the map (rotation,… networked).
Conclusion, i like use this for 3D game but need changes…
Hi, 2D rendering is simple enough. the no much feature on it. Here is some explain for 2D rendering resources.
A 2D sprite sheet is a texture atlas, it contains many texture call Sprite2D. Urho3D use same file format as Sprarrow / Starling engine. Sprite sheet can be created use a tool call TexturePackager http://www.codeandweb.com/texturepacker.
A 2D Animation is a XML file define a sequence Sprite2D call frame. The frame include duration time and refer a Sprite2D. These is no tool for it, but the file format is simple enough. Here is a sample of 2D animation:
<Frame duration="0.1" sprite="Urho2D/GoldIcon.xml@0" />
<Frame duration="0.1" sprite="Urho2D/GoldIcon.xml@1" />
<Frame duration="0.1" sprite="Urho2D/GoldIcon.xml@2" />
<Frame duration="0.1" sprite="Urho2D/GoldIcon.xml@3" />
<Frame duration="0.1" sprite="Urho2D/GoldIcon.xml@4" />
A 2D partile system can be created use 71squared’s ParticleDesigner http://71squared.com/particledesigner. The tool can only run on Mac OSX.
Hgdavidy, you can use “dummy” scene nodes to group things in scenes. Similar as you would do in Unity. But if we are realistic I don’t think extensive changes will happen to the editor/engine in any near future. More tutorials also depend on the community activity, for example, I know very little about modeling animated characters in Blender et al. and exporting them so that they work in an engine, so I can’t actually help there. As a summary, you may be better off to choose another engine and not frustrate yourself with Urho3D.
Aster: please do not just post on the forum, put that in the .dox files For the soon coming release it’s not necessary, but for the next one it’s nice to have full documentation, when there’s 2D physics components also.
Not are more engines is Urho or Ogre (Only graphics and not a best of graphics ) or id tech 4 (bad license and outdated) (All frustrate ) that or pay to win with UDK (script of the hell). Don’t have a engine with all or ~80% of tools…