Games Mobile Games

Are you interested in buying great Game Sources for low price?

  • Very much interested

    Votes: 15 55.6%
  • Maybe

    Votes: 8 29.6%
  • Not at all, i preffer Application Source code

    Votes: 4 14.8%

  • Total voters
    27

Magma

Expert
Licensed User
Longtime User
Well, I will buy this one soon:
View attachment 129058
Well my son got one, as present from his "godmother" when he was 4... when he doesn't like something we are saying to him... goes to his room and return with it...

Luckily has those type of arrows:

1652205292423.png


but generally is very big about 1.2meter... and powerful.... well I have to say... we afraid him... the late 5 years that have it...
 

ilan

Expert
Licensed User
Longtime User
1. Is it because, slow to detect collision, and then refresh it to show it at screen ?
2. I don't know... we are waiting you to say.. how :)

when we use the panel_touch event and use the move action the response is not very accurate.

so if i will move the mouse (or my finger) fast and draw the points that the touch event returns it could look like this:

1652205276282.png


as you can see there are big gaps between the dots. in the game itself you will not notice it because i draw a sword line between the dots BUT for collision detection, i use the dots, and because the apple is too small it can be that the sword line is drawn over it but the points do not collide with its body.

how to solve it?

i set a minimum distance tolerance so if the 2 dots are too far away i add programmatically more points between them and it looks like this now:

1652205544656.png


no more gapes between the points and the collision detection is much more accurate now :)
+ the sword drawing is also smoother now

note: the blue points are added programmatically and the red points are returned from the touch event.

you only need to set a logical distance tolerance. if it is too low you will add many many points and each point will then perform a collision check and that may cost too much processing power so the distance of 10 pixels looks fine (for now)
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Well my son got one, as present from his "godmother" when he was 4... when he doesn't like something we are saying to him... goes to his room and return with it...

Luckily has those type of arrows:

1652205875694.png


but generally is very big about 1.2meter... and powerful.... well I have to say... we afraid him... the late 5 years that have it...
I don't think that would make a big hole in my head the way I need it.
 

cklester

Well-Known Member
Licensed User
QUIZ: if you watch carefully the video on post #10 you will see that sometimes the fruit is not cut even though i cross it.

Questions:

1, why is that happening?
2, how to prevent it?

(question 1 should be simple to answer, question 2 is more challenging ;) )

You are checking collisions only where the touch input is received, which is never a line. That is, many points are skipped by the system. (Not sure why. Could they not track every single pixel touched, or would that be too resource intensive?)

To solve this, you could draw a line from the prior dot to the current dot and check if the line passes through the fruit. If so, cut it up!
 

ilan

Expert
Licensed User
Longtime User
You are checking collisions only where the touch input is received, which is never a line. That is, many points are skipped by the system. (Not sure why. Could they not track every single pixel touched, or would that be too resource intensive?)

To solve this, you could draw a line from the prior dot to the current dot and check if the line passes through the fruit. If so, cut it up!
 

cklester

Well-Known Member
Licensed User
when we use the panel_touch event and use the move action the response is not very accurate.

so if i will move the mouse (or my finger) fast and draw the points that the touch event returns it could look like this:

how to solve it?

no more gapes between the points and the collision detection is much more accurate now :)
+ the sword drawing is also more smoother now

Does a gaming mouse help with the pointer input resolution?
 

ilan

Expert
Licensed User
Longtime User
Gaming mouses claim to have higher resolution, so certainly it would help at the hardware level.
i am not sure it has something to do with the mouse. i think it is the refresh rate of the touch event. but even if it will be better with a gaming mouse I need to find a cross platform resolution and since with don't have gaming fingers we need to check if the gap is bigger then x and fix it if not nothing will be added between the dots :)
 

melonZgz

Active Member
Licensed User
Longtime User
Objects moving fast are allways a problem in physics simulation, as you get only the position in each iteration, so if a small item is moving fast enough it usually can go through an object (no collision is detected).
If you're using a physics engine thankfully the programers behind those engines are aware of this and provide solutions. In Box2d when you define a body you can set the isBullet flag to prevent this kind of things...
 

AnandGupta

Expert
Licensed User
Longtime User
I think we are all missing the main point, by suggesting different methods for gap detecting, even suggesting different application and hardware.
Please remember ilan trying to show how to create a game in B4X and he is making solution which fits in this scenario.
So, I request all to keep the messages for B4X Game only, he is making for us. Rest is up to you.
 

ilan

Expert
Licensed User
Longtime User
Objects moving fast are allways a problem in physics simulation, as you get only the position in each iteration, so if a small item is moving fast enough it usually can go through an object (no collision is detected).
If you're using a physics engine thankfully the programers behind those engines are aware of this and provide solutions. In Box2d when you define a body you can set the isBullet flag to prevent this kind of things...
that is correct. box2d is an amazing library. i really like it and many game engines use it. many many popular games are based on it.
anyway, since i don't use box2d in this game i had to come up with my own solution that i have described above (post #23)

if there will be enough interest in game source i will definitely make box2d source but as it looks until now i am not sure there is a market for it.
i will finish this game and see if it was worth working on it. i do think that the gaming section makes a lot of money but i did not have much luck with it i must admit.
 

ilan

Expert
Licensed User
Longtime User
how to create a game in B4X
note that X2 is a b4x framework and it also uses box2d. ;)
but again working with bodies and box2d is not simple you need first to understand how game works and in my opinion starting without any framework can give you very good basics knowledge.
 

AnandGupta

Expert
Licensed User
Longtime User
but again working with bodies and box2d is not simple you need first to understand how game works and in my opinion starting without any framework can give you very good basics knowledge.
This is what most of us are expecting as novice.
Message from experts in games are welcome, but should not derail your goal, that's why I requested so.
 
Top