[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/agdg/ - Amateur Game Development General

AGDG - The Board

Catalog

8chan Bitcoin address: 1NpQaXqmCBji6gfX8UgaQEmEstvVY7U32C
The next generation of Infinity is here (discussion) (contribute)
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Oekaki
Show oekaki applet
(replaces files and can be used instead)
Options
dicesidesmodifier
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, swf, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 5 per post.


Welcome to AGDG, have you ever made a game?
See also: /ideaguy/ | /vm/

File: 1439859749617-0.jpg (114.56 KB, 640x480, 4:3, bullet1.jpg)

File: 1439859749618-1.png (861.24 KB, 1024x768, 4:3, bullet2.png)

File: 1439859749618-2.jpg (91.68 KB, 641x481, 641:481, bullet3.jpg)

3b94d5 No.21004

Where would be the first place to look if I wanted to learn the math behind making Touhou and other shooting game style bullet patterns?

I've tried googling the subject and I've gotten some helpful results as to what to use to make the patterns (bullet libraries, vague mentions of trigonometry and polar co-ordinates), but nothing that really explains what the hell I'm supposed to look at. I've honestly never touched trig after my required courses, so I'm rusty to the point of not remembering anything.

I've found a library called BulletML which looks absolutely amazing, but I'm not very math inclined in the first place. I'd like to learn more about how these things actually work rather than just punching in random things and calling it a day.

Would anyone know of any good math websites that cover making patterns using trig or something that I could look over?

8e60d5 No.21007

>>21004

I barely understand it as it is, but your main uses of trig will be atan2(Y,X) to convert points to angles, and X,Y = cos(angle), sin(angle) to turn angles into points.

Fair warning: Too much of this can lead to weirdness.


e277a4 No.21023

>>21004

Trigonometry is simply a way to find angles given two positions. The bullet patterns themselves generally don't use math, just simple timing and angles.

If you make an emitter move forward and constantly add an angle, it moves in a circle. If you have it send bullets towards the middle of that circle (own angle +90 or -90 depending on clockwise or counterclockwise) you get sort of a spiral. If the bullets move back after a certain distance, you get a different pattern. I think that may give results like your first picture, not 100% sure.

For the most part, the actual patterns are done with logic like that. Moving emitters, or just emitting bullets in sequence at angles. Trigonometry is used when you want to aim bullets at the player for instance, a variable location. For some patterns you might want to make an invisible emitter moving along some path, and shoot at that, but usually it's the player.

>>21007

>to convert points to angles

Do not think of it as points to angles, thing of it as distances to angles. My position is [1,3] and another object is at [4.7], the distance between us is 3 on the x scale and 4 on the y scale. atan2( 4,3 ) gives the angle I'd have to move in to move to that object.

>Fair warning: Too much of this can lead to weirdness.

A bigger problem is too much of it can lead to massive slowdown. Trigonometry functions are relatively slow for computers, so you don't want to do 5 million sin() computations per frame.


61fb3b No.21110

>>21004

I'm noob but I would assume the trajectory (rotation of the barrel) is in a direction. Add delta x/y in that direction after spawning it.

actually Imma stop trying to explain they have done it well.

>>21023


f555c1 No.21114

>>21004

You could model those patterns with equations but they would be too complicated and it's just no necessary. What you are seeing are certain bullet patters repeated though out the screen, each individual pattern can be made with a simple algorithm. For example: fire+(10°), fire+(20°), ... , fire+(360°), each of those instances separated by a .10 second interval should give you the spiral patterns in the picture.


3b94d5 No.21138

OP here.

I was assuming it was some complex mathematical bullshit, but if all I need to do is fake the math by translating objects at different speeds from different places at different time frames, that's good enough for me.

I figure there's an actual, proper way of doing it, but it does seem like a lot more effort.


b29623 No.21147

>>21138

The 'proper' way to do is to program a tool like BulletML so you don't spend a ton of time creating these repetitive processes and you can create much more complex patterns with ease.

I have plans to, as XML output isn't useful for my case, but only after my current project. Someone else is likely much more qualified to do it over me (oh, like Kenta Cho) so don't look forward to what I'm up to. Try to make one yourself.




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]