We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small Basic AI Championship
Thank you for your kind words, dear LitDev.  Blush

I started the "Retro Football" project by describing the physics of the ball's movement directly in code.
I am comfortable using the "Microsoft Surface" tablet. It is convenient for my tasks. But there is little speed here for Football.

I'm interested in trying to use everything that Small Basic and the LD extension can do. So I began to research the engine.
I have already tried to influence objects using the "Mouse". But, I did not achieve the desired result.

So, really, for now I can only hope for impulses.  Shy

I wish everyone the very best.
See you at the sports competitions !
Reply
Hi,

I would expect that 'direct' movement of the ball and paddles by updating their position and handling the 'simple' ball vs vertical-horizontal wall collisions should be faster than the physics engine - it does a lot more calculations handling general collisions with friction and rotations.

For simplicity (and speed) I would use the direct option.

For fun and trying new stuff I would use the physics engine.  In this case I would probably start by setting the paddles as very heavy dynamic objects.  Move them vertically using vertical impulses (google about impulses) - basically they are instantaneous change in momentum (like nudging with a hammer taps) which can be treated like setting the velocity.  Since the mass of the paddles are not infinite, they will react a bit to the ball, but this can be very small which can be corrected by very small position/rotation (teleport) corrections that do not adversly affect the engine physics.  It may also be possible to use joint constraints for the paddles that prevent certain movements, while allowing others (eg. vertical only movement).

Depending how you want to proceed, I can create a small sample code: (case 1 - to check performance on your tablet, or case 2 to consider paddle user control).
[-] The following 1 user Likes litdev's post:
  • AbsoluteBeginner
Reply
(translated by Google translator)

Hi all.  Shy

Yes, dear LitDev, I opened my previous version of the game, in which I did not use the Physics Engine, and launched it.
I realized that if I add a ball blur effect, it will turn out just as good as using the Engine.

Thanks for the tip.
I wish everyone a good day.  Smile
Reply
(translated by Google translator)

And here's another interesting question: "Is it possible to increase the speed of the game "Retro Football" if you use the "LDInline" tool?"  Huh
Reply
AB,

LDInline doesn't especially speed anything.  What makes SB slow is mainly the Primitive type, especially with arrays.  To really speed up you would need to write in C# or similar.  However, careful use of LDList and other optimisations depending on the code (e.g. there may be things that can be done with large number of moving shapes).

The first thing to do is to simplify the code trying to identify cause of bottleneck (which bits are slow - array manipulations, graphics update, file operations, expensive extension commands ...).  If you then get a small sample program that is running slow I can have a look.
Reply
Well.

Then, let this be my current plan of action.  Shy

Thank you very much.
Reply
(translated by Google translator)

Hi all.  Smile

Finally the main mechanical part of my Retro Football code worked.  Shy
Now I will make the code formatting decent and post it on my cloud for viewing and discussion.

Be healthy everyone.
I wish you all the very best.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)