Author Topic: Math Skills?  (Read 4304 times)

Imosa

  • Any sufficiently advanced technology
  • is indistinguishable from magic
Math Skills?
« on: June 03, 2013, 05:01:18 PM »
So from reading over this thread, and from generally looking around here, it seems that math is something of an issue here, and I was wondering, exactly what kind of math skill are needed in making a Danmaku game? I recently had an idea for a bullet pattern which I thought was pretty creative and it didn't require much math in comparison to what I'm comfortable with. So can someone give me an idea of what is being dealt with here? Give me an example problem or something.

Matteo

Re: Math Skills?
« Reply #1 on: June 03, 2013, 05:23:48 PM »
Example number 1 :

I have 6 points that make an exagon , how can i create lasers segments from these points that connects creating a exagon-pattern made of lasers? And if i want to expand the exagon?

This require math, because you need to know geometry very well in order to angle right the laser segments and put them in the right places. (That's why i can't do sanae stars...damn).

Example number 2 :

Imperishable-shot like bullets. I want to create bullet patterns with a certain geometry. How? Don't know...

Example number 3:

I want to create a laser (straight) composed of different segments that behave as a whole but that at certain frames each segment do different things ( moves, delete, spawn bullets...)

Example number 4:

Danmaku chimera !!! How is it done? How much math is inside that???

Same for ALL the Nue survival spell

Imosa

  • Any sufficiently advanced technology
  • is indistinguishable from magic
Re: Math Skills?
« Reply #2 on: June 03, 2013, 06:22:55 PM »
Example 1:
Does this suffice for example 1 at least for creating the laser?
Code: [Select]
Points ax, ay, bx, by
CreateStraightLaserA1(ax, ay, atan2(bx-ax, by-ay), sqrt((bx-ax)^2+(by-ay)^2), width, delete time, graphic, delay)

Example 2: I don't know what you're talking about, and I've played Imparishable Night.

Example 3: That sounds like an issue with danmakufu, not something with math.

Example 4: Alright, from watching this spell card I think I can see where the problems lie, although they are programming issues, not math issues.

I have no name

  • Dodge ALL the bullets
Re: Math Skills?
« Reply #3 on: June 03, 2013, 06:51:33 PM »
Example number 1 :
I have 6 points that make an exagon , how can i create lasers segments from these points that connects creating a exagon-pattern made of lasers? And if i want to expand the exagon?

This require math, because you need to know geometry very well in order to angle right the laser segments and put them in the right places. (That's why i can't do sanae stars...damn).
Trigonometry, you do stuff with sin/cos (I don't remember exactly what, but it's not hard to look up and it's fun to mess with, the results when it's wrong can be hilarious) and set them at a certain angle (60 degrees off from a the angle from point edge to point center).  I use the value "a" for the radius and the angle is just (((n-2)*180)/n)/2 where n is the number of sides.  So for 6 that comes out to 4*180=720, 720/6=120 (angle of each in an equilateral polygon), 120/2=60 which is the angle from the vertex to the center and an adjacent vertex!
Sanae stars are trickier due to spawning bullets along the lines, though I think I can see how to do it.
Example number 2 :

Imperishable-shot like bullets. I want to create bullet patterns with a certain geometry. How? Don't know...
...assuming you mean Imperishable Shooting, there's a thing called firing a bullet, acceleration, changing at a certain frame (making it go farther out and back in, you can assign the distance with a sin function or just increment it by x each time) and adding some small number (1-2ish) to the angle, and repeating until you fire a full circle.
Example number 3:

I want to create a laser (straight) composed of different segments that behave as a whole but that at certain frames each segment do different things ( moves, delete, spawn bullets...)
Just fire several lasers in the same direction with different behaviors.   Might take a few tries to get the positioning right, but trial and error is how these things end up as a finished project.  ;)
Example number 4:
Danmaku chimera !!! How is it done? How much math is inside that???
Same for ALL the Nue survival spell
Shoots lasers x degrees apart.  Turn them into bullets (object lasers can probably do this is you track the angle the laser is facing).  Have a flag that toggles for every bullet, setting the direction it goes (left/right/left/right).  Give the bullets rotational velocity (utilize the distance from the spawn point here) equal to 1.5 times the angle between lasers.  Every set of lasers is offset from the last by half the angle (Nue moves a bit).  So, math?  Not that much.  Creative solutions? Sure.
The survival is easy-just look at the bullets in a frame by frame video-they all move in a straight line at approximately 30 degrees off of horizontal in the first phase!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Math Skills?
« Reply #4 on: June 03, 2013, 06:53:54 PM »
While I appreciate the help, we have Q&A for that reason, there is no reason to make this a separate thread otherwise we're going to have clusters of threads everywhere. And also people start posting "How to do this in danmakufu" --> Q&A thread post.

I'll leave this a for a moment like this then merge with the Q&A.

For handy functions and other snippets, we have already a designated thread for it.

Imosa

  • Any sufficiently advanced technology
  • is indistinguishable from magic
Re: Math Skills?
« Reply #5 on: June 03, 2013, 07:37:53 PM »
I didn't mean to actually resolve any problems. I just wanted to hear an example (It's not Q&A, its just Q). Yeah, I guess I could have looked through the Q&A thread more. However, I also didn't think this was appropriate in the Q&A thread.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Math Skills?
« Reply #6 on: June 03, 2013, 07:52:27 PM »
Well I am quite confused now.

If you're offering help with the math for people to script their spell cards, it should be asked (and answered) in the sticky threads. Otherwise I am missing something.

I also didn't quite understand why you pointed at my thread and took the math out of there and put it here as a question.

I am confused =S

Imosa

  • Any sufficiently advanced technology
  • is indistinguishable from magic
Re: Math Skills?
« Reply #7 on: June 03, 2013, 08:29:21 PM »
Well I am quite confused now.

If you're offering help with the math for people to script their spell cards, it should be asked (and answered) in the sticky threads. Otherwise I am missing something.

I also didn't quite understand why you pointed at my thread and took the math out of there and put it here as a question.

I am confused =S
I was never offering to help with math. I just wanted to know what kind of math had to be done. I pointed to your thread because when 3 out of 3 people mentioned their math skills, it made me realize that, despite my impression, math problems are apparently a big part in making these bullet patterns, so I wanted to see what these math problems were.

Drake

  • *
Re: Math Skills?
« Reply #8 on: June 04, 2013, 12:19:32 AM »
You're fine. You probably know more math than most scripters here to begin with. Really you don't need any heavy stuff, most math we see in scripting is some fundamental geometry and trigonometry. Complicated 3D backgrounds can require a lot of trig, vertex manipulation for certain 2D graphics can also get pretty messy with manipulating circular graphics and stuff. What's more important than the math itself is how you can keep track of all the math and what it does, and be able to figure out what you want things to do and translate that into the math.

I think most people overestimate how much math needs to go into creating patterns. Besides a basic level of competency, you shouldn't have to require some huge formula to create good patterns. Rather, if you're thinking too much about how to go about creating a pattern that needs lots of math, the pattern probably isn't going to be very good in the first place, as a general rule. Being complex =/> good. Your danmaku design being good is much more important than your script being unintelligibly complicated.

Case in point: Shit I used to do. All of the patterns have some dumb complicated part to it and they're awful in terms of playability, because I took priority of the math over the patterns. From the start it was just a test for me to see if I could implement the mathy patterns so I knew it wasn't good, but it's a perfect example of how not to go about making patterns.
« Last Edit: June 04, 2013, 12:22:13 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Math Skills?
« Reply #9 on: June 04, 2013, 07:23:09 AM »
I see. I got confused by the first three posts making it look to me as if this was Q&A style. But you were just generally curious about the math being applied in danmakufu it self (general discussion style).

Well yes, in that case Drake kind of summed it up already.

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: Math Skills?
« Reply #10 on: June 06, 2013, 04:55:04 PM »
I guess some very basic parametrization (for circles, ellipses, lines and similar) is useful to. Example: The lines in Sanae's stars.
As Drake said, don't make mathematically complex patterns that aren't fun to play (but come on, that Daiyousei script isn't that bad) for the sake of making mathematically complex patterns. I say make maths for the patterns, not patterns for the maths (if that makes any sense to you). That is, come up with the patterns first, then do the maths.
Often, you can use bullet manipulations that don't require much maths (bullets changing speeds, bullets changing angles, bullets spawning more bullets, bullets bouncing off walls, etc.) to improve/vary your patterns instead of using a lot of maths. Of course, this requires some programming skills, but you can make great patterns even with nothing but basic object bullet manipulation.
On the other hand, remember that complex doesn't imply bad either. If you have a mathematically complex pattern that fits the enemy/boss and is fun to dodge, feel free to use it.
Also, simple =/> good and simple =/> bad (here, "simple" covers both mathematical and programming-wise simplicity). Many fairly simple patterns work well, but overly simple patterns, particularly when used by bosses (example: All the boss ever does is firing random rings of 30 blue bullets.), are often considered bland and uninspired.
« Last Edit: June 09, 2013, 02:30:18 PM by Maths ~Angelic Version~ »