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
(translated by Google translator)

Hi guys!  Smile
I have uploaded an intermediate version of the game "Retro Football" to my OneDrive.

https://1drv.ms/f/s!AnoSlTzMqlL6jNwEee_Q...g?e=bLsytu

In discussing this version, I am interested in your advice and tips.
Here I first tried to use an asynchronous subroutine call.
I'm interested in advice and comments on the topic of using variables shared between the main and temporary computation threads.
What rules should I follow to avoid program crashes?
How to properly organize the work of threads so that they do not interfere with each other when using shared variables?

Also, I would appreciate your advice on how to improve the gameplay.
Now, left clicking on the "cursor sensor" turns the game Pause on and off.
The human controls the right players, and the Robot controls the left.
The Y coordinate of the cursor corresponds to the midpoint of the rectangles of human-controlled players.
The speed of the ball and the accuracy of the Robot's movement can be changed at the beginning of the program's source code.

I want to add the ability for football players to RE-DIRECT the ball as it moves towards the opponent's goal.
At the moment, football players can only hit the ball when it flies towards their goal.

Well, that's all for now.
I hope you find this game fun to work on.
After all, the most interesting thing is yet to come. This is the creation of a Robot Football Player who will SEE the ball on the field with his "eyes".  Tongue
[-] The following 1 user Likes AbsoluteBeginner's post:
  • z-s
Reply
Hi guys.  Smile
I updated the game "Retro Football" in my cloud (link in the previous post).

Added the ability to redirect the ball that is flying towards the opponent's goal.
Only a forward footballer has this ability.

In addition, the game is paused for 3 seconds if one of the teams scores a goal.

Let's have fun further...  Wink
Reply
New update of the game "Retro Football".  Shy
Counting of goals scored has been implemented.
More precise settings for object movement parameters have been made.

How are things going with you?  Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)