Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [LOCKED] rope physics?

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Apr 2016 01:38
Actually a snake made up of many segments. So I don't want elasticity, gravity, or angular velocity. Just a simple "this segment follows this segment" while each segment maintains a static distance between each, despite how fast the head of the snake might be traveling.

I've tried updating the segments to following directly behind one another using the old position of whichever segment was in front of it. So if the tail was the 10th segment, I update it to position 9. Then 9 goes to 8, 8 to 7 and so on. The trouble with that is the distance between the segments will be whatever the speed of the snake is set at.

So then I tried moving each segment towards the one ahead of it by the speed value. This only works in a straight line. Once you start turning and moving around, the gap between segments begins to become lost.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Apr 2016 02:34 Edited at: 27th Apr 2016 02:35
This is rope physics.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Apr 2016 03:19
Ok? That doesn't really help. I think I'll try using the physics commands with a distanceJoint for each segment. Just wish the help files were a bit more insightful on how to use these commands.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Apr 2016 07:03
I did come up with a non-physics method in v1, it would adjust each segment based on distance, so you'd control the head and the body would follow, be pushed back etc. It could probably be improved a lot with better collision commands from the bullet physics, I'll see what state it's in tonight and post some code.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Apr 2016 08:44
Distance joints alone won't work. The tail will take a shortcut towards the head, rather than following the body.
Thinking out loud, I think you need to connect the body segments and then set the angle to align with the segment ahead of you and the previous position the segment you are aligning was in.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Apr 2016 08:55
this is a useful command
float GetWorldXFromSprite( iSpriteIndex, x, y )
AGK (Steam) V2.0.18 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Apr 2016 11:09
Do you need to use physics for this? I assume you are thinking of something like slither.io? That being the case it's just as easy to position the sprites manually. Just rotate each sprite towards it's predecessor and move it to the correct distance away. This will give you much more control and save any of box2d's little quirks causing you grief later on.
Using AppGameKit V2 Tier 1
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Apr 2016 14:13 Edited at: 27th Apr 2016 14:14
Quote: "Ok? That doesn't really help. I think I'll try using the physics commands with a distanceJoint for each segment. Just wish the help files were a bit more insightful on how to use these commands."


Well, what do you expect you titled it rope physics.
You did not show a code example.
You did not even explain if you were talking about 2D or 3D.
You title it physics but say you don't want elasticity, gravity, or angular velocity.
We have no Idea even what command set you are trying to use.
Since your are by no means a noob you should know better.
FYI AppGameKit does not have Rope physics for 3D.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Apr 2016 14:19 Edited at: 27th Apr 2016 14:49
i guess what he want is just a element pointing to parent element have a constant distance.

mini snake


Quote: "
// MR 27.04.2016

dim snake[100] as integer
#constant size=2.5

for i=1 to 100
snake[i]=createsprite(0)
SetSpritePositionByOffset(snake[i],i*10,50)
SetSpriteSize(snake[i],size,size)
next

Do

print("simple snake")
print("press cursor keys")

spr=snake[1]
x#=GetSpriteXByOffset(spr)
y#=GetSpriteYByOffset(spr)

x#=x#+GetDirectionX()
y#=y#+GetDirectionY()

SetSpritePositionByOffset(spr,x#,y#)
Follow()

Sync()
Loop
End

function Follow()

for i=2 to 100
spr1=snake[i-1]
spr2=snake[i]
x1#=GetSpriteXByOffset(spr1)
y1#=GetSpriteYByOffset(spr1)
x2#=GetSpriteXByOffset(spr2)
y2#=GetSpriteYByOffset(spr2)
dx#=x2#-x1#
dy#=y2#-y1#
a#=ATanFull(dx#,dy#)
SetSpriteAngle(spr2,a#)
d#=sqrt(dx#*dx#+dy#*dy#)
dx#=dx#/d#
dy#=dy#/d#
SetSpritePositionByOffset(spr2,x1#+dx#*size,y1#+dy#*size)
next

endfunction
"
AGK (Steam) V2.0.18 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Apr 2016 14:52
I guess we will keep guessing. Maybe the mods should give him a warning for not posting correctly.
He is not a NOOB he knows better.
The coffee is lovely dark and deep,and I have code to write before I sleep.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Apr 2016 15:04
I think you are being a little harsh, I have described things in far more dubious ways myself in the past.

Regarding slither.io, it should be banned and never allowed to be mentioned again. It consumes hours of time. I don't even go through the process of "just one more go". I am already into the next game before that thought process completes.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Apr 2016 15:07
I have seen Noobs chastised for less.
The coffee is lovely dark and deep,and I have code to write before I sleep.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Apr 2016 15:38
Not by me
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Apr 2016 16:04
Quote: "Well, what do you expect you titled it rope physics.
You did not show a code example.
You did not even explain if you were talking about 2D or 3D.
You title it physics but say you don't want elasticity, gravity, or angular velocity.
We have no Idea even what command set you are trying to use.
Since your are by no means a noob you should know better.
FYI AppGameKit does not have Rope physics for 3D."


What bug crawled up your arse? Did you even read my post beyond the title? I explained what I wanted, but if you don't want to help because it's over your head then just stop posting and go away. You been here as long as I have and yet you're posting like a noob. You should know better than to post unhelpful negativity. Maybe the mods should warn you for being such a prick.


For everyone else who has tried to help, I looked into Box2D because I thought it'd be easier to set up with joints and do collision later on. But really, the joints was the only aspect of the physics I would need so maybe it is overkill.

Quote: "Distance joints alone won't work. The tail will take a shortcut towards the head"

I don't understand why? I wouldn't join each segment to the head, but rather each preceeding segment. So wouldn't one just following the other?

Quote: "Regarding slither.io, it should be banned and never allowed to be mentioned again. It consumes hours of time"

I sort of agree there! I think that game made me yell BS more times than COD ever has! But, Sli.... I mean that game that shall not be said, is what I was going after.

That looks helpful Markus, I think I can use that to do what I want.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Attachments

Login to view attachments
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 27th Apr 2016 16:38 Edited at: 27th Apr 2016 16:49
Hello Phaelax.

I somewhat created sort of like 'rope physic' in 3D physics by combining Create3DPhysicsconetwistJoint which is attached to a kinematic body, based on VanB's string code.
So you just need to control the kinematic body using set object positions commands, and the physic string will follow the kinematic body.
Try to set the gravity to 0

Here's the thread discussing it. The example project is in my final post attachment.
https://forum.thegamecreators.com/thread/216491

Probably not exactly what you want, but what the heck I'll just leave it there
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 27th Apr 2016 16:56
Almost forgot. I do have the thing that do exactly what you want, but it's in DBPro.
Probably you can modify it to AGK.

Example project in attachment.


Attachments

Login to view attachments
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Apr 2016 17:21 Edited at: 27th Apr 2016 17:30
Here's a AGK2 bullet physics example, seems to work quite well and it reacts quite realistically, worth a look at least - it lets you wrap the segments up and shift the whole body around, but if you don't want that then you could probably just disable segment to segment collision. With those physics though, you could make a snake game that uses a 3D level, ramps, tunnels etc, might be quite interesting and a departure from the usual snake game. Use arrow keys to control the head.

This was the start of an AppGameKit version of a realistic snake game I made in DBPro, but I could never get the boned mesh to follow the track of segments the way I wanted, will probably revisit it one day.


On a side note, as the first mod to respond to this thread... I made the assumption that Phaelax is looking for options, whether it's Box2D or Bullet or pure code. We simply do not need a heavy hand as moderators here these days. I can understand Stab's frustrations with all things physics and the state of affairs, I've been in similar situations myself - but it's a community and it's more productive when we get along. Disagreements about forum netiquette is small stuff, and we're all too old to worry about that.

Attachments

Login to view attachments
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 27th Apr 2016 17:22
Quote: "Maybe the mods should give him a warning for not posting correctly."
It's not really that kind of forum (thankfully!). It's more a friendly community of like-minded geeks.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Apr 2016 18:08
Quote: "Quote: "Distance joints alone won't work. The tail will take a shortcut towards the head"

I don't understand why? I wouldn't join each segment to the head, but rather each preceeding segment. So wouldn't one just following the other?"


Think of it like - dare I say it - a rope. If you drag a rope across a flat surface and wind it around as you go, the rope doesn't follow it's own path like a snake does. It finds the shortest route from A to B - a straight line.
As soon as you turn a rope, the different parts travel at different speeds. If you turn the head of the rope 180 degrees and head back, the tail will stop. A snake's body has a constant speed at all parts along the body.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 27th Apr 2016 19:24
Out of curiosity...

Could rope physics be added? I personaly would like to see a few things added like this and buoyancy. Id love to play around with water physics in 3d.

If its a matter of money to add and improve agk,s physics capabilities.... Maybe another kickstarter campaign?

Id pay for such developments and im sure others would to.

Other note... Sitd is probably mad at people for blaming him of agks current physics capabilities.

But what most of us developers dont know is that tgc cut the funding short. Im sure there would have been plenty of examples and additions to it if there was more money. Sitd... You cant assume everyone knows this so try to stay respectfull. Please...

Anyways i would like to see physics improvements and id be willing to pay for them. Kickstartit !

Id also like to see an agk v2 compiler or converter for basic code to c++. Id pay even bigger bucks for that.

Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Apr 2016 20:55
Disclaimer I do not speak for TGC.

Quote: "Could rope physics be added? I personally would like to see a few things added like this and buoyancy. Id love to play around with water physics in 3d."


The only way I could add this would be in Tier 2. I am using the advanced features I developed in Tier 2 for my own projects.
I could possibility license the code to Tier 2 users, but sadly I think there are not any Tier2 users. It also seems to me that Tier1
users are dwindling as well.

Quote: "Other note... Sitd is probably mad at people for blaming him of agks current physics capabilities."


I am not mad nor do I believe anyone is blaming me. I am disappointed that I could not add all the features I developed so the community could enjoy them.
I was just making a point that I can't help someone with physics unless they explain properly what they are doing.
I have seen this explained to many posters over the years. They need to show some code or do not expect help.

Quote: "Anyways i would like to see physics improvements and id be willing to pay for them. Kickstartit !"


Even if I kick started, to fund me developing more physics for AppGameKit I get the impressions that they would not be willing to add it.







The coffee is lovely dark and deep,and I have code to write before I sleep.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Apr 2016 21:18
Quote: " You cant assume everyone knows this so try to stay respectfull. Please... "


Now for my RANT I am being accused of not being respectful for asking the poster to explain better. Unbelievable

Quote: "What bug crawled up your arse? Did you even read my post beyond the title? I explained what I wanted, but if you don't want to help because it's over your head then just stop posting and go away. You been here as long as I have and yet you're posting like a noob. You should know better than to post unhelpful negativity. Maybe the mods should warn you for being such a prick."


Here the poster is insulting and name calling but I am being disrespectful. Unbelievable
And again moderators do nothing. Unbelievable

The Irony here is that he gets offended when he is wrong. Maybe he should change his signature to something other than this.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds






The coffee is lovely dark and deep,and I have code to write before I sleep.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Apr 2016 22:28
Aren't you the one who's always attacking me on all my posts because everything I do offends you? I already changed my signature once because you cried about it, I won't do it again. How am I wrong? For asking for advice about a problem? Grow up.

@hakimfullmetal, I'll take a look at it, thanks.

@Batvink, that makes sense now.

So far I think Markus has had the closest thing to what I'm looking for. I actually don't need collision with itself like your example VanB, but cool demo.

I'll work on this a bit tonight, but I'm about to do a week solid of 12 hour shifts, so it might be awhile before I can really look back at this.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Apr 2016 22:48
Quote: "Aren't you the one who's always attacking me on all my posts because everything I do offends you? I already changed my signature once because you cried about it, I won't do it again. How am I wrong? For asking for advice about a problem? Grow up."


It is better to thought a fool then to open your mouth and remove all doubt.
The coffee is lovely dark and deep,and I have code to write before I sleep.
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 27th Apr 2016 23:51 Edited at: 27th Apr 2016 23:54
Quote: "I am not mad nor do I believe anyone is blaming me. I am disappointed that I could not add all the features I developed so the community could enjoy them.
I was just making a point that I can't help someone with physics unless they explain properly what they are doing.
I have seen this explained to many posters over the years. They need to show some code or do not expect help."


it was an assumption on my part. asking you to be respectful was also requested by me but i see i need to reword it to be fair. I wish everyone to stay respectful and calm.

The last thing i want to see is experienced coders run for the hills or get banned because they didnt get along with eachother. I know i will need more help in the future myself... and i also
try to contribute once and a while to help others out also.

back to the physics thing. why could it only be done in tier 2? I remember darkbasic had the ability for buoyancy if i remember correctly. It also did cloth and rope i thought? That was available in basic.
anyways again...id pay for such advancements.

Quote: "I could not add all the features I developed "
out of curiosity what kind of features? maybe those need some kickstarting funds?
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 28th Apr 2016 00:34
Quote: "back to the physics thing. why could it only be done in tier 2? I remember darkbasic had the ability for buoyancy if i remember correctly. It also did cloth and rope i thought? That was available in basic.
anyways again...id pay for such advancements."


You can not get access to the Bullet physics engine in Tier1 to add more physics code.
Not sure why you would think that the Basic programming language contains physics code by default.

Quote: "out of curiosity what kind of features? maybe those need some kickstarting funds?"


Just look at the videos on my youtube channel it shows all the features.
The coffee is lovely dark and deep,and I have code to write before I sleep.
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 28th Apr 2016 00:48
Quote: "You can not get access to the Bullet physics engine in Tier1 "
i have access to it using the built in agk basic commands. (not full access i understand that) What im asking is why more basic commands could not be added in. did you not help tgc with the physics integration? I guess i should be more specific. I guess the question should be more aimed at paul from tgc if features like buoyancy could be added in for basic users such as myself.


"Not sure why you would think that the Basic programming language contains physics code by default." i didnt say it did?? i was asking for more basic commands controlling it.

but anyways.... ill check out your videos! cheers!

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 28th Apr 2016 02:25
I'm sure that more and more people will start using tier 2, I think it's a pretty good way to start learning C++ and folk can start to dabble in more advanced stuff at their own pace. Taking a tier 1 project and migrating it to tier 2 isn't a huge stretch, people are often afraid to even consider learning C++, personally I see it as a reasonably linear translation once you know the standard syntax. Of course Lee made a video that illustrates this, but IMO the benefits are in what else you do in C++ besides use the standard AppGameKit framework. I mean, AppGameKit might not have the best revenue options for some projects, it might not include every feature you need right away, maybe you want to connect to an SQL server or cloud storage. At least there's a route to mitigate the lack of a feature you're relying on, or holding off on a project waiting for. Programmers have to consider what is best for them... tier 1 is a bottomless wishing well... tier 2 is the ladder leading out of it. By that, I mean tier1 will never have all the features that everyone wants and probably won't allow users to make their own plugins, but there is a distinct option available.

I think the decline in activity is partly due to the dire situation on things like Google Play - it's incredibly difficult to even give a game away for free, it's bloody depressing. We need to keep our options open if making some extra money is part of the goal. I'm interested in AppGameKit for raspberry pi - that might lead to some cool projects... like there's a e-paper system that uses photo frames connected through wifi, to show news, company specific information etc etc - the same thing with a screen, pi, and AppGameKit app is a consideribly cheaper option. Maybe there's money to be made in the more specific markets, with the benefit of rapid development and cost effecitve, small footprint hardware. I need a 3D printer in my life I think... it would complete me
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Apr 2016 08:46
Quote: "Here the poster is insulting and name calling but I am being disrespectful. Unbelievable
And again moderators do nothing. Unbelievable "


It is in the hope that 2 respected and long-term members of the community with a decent track record will get back on track. Noobs would have been slapped and the thread locked (on both sides). There is a good discussion to be had here, let's keep it on track.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Apr 2016 09:29
Quote: "What im asking is why more basic commands could not be added in."

TGC wouldn't pay him to add them. They didn't have the money to add these features, even though they're probably ready to 'drop in.' It's also the reason the 3D physics commands don't have examples, TGC didn't pay for them.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Apr 2016 14:05
This thread is clearly not going to get back on track. Please start a new thread if you want to continue without losing focus on the AppGameKit challenge.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-11-25 08:02:14
Your offset time is: 2024-11-25 08:02:14