Leaderboard
Popular Content
Showing content with the highest reputation on 08/05/2017 in all areas
-
Box2D UDF - Physics and Game Engine for AutoIT
tarretarretarre reacted to seangriffin for a topic
This is my first release of Box2D for AutoIT. A very fun and exciting UDF to be bringing to you all. For those who don't know, Box2D is a physics engine (see http://box2d.org/). It simulates physical systems using rigid bodies and collision detection. It is arguably the most prevalent physics engine in existence, within popular physics-based games like Angry Birds using it, and is also at the core of other advanced physics engines such as Unity. For a quick demonstration of this UDF in action see the following YouTube video -> https://youtu.be/h5QH1O63Wik Or play "Angry Nerds", the demo game, for yourself. Visit the EXAMPLES section below. Box2D is purely a mathematical engine. It can model physics numerically. This in itself is quite interesting, however it really shines when applied to a good graphics engine. Recently I posted my SFML UDF over here ... After benchmarking several popular graphics engines (i.e. GDI+, Direct2D, Irrlicht and SFML) with this Box2D UDF I've selected SFML as my favourite, and the engine that I believe performs the best (fastest) with a rich set of functions appropriate for any physics engine. With Box2D married with SFML, and running on AutoIT, the results are stunning. A HUGE THANK-YOU to jRowe and linus (for the Irrlicht UDF) and UEZ for his post on GDI+ loading screens and trancexx and Eukalyptus for their work on Direct2D. Without their talents I would not have been able to reach this point on my own. The Box2D library is available for C++. Way back in 2010 it was ported to Pure C by "Paril" and made available on Google Code and known as "Box2C". Google Code has since been shut down but the but the archive of Box2C still exists to this day here -> https://code.google.com/archive/p/box2c. This is the library which I have ported to AutoIT in this UDF. SFML I am also porting to AutoIT under a separate UDF, as linked above. Building this UDF has been a dream come true. I've been fascinated by physics-based games as far back as the golden age of gaming in the 80's, with thrust style games like Asteroids and platformers like Donkey Kong. I admired game developers like Jeremy Smith who created what may have been the first true game physics engines for the home computers. I was astonished by their talents in games like Thrust and Exile for the C64. Over the years I've attempted to mimic at least some of their success in my own games but alas I can not match their skills. Now much older automation tools have become my game. I use them almost every day, AutoIT included. I've dabbled in other languages for physics game development, like Scratch and Unity, but sadly I had wondered why AutoIT, with all it's glorious capabilities and rapid scripting features, didn't have such a feature. Hence this UDF. This UDF demands a big time investment, and I am time poor, but I have a keen interest in the topic and will do my best to continue it's development. I am only a hobbyist game developer and welcome comments and suggestions from those far smarter than I on this topic. REQUIREMENTS: AutoIt3 3.2 or higher LIST OF FUNCTIONS (in progress): I've split this UDF into two halves. "Box2C.au3" is a UDF specifically for Box2C, the C API for Box2D. It provides the mathematics behind the engine. Additionally I'm providing "Box2CEx.au3" as an Extension that provides the graphics and gaming functions for Box2D. Within the core "Box2C.au3" UDF: _Box2C_Startup _Box2C_Shutdown _Box2C_b2Vec2_Constructor _Box2C_b2Vec2_Length _Box2C_b2Vec2_Distance _Box2C_b2World_Constructor _Box2C_b2World_CreateBody _Box2C_b2World_DestroyBody _Box2C_b2World_CreateFixture _Box2C_b2World_CreateFixtureFromShape _Box2C_b2World_Step _Box2C_b2BoxShape_Constructor _Box2C_b2CircleShape_Constructor _Box2C_b2PolygonShape_Constructor _Box2C_b2PolygonShape_Set _Box2C_b2PolygonShape_CrossProductVectorScalar _Box2C_b2PolygonShape_CrossProductVectorVector _Box2C_b2PolygonShape_Normalize _Box2C_b2PolygonShape_ComputeCentroid _Box2C_b2BodyDef_Constructor _Box2C_b2Body_DestroyFixture _Box2C_b2Body_GetPosition _Box2C_b2Body_SetPosition _Box2C_b2Body_GetAngle _Box2C_b2Body_SetAngle _Box2C_b2Body_SetAwake _Box2C_b2Body_SetTransform _Box2C_b2Body_GetLinearVelocity _Box2C_b2Body_SetLinearVelocity _Box2C_b2Body_GetAngularVelocity _Box2C_b2Body_SetAngularVelocity _Box2C_b2Body_ApplyForce _Box2C_b2Body_ApplyForceAtBody _Box2C_b2Body_ApplyDirectionalForceAtBody _Box2C_b2Body_ApplyTorque _Box2C_b2Fixture_GetShape _Box2C_b2Fixture_GetDensity _Box2C_b2Fixture_SetDensity _Box2C_b2Fixture_GetRestitution _Box2C_b2Fixture_SetRestitution _Box2C_b2Fixture_GetFriction _Box2C_b2Fixture_SetFriction _Box2C_b2Fixture_SetSensor Within y "Box2CEx.au3" extension: x_metres_to_gui_x y_metres_to_gui_y metres_to_pixels atan2 radians_to_degrees degrees_to_radians _Box2C_Setup_SFML _Box2C_b2Vec2_GetGUIPosition _Box2C_b2World_Setup _Box2C_b2World_GDIPlusSetup _Box2C_b2World_SetPixelsPerMetre _Box2C_b2World_SetGUIArea _Box2C_b2World_GetGUIArea _Box2C_b2World_GetGUIAreaCenter _Box2C_b2World_Create _Box2C_b2World_Step_Ex _Box2C_b2World_StartAnimation _Box2C_b2World_Animate_SFML _Box2C_b2World_Animate_GDIPlus _Box2C_b2World_WaitForAnimateEnd _Box2C_b2ShapeArray_AddItem_SFML _Box2C_b2ShapeArray_SetItem_SFML _Box2C_b2ShapeArray_GetItemImagePath_SFML _Box2C_b2PolygonShape_ArrayAdd_Irrlicht _Box2C_b2PolygonShape_ArrayAdd_GDIPlus _Box2C_b2BodyDefArray_AddItem _Box2C_b2FixtureArray_SetItemSensor _Box2C_b2FixtureArray_GetItemDensity _Box2C_b2FixtureArray_SetItemDensity _Box2C_b2FixtureArray_GetItemRestitution _Box2C_b2FixtureArray_SetItemRestitution _Box2C_b2FixtureArray_GetItemFriction _Box2C_b2FixtureArray_SetItemFriction _Box2C_b2BodyArray_AddItem_SFML _Box2C_b2Body_ArrayAdd_Irrlicht _Box2C_b2Body_ArrayAdd_GDIPlus _Box2C_b2BodyArray_GetItemCount _Box2C_b2BodyArray_GetItemPosition _Box2C_b2BodyArray_SetItemPosition _Box2C_b2BodyArray_GetItemAngle _Box2C_b2BodyArray_SetItemAngle _Box2C_b2BodyArray_GetItemLinearVelocity _Box2C_b2BodyArray_SetItemActive _Box2C_b2BodyArray_SetItemAwake _Box2C_b2BodyArray_SetItemImage_SFML _Box2C_b2BodyArray_SetItemDraw _Box2C_b2BodyArray_ApplyItemForceAtBody _Box2C_b2BodyArray_ApplyItemDirectionalForceAtBody _Box2C_b2BodyArray_Transform_SFML _Box2C_b2Body_Transform_GDIPlus _Box2C_b2BodyArray_Draw_SFML _Box2C_b2Body_ArrayDrawDisplay_SFML _Box2C_b2Body_Destroy _Box2C_b2Body_Destroy_SFML _Box2C_b2Body_Rotate_GDIPlus The SFML functions used in the tests and demos will be available in the SFML UDF post (see reference above). EXAMPLES: For such a powerful physics engine coupled to such a powerful graphics engine (SFML) it's sad that I've only had time to build one functional game, thus far. But it's a start. My self-titled "Angry Nerds" is merely a demo of the same game concept as the ever-so-popular Angry Birds game. Angry Birds itself is built on top of Box2D. Likewise Angry Nerds. AutoIT + Box2D + SFML to be exact. I've compiled Angry Nerds and provided an installer also, so you can quickly run the demo for yourself. From the Github site below (in the DOWNLOAD section) run "Box2C_Angry_Nerds_Game_SFML_installer.exe" to install the demo to a location on your computer (desktop by default). Go into this folder and run "Box2C_Angry_Nerds_Game_SFML.exe". All instructions are displayed in-game. Should be quite easy to work out. Aside from Angry Nerds there are also two test scripts: Box2C_linear_forces_test_SFML.au3 Box2C_angular_forces_test_SFML.au3 Feel free to run these for a basic demonstration of rigid bodies, forces and collisions. The heart of Box2D and any physics engine. Lastly I also have four speed tests as follows: Box2C_speed_test_SFML.au3 Box2C_speed_test_Irrlicht.au3 Box2C_speed_test_D2D.au3 Box2C_speed_test_GDIPlus.au3 These were my initial evaluations into a suitable graphics engine for Box2D. I've since settled on SFML, but feel free to execute these. Note they may become quick defective over time as the SFML functions slowly take over. DOWNLOADS: You can download this UDF, including the examples above and associated files, from the following GitHub page: https://github.com/seanhaydongriffin/Box2C-UDF Hope you all enjoy! I certainly am :-) Cheers, Sean.1 point -
Usually things happen like this You provide precise informations as much as possible and ask a question My answer (and/or code) is perforce based on these informations Next you say "ok, it works" and we are done, OR "it doesn't work" and then you describe the failure with a maximum of details - required Reason why all I can suggest for the moment is : try to change this line If not @error Then $sUsersList &= $user & @crlf to this one If @extended > 0 Then $sUsersList &= $user & @crlf1 point
-
1 point