Reboot comp: WestisBest

Started by 3DzForMe, May 07, 2020, 22:17:10

Previous topic - Next topic

iWasAdam

QuoteThales' theorem
never heard of it

Quotesin = 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:
xdiff = float(x1-x0) / 1
ydiff = float(y1-y0) / 1

therefore any position on the line can be found by:
pos = 0..1
xpos = x0 + xdiff * pos
ypos = 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...
height = 30
curve = sin( pi / pos ) * height

just adding this to ypos will give the curve applied to any line:
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

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 :D. 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

#32
@Derron & iWasAdam...

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!!!!!
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

Steve Elliott

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.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

3DzForMe

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 ;D
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

3DzForMe

Oh.... By the way this title really needs changing to Reboot {missed}, don't want to end up winning with a non-entre.  ???
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

3DzForMe

Grenades collision detection now works on the AI P2 dood, doesn't make him deed yet though!
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

3DzForMe

Bang appears....Note to self - Sprite hierarchy can result in Sprites being 'hidden' behind other sprites.....
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

3DzForMe

BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

3DzForMe

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.
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

3DzForMe

#40
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  :o

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.
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

Qube

Congratulations :) Good to hear you kept tapping away until it was working 8) - As the Borg would say.. "Persistence is not futile" or was it "resistance is futile"? huh, can never remember these days.

QuoteThe last competition hasn't finished yet has it  :o
No no, you keep coding on there, plenty of time yet ;D
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

3DzForMe

Quote.    :) Good to hear you kept tapping away until it was working 8) - 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.  :D
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1