September 29, 2020, 02:11:20 PM

Author Topic: Reboot comp: WestisBest  (Read 1866 times)

• Hero Member
• Posts: 1911
Re: Reboot comp: WestisBest
« Reply #30 on: May 24, 2020, 11:30:50 AM »
Quote
Thales' theorem
never heard of it

Quote
sin = opposite/hypothenuse
(to quote Ultravox) This means nothing to me...

My math skills are very basic +-/* and sin/cos/atan, plus I know bitwise stuff inside out. I have a mental issue where I can't mentally work in equations or formulae - it all looks gibberish to me. But put me in front of a picture or pure code and I can come up all sorts of wierd stuff...

I've found that sin/cos/atan2/pi seem to form the backbone of almost all computer graphics stuff. Everything else you can fake with a little knowhow.

Even vectors I have to break down into their simple parts and work on them that way. I could tell you what DOT or how matrix works.

gone off topic now.

OK. on topic:

for any line x0,y0,x1,y1
the difference can be found by:
Code: [Select]
`xdiff = float(x1-x0) / 1ydiff = float(y1-y0) / 1`therefore any position on the line can be found by:
Code: [Select]
`pos = 0..1xpos = x0 + xdiff * posypos = y0 + ydiff * pos`lets assume we now want to add the sin (and let the Talons of Weng Chiang shred your flesh) <- got carried away again...
Code: [Select]
`height = 30curve = sin( pi / pos ) * height`just adding this to ypos will give the curve applied to any line:
Code: [Select]
`ypos += curve`Or something very much like it

Very simple math, no complex 'triangles with bowls law and added bresnal filtering', no formulae, just the simple code \o/

Derron

• Hero Member
• Posts: 3185
Re: Reboot comp: WestisBest
« Reply #31 on: May 24, 2020, 12:01:19 PM »
At the end your formula is doing the same which I suggested. I just added a multiplier to decrease the strength of the curve.
Your formula should only be used when doing a side-view.

By lowering the impact of the sin() (sin(x) * max * modifier) you can "fake" viewing it from a different angle. Assume 90° (top view) you end with "y :+ sin(whatever) * maxHeight * 0" (so nothing is added) and with 0° (side view) you use "y :+ sin(whatever) * maxHeight * 1.0".

Nonetheless: in most "standard cases" you just use the formula of the "throw" and use a individual throwing angle which then - together with initial velocity ("strength of throwing") you calculate where it lands.
Of course you could now reverse the formula to have a given landing spot and with a fixed throwing angle calculate the initial speed (and velocity).

@ Thales theorem
Ok, not so important in this particular case here . I mixed it up with "Geometric mean theorem" (which is in German "Euklids Höhensatz" - height theorem of Euclid). As this is one of the 3 theorems about right angled triangles - in which you can split many many 3d problems. As you (iWasAdam) wrote: a bit of sin, tan ... and there you go.

bye
Ron

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #32 on: May 24, 2020, 09:52:59 PM »

Yep, my initial thoughts were - right, I need to use trig to do this parabola magic.

turns out you don't with AGK.

Here we go.... Video attached - AGK has built in physics.

Note to self though - I'm shit at coding.

Spent about an hour trying to fathom why the hell the physics wasn't working....

Turns out the physics isn't a VECTOR thing in AGk (i.e. apply physics and watch it go......)

You need to keep applying the force every iteration of the do / while loop. DOH!

Oh well, I'm done for tonight.  Spent AGES trying to fathom if it was somewhere in my fog of an array
of grenadas causing the problem. Nope - just a lack of understanding I needed to prod the sprite
with the 'force' every iteration of the loop.

Yep, Wind is an idea - but for now, I'm just glad to have a parabolic grenade!!!!!

Steve Elliott

• Hero Member
• Posts: 2781
• elgol 2021
Re: Reboot comp: WestisBest
« Reply #33 on: May 24, 2020, 10:56:47 PM »
AGK is really good, runs on all systems, but I tend to stay away from some of the extra built-in features whenever possible and write my own code - I just use the core.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Catalina, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 3 and 4

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #34 on: May 31, 2020, 02:30:59 PM »
Cheers Steve, 2-gun Tex now has 3 out a 6 of his grenades flying.... Might make them proximity grenades, nah, that could be the claymores for level 4

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #35 on: May 31, 2020, 02:33:18 PM »
Oh.... By the way this title really needs changing to Reboot {missed}, don't want to end up winning with a non-entre.

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #36 on: June 04, 2020, 08:32:55 PM »
Grenades collision detection now works on the AI P2 dood, doesn't make him deed yet though!

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #37 on: July 10, 2020, 05:27:20 PM »
Bang appears....Note to self - Sprite hierarchy can result in Sprites being 'hidden' behind other sprites.....

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #38 on: July 10, 2020, 05:34:19 PM »

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #39 on: July 25, 2020, 06:48:18 AM »
Ah so much progress this morning, P1's first gun's bullets (Well he is 2 gun-tex after all...) now... wait for it..... actual come out of the nozzle of the gun.

And, P1's grenade, when it goes bang, has an advers affect on P2's life force.  I know, at this rate it'll be ready for Christmas release... then I'll have to change the sand snowy.... Yes, two gun Tex may have to survive the seasons, like Forza Horizons 2 (if  I got the number right, theres so many damn releases of that now).

Gimme Project Cars 2 with its B******D hard F1 races.

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #40 on: July 25, 2020, 09:13:09 PM »
OMG, OMG, my reload function is working.  Now.... just need to get the supply wagon to drop off re-supply crates at appropriate times per level.

The last competition hasn't finished yet has it

My little joke.  Loving a bit of coding fun .....

I'm inclined to go for a 'life bar' as opposed to 'lives'.  The SLR went out of service because it was too good at reducing life force.  Inclined to work different revolvers into 2 gun tex's arsenal.

Qube

• Hero Member
• Posts: 2522
• I mostly code at night... Mostly.
Re: Reboot comp: WestisBest
« Reply #41 on: July 26, 2020, 02:03:16 AM »
Congratulations Good to hear you kept tapping away until it was working - As the Borg would say.. "Persistence is not futile" or was it "resistance is futile"? huh, can never remember these days.

Quote
The last competition hasn't finished yet has it
No no, you keep coding on there, plenty of time yet
Mac mini ( 2018 / 2020 ), 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4, 1TB NVMe, eGPU Radeon Pro 580 8 GB, LG Ultragear 27GL83A-B 27 Inch
Commodore VIC-20, 1.1Mhz MOS 6502 CPU, 5KB RAM, VIC ( 6560 ) GPU

Until the next time...

3DzForMe

• Hero Member
• Posts: 1109
Re: Reboot comp: WestisBest
« Reply #42 on: August 29, 2020, 09:58:42 AM »
Quote
.    Good to hear you kept tapping away until it was working - As the Borg would say.. "Persistence is not futile" or was it "resistance is futile"?

I think it was the latter. First guns bullets stop, rather than going straight thru P2, WestIsBest creeps ever forwards.