|
Shalinor posted:What you're doing is like trying to learn English by reading the dictionary. This is how I started.
|
# ? Jun 16, 2017 15:36 |
|
|
# ? May 25, 2024 12:52 |
|
I can help a little bit with the polynomials. A polynomial (literally multiple numbers) is most commonly used to define a special type of curve on a graph. The simplest kind is a binomial: y = 2x+c where X and Y are coordinates and c is some constant (literally, you can just make one up. Like 65 or -5.3 or pi or the square root of 2). Throw it in Wolfram Alpha to give it a try. All polynomials follow a standard format, which is: y = c1*xn+c2*xn-1+...+cm*x1+cm+1*x0 Let's break that down. Basically, you have a bunch of x raised to some power and multiplied by some constant and you add all those together. For example: 4x3+7.3x2-2x+5 Then you just plug your x coordinate in and that gives you the y coordinate for that point on the curve. Higher order polynomials means you just have more groups of this (ie X is raised to a higher power in the first group). Splines are just multiple polynomial curves attached to each other at the ends so play around with polynomials a lot before trying to grasp them and it will help. KillHour fucked around with this message at 16:02 on Jun 16, 2017 |
# ? Jun 16, 2017 15:57 |
|
To be fair, being recited a dictionary does essentially describe the quality of my primary school math education. I'm taking a step back and finding better instructions on the subject matter, though. I get stubbornly fixated when I get frustrated, which is sometimes helpful, very often not. I know what derivatives are, now, at least! Kind of important thing to know, when it comes to describing change at a point. KillHour posted:stuff Thank you. It helps clear up a fundamental misunderstanding I was having over what a MathNet spline is; I kept wanting it to be a thing I could just feed some points and get back a thing I could get a bunch of points out of, but I suppose I'll need to implement some of that myself.
|
# ? Jun 16, 2017 16:13 |
|
I think you are looking for 'spline interpolation' as the thing that you give points and it gives you back a spline approximating your points.
|
# ? Jun 16, 2017 16:17 |
|
taqueso posted:I think you are looking for 'spline interpolation' as the thing that you give points and it gives you back a spline approximating your points. Yeah, the issue with the interpolate method I was having was that I didn't really get that you had to do some transformations and/or breakdown a thing over multiple splines? or something like that, to map out the curvy line and derive a series of appropriate points to draw. Since the issue came up where, for instance, I had it wanted the river to pass through points at, say, (20 0), then go to (30 20), but go "back" to (19, 40) or something, which didn't really work out trying to interpolate with the MathNet methods, since you could only give it an X value and it assumed that all the points you gave it were ordered in a particular fashion that would make sense on a line graph, so I was giving it data that it was just turning into absolute garbage and/or something very different from what I expected. So that confused me and made me think I was looking for something else. I did other things wrong, too, mind you. I kind of hit a point where I was just doing random poo poo and seeing if any patterns started to emerge. (nope)
|
# ? Jun 16, 2017 16:31 |
You should look into Hermite splines.
|
|
# ? Jun 16, 2017 16:32 |
|
Tiler Kiwi posted:To be fair, being recited a dictionary does essentially describe the quality of my primary school math education. Anything calculus (i.e. derivitives) is going to use polynomials as its basis, and therefore pretty much all of physics will as well. So I really suggest learning polynomials and factoring and algebra like the back of your hand. It will help you with everything.
|
# ? Jun 16, 2017 17:10 |
|
Tiler Kiwi posted:I kept wanting it to be a thing I could just feed some points and get back a thing I could get a bunch of points out of, but I suppose I'll need to implement some of that myself. I did this for a tower defense game I made where I wanted the units to smoothly follow a bunch of waypoints. Instead of trying to find a mathematical curve that best fit the points through some kind of regression, I just gave each waypoint a position and marched from one to the next using this: code:
https://docs.unity3d.com/ScriptReference/Quaternion.Lerp.html Stepping through this gives a very "river-like" path where the units will always pass exactly through each waypoint without making any abrupt turns. The green circles are waypoints and the red line is the path units take following them. Edit: I removed all but 5 waypoints and moved them around to show you don't need a ton of points to get something smooth and river-like. KillHour fucked around with this message at 18:53 on Jun 16, 2017 |
# ? Jun 16, 2017 18:35 |
|
Well, I can strike "sensors and the ability to detect nearby objects" off my list. https://www.youtube.com/watch?v=Yxua-wFnOZA Next up is probably some sort of resource collection. Most likely starting with figuring out how I'm going to handle inventory and moving objects around. Edit: And a bonus one of several flying in formation. https://www.youtube.com/watch?v=EMLAUdO3Ix4 KillHour fucked around with this message at 05:02 on Jun 17, 2017 |
# ? Jun 17, 2017 04:06 |
|
I spend a lot of time tweaking parameters. Is there any hardware out there for doing that? Like just a bunch of knobs and sliders which connect over USB that I can read like a game controller? I know there are musical instruments that can work like this, but I don't know how to interface with them.
|
# ? Jun 18, 2017 18:33 |
|
I made a click/drag slider thing for music/sfx volume and I use temporary sliders for tweaking values!
|
# ? Jun 18, 2017 18:41 |
|
I use antimicro to convert my game controller to keyboard/mouse signals. I'd be pretty surprised if a modern controller didn't have enough nobs to suit parameter tweaking. If it isn't enough, you could also just make a couple buttons context-switches that point the inputs at different parameters. There's also a whole bunch of machine learning algorithms that can pick the best parameters if you're capable of mathematically defining what you want the output to be like!
|
# ? Jun 18, 2017 18:50 |
|
Spatial posted:I spend a lot of time tweaking parameters. Is there any hardware out there for doing that? Like just a bunch of knobs and sliders which connect over USB that I can read like a game controller? I saw this post and it got me pretty excited, developing games and playing with music hardware are two of my big passions, and I spend a lot of time thinking about mixing and matching, and sometimes actually doing so. There are all sorts of cool USB devices you could use to accomplish this. I don't know what your price range is, but some competent devices start at $60 and go up from there. See Nano Kontrol Studio, Akai's pad controllers, Behringer's BCR2000, Novation's controllers, and many more. The downside to most of these is they aren't motorized or they don't have a good memory system, so you can't initialize the knob positions based on game data. The one that I am pretty sure supports that is the Behringer line, the rotaries handle it with the LEDs around the knobs, so you can initialize it with game data when you connect. There are also some other Behringer devices with motorized faders, so you can initialize those correctly, too. When it comes to implementing the interface into your technology to talk to them, some of the controller manufactures make specific libraries to simplify interaction. Sometimes you'll find user made APIs. In most cases, a USB MIDI device shows up to Windows as a standard MIDI device, so you can grab nearly any MIDI API and wire things up for your controller. If you want to hand build something yourself, you can start with one or more Arduino or Rasberry Pi devices. On Windows, you can communicate over the COM ports to talk to these devices. A few months ago I wanted to control a game with my modular synthesizer, so I built this rats nest of a device to use Arduinos to communicate over USB with my PC, and then I could control the game with my modular synthesizer. Chainclaw fucked around with this message at 19:23 on Jun 18, 2017 |
# ? Jun 18, 2017 19:20 |
|
The problem with game controllers is they only have relative analogue inputs. I want to connect a knob/slider to some floating point value and see what happens when I twiddle it. It's no good if it moves back when I let go of the control, and relative input is too imprecise and fiddly. Ideally I want absolute scale and value input. Thanks for the great post Chainclaw. Glad to meet another game/music tinkerer! I was actually just looking at the NanoKontrol 2, my local music store stocks it. Seems that someone already went and did the needful with a C++ library for it which is awesome, so I might go with that. Only downside is the lack of a free-rotating encoder wheel like the Studio version has. Budget is maybe $120. If I start forming a collection like I see in your pictures my girlfriend will stuff me down the drain pipe.
|
# ? Jun 18, 2017 20:11 |
|
Spatial posted:The problem with game controllers is they only have relative analogue inputs. I want to connect a knob/slider to some floating point value and see what happens when I twiddle it. It's no good if it moves back when I let go of the control, and relative input is too imprecise and fiddly. Ideally I want absolute scale and value input. You know, this is a pretty good idea. I think you want a mixing console, with sliders and the like.
|
# ? Jun 19, 2017 06:01 |
|
Tiler Kiwi posted:I did other things wrong, too, mind you. I kind of hit a point where I was just doing random poo poo and seeing if any patterns started to emerge. (nope) Five minute idea because i hate math: Generate several (5+) valid straight line rivers, find the intersection points of all lines and turn them into a bunch of segments between each intersection, sorted/bucketed by their endpoints. Reserve two segments that are far apart and reach the edge of the map or other endpoints you desire. Delete any segments that have only one endpoint shared with another segment (except the reserved), delete any segments where both endpoints are shared with more than one other segment, then delete any segments where either point has more than one other segment. Should now have a chain of segments from one edge of the map to the other. Should be really chaotic with a lot of starting lines, but as long as all of the starting lines are valid, the segments will be too. Generate your river tiles based on manhattan distance from any segment? Edit: Realized you may have to randomize the order of deletions, but another option is to check for the largest (sum of?) angles. Ranzear fucked around with this message at 06:57 on Jun 19, 2017 |
# ? Jun 19, 2017 06:37 |
|
Ranzear posted:Five minute idea because i hate math: Generate several (5+) valid straight line rivers, find the intersection points of all lines and turn them into a bunch of segments between each intersection, sorted/bucketed by their endpoints. Reserve two segments that are far apart and reach the edge of the map or other endpoints you desire. Delete any segments that have only one endpoint shared with another segment (except the reserved), delete any segments where both endpoints are shared with more than one other segment, then delete any segments where either point has more than one other segment. Should now have a chain of segments from one edge of the map to the other. Should be really chaotic with a lot of starting lines, but as long as all of the starting lines are valid, the segments will be too. I got the river drawn in a "good enough" state right now: Draw a line between two points. If that fails, find a point both points can draw a line to, then tentatively draw a line, then get two new points by doing a t=.75 lerp on those lines, then draw a line from start to lerpa, lerpa to lerpb (doing some recursion if the lerp points don't connect), then lerpb to end, and as a final failsafe if poo poo doesn't work, just do pathfinding. Makes the rivers smooth enough, but the true Evil Problem turned out to be coming up with procedurally generated points to draw between. The "intersections between straight lines" concept you mentioned, to get a set of points to draw between would actually, maybe, probably work out alright for doing that! I'll give that a shot later.
|
# ? Jun 19, 2017 07:18 |
|
It was originally a pathfinding idea: Draw random lines, cut or pre-segment any that cross impassible space, chain segments between here and the destination, and plug the (nearest few) intersections into something like Caliber's vector shenanigans. I think it'd be fast enough for the simple on-the-fly indirect navigation I need. Quick and dirty immediate direction decision instead of deep pathfinding.
Ranzear fucked around with this message at 07:57 on Jun 19, 2017 |
# ? Jun 19, 2017 07:39 |
|
There's a lot of ways of interpolating things in 2D, since you've found one that's good enough for what you're doing I guess this is more a future reading thing. If you just have a set of points and want a smooth curve that goes through all of them, no tweakable control points outside of the shape itself or any of that, then maybe Catmull-Rom splines are for you. They work like this and look like this. The four control points you feed (p1, p2, p3 and p4 on that page) are a sequence of points on your river, and the resulting function p(x) is a smooth cubic curve that interpolates between points p2 and p3. Repeat for all segments, shifting your control points every time. It's probably the simplest cubic spline to work with. E: Also, Ed Catmull is a cool guy who made what's possibly the first 3D CG animation (of his own hand) and (much) later ended up president of Pixar & Disney Animation. Clearly this means his splines (and also his subdivision surfaces) must be extra good. Xerophyte fucked around with this message at 08:07 on Jun 19, 2017 |
# ? Jun 19, 2017 07:59 |
|
Thanks for that information. I may give that intersection point generation + Catmull-Rom splines a shot... later. Right now my prototype procedural generation code is some horrible 1200 line string-of-consciousness class I've been thrashing together with zero real planning, and I've gotten a bit sick of playing around with it. Not to say writing it isn't fun, its just, I'm just sort of in awe how badly I underestimated the difficulty involved in drawing a friggin curve: I spoke with a relative who does programming and mentioned "oh yeah im trying to procedurally generate a curve" and he gave me sort of a look and expressed sympathy, so I guess this is a bit of a rite of passage. Its all making a lot more sense than when I started with it, though, thanks in part to everyone in here being super helpful. coming together a bit. need to write the logic for placing the actors, selecting them, issuing a command, getting valid movement spaces, selecting a space, moving the actor, and tracking overall turn state and win condition. and some actual UI, maybe. easy-peasy, i'm sure. e: vvv Thank you! Tiler Kiwi fucked around with this message at 12:15 on Jun 19, 2017 |
# ? Jun 19, 2017 11:24 |
|
Tiler Kiwi posted:Thanks for that information. I may give that intersection point generation + Catmull-Rom splines a shot... later. Right now my prototype procedural generation code is some horrible 1200 line string-of-consciousness class I've been thrashing together with zero real planning, and I've gotten a bit sick of playing around with it. Not to say writing it isn't fun, its just, I'm just sort of in awe how badly I underestimated the difficulty involved in drawing a friggin curve: I spoke with a relative who does programming and mentioned "oh yeah im trying to procedurally generate a curve" and he gave me sort of a look and expressed sympathy, so I guess this is a bit of a rite of passage. Its all making a lot more sense than when I started with it, though, thanks in part to everyone in here being super helpful. If you decide to revisit the spline approach and use C#, this library is pretty straightforward imho (and can be used in commercial applications). Check out the "input constraints and parametric fitting" header - you don't want to be limited to only valid functions of y = f(x) See the CubicSpline.FitGeometric static method below, which fills xOut and yOut with 100 floats each. m_nodes is where my input control points are. code:
|
# ? Jun 19, 2017 12:10 |
|
Mr Shiny Pants posted:You know, this is a pretty good idea. I think you want a mixing console, with sliders and the like. I'll be twiddling away soon, I can see the input values live in the console already. Just need to fix up the library to be 64-bit safe and I'm good to go.
|
# ? Jun 19, 2017 19:12 |
|
I've gotta say, this works awesomely and I wish I did it years ago. At the moment I'm doing a liquid surface simulation and now I can control all the parameters with knobs and faders. I'm going to get a hell of a lot of use out of this baby. For anyone who goes down the same path: the Korg supplied driver doesn't work in 64-bit mode. How embarrassing. But the default Windows driver works fine.
|
# ? Jun 19, 2017 23:57 |
|
Spatial posted:I've gotta say, this works awesomely and I wish I did it years ago. At the moment I'm doing a liquid surface simulation and now I can control all the parameters with knobs and faders. I'm going to get a hell of a lot of use out of this baby. A lot of music stuff is still in 32 bit land. I don't know if it's a compatibility thing where no one wants to be one of few 64 bit outliers, or if it's performance focused and they don't want to deal with the performance trade-offs of moving to 64 bit from 32 bit. Besides the obvious access to more memory, there's a lot of conflicting info out there about faster CPU performance versus memory bandwidth and consumption concerns due to larger pointer sizes.
|
# ? Jun 20, 2017 03:18 |
|
So I've just been messing around in Unity using C# with a match-3 style game. I can move tiles around similar to how puzzles and dragons does it and even make matches but I'm curious if anyone has an idea how to elegantly handle the type of match in this http://imgur.com/a/vt8DP image? I would like all the yellow tiles to count as one match.
|
# ? Jun 20, 2017 05:40 |
|
RobotsLoveSpectres posted:So I've just been messing around in Unity using C# with a match-3 style game. I can move tiles around similar to how puzzles and dragons does it and even make matches but I'm curious if anyone has an idea how to elegantly handle the type of match in this http://imgur.com/a/vt8DP image? I would like all the yellow tiles to count as one match. Sounds like a job for flood filling?
|
# ? Jun 20, 2017 08:22 |
|
crab avatar posted:Sounds like a job for flood filling? Pretty much this.
|
# ? Jun 20, 2017 11:37 |
|
crab avatar posted:Sounds like a job for flood filling? The simple way is to just do whatever you're already doing to find existing matches, but don't remove anything until you've found *all* matches, then disappear them all in one instant. Edit: if part of the goal is to know how big the disappeared connected set of single color is then flood-fill is still relevant for that though, you could flood fill the intersections of disappearing tiles and same-colored tiles.
|
# ? Jun 20, 2017 14:37 |
|
Find all individual matches on the board (longest priority, ie if it's 6 long it's one six-match and not two 3-matches) and keep those around in an array of matches. Then find all the matches that share any cells with eachother and keep those around in some array of shared matches (each element being a list of matches that are "one match", all connected). You should end up with what you want. No flood fill is needed since they'll always share one cell. e: Unless XXX XXX or __XXX XXX__ Counts as one match (instead of two 3-matches) in which case check if any other tile from a match is of the same color and adjacent rather than looking for shared cells. Both of these methods only ever check other matches and not the global board so there shouldn't be any accidental spillages into non-matches. Jewel fucked around with this message at 14:56 on Jun 20, 2017 |
# ? Jun 20, 2017 14:54 |
|
I guess you'd just iterate over the field twice, once vertically and once horizontally. If you find a long enough line, create a matching and mark the tiles as being in that matching. If you mark the same tile twice, merge the two matchings.
|
# ? Jun 20, 2017 14:56 |
|
Chainclaw posted:A lot of music stuff is still in 32 bit land. I don't know if it's a compatibility thing where no one wants to be one of few 64 bit outliers, or if it's performance focused and they don't want to deal with the performance trade-offs of moving to 64 bit from 32 bit. Besides the obvious access to more memory, there's a lot of conflicting info out there about faster CPU performance versus memory bandwidth and consumption concerns due to larger pointer sizes. Back to the original subject, is there a way to read the state of a MIDI device without physically moving the controls? I'd like to sync the initial values with my game on startup. Also it seems like you can control the LEDs somehow which is quite cool... Any idea how that works? For the fader/knob memory problem you mentioned earlier, I used the same solution as used on the MicroKorg, which is to ignore control input until it matches the current value. That way there are no sudden jumps.
|
# ? Jun 20, 2017 19:10 |
|
Different topic. Has anyone here got an Xbone controller? Does it work the same as the 360 and show up as an Xinput device? Also lol Sony why have you named your controller "Wireless Controller". At least put PS4 in the drat name.
|
# ? Jun 20, 2017 19:11 |
|
Spatial posted:Different topic. Has anyone here got an Xbone controller? Does it work the same as the 360 and show up as an Xinput device? Yes.
|
# ? Jun 20, 2017 19:16 |
|
Cool, thanks.
|
# ? Jun 20, 2017 19:24 |
|
The Fool posted:Yes.
|
# ? Jun 20, 2017 20:08 |
|
Spatial posted:Also lol Sony why have you named your controller "Wireless Controller". At least put PS4 in the drat name. I'm not sure they did? Its not that simple as plug in device, device tells windows what it is. Windows is probably using a generic game controller driver, hence the generic name "Wireless Controller" Which is also why PS4 controllers don't work with most games by default. If you run DS4Windows it makes the PS4 appear as an Xbox 360 controller to all games, so it has perfect compatibility. Its a driver thing, not a hardware thing. As for why there aren't better first party drivers for PC for PS4 controllers... Microsoft is Sony's competition. They'd rather you just play on PS4.
|
# ? Jun 20, 2017 20:11 |
|
Shalinor posted:... with the exception, IIRC, that XBone vs 360 controllers as XInput devices have a different button mapping. That is, I want to say the face buttons don't map to the same XInput buttons / that you'll have to have a different default binding for each. Or something with the stick VS trigger axis, maybe? I recall there being some unexpected difference. My only experience is with a b-hell shooter toy that I made, and my 360 and xbone controllers worked interchangeably. That being said, I only used the face buttons and d-pad. fe: after a quick google, https://github.com/glfw/glfw/issues/700 implies that there was/is an issue with r-stick and the triggers having the axis swapped.
|
# ? Jun 20, 2017 20:15 |
|
Shalinor posted:... with the exception, IIRC, that XBone vs 360 controllers as XInput devices have a different button mapping. That is, I want to say the face buttons don't map to the same XInput buttons / that you'll have to have a different default binding for each. Or something with the stick VS trigger axis, maybe? I recall there being some unexpected difference. Zaphod42 posted:I'm not sure they did? Its not that simple as plug in device, device tells windows what it is. Windows is probably using a generic game controller driver, hence the generic name "Wireless Controller" The PS4 pad not working with most modern games you can chalk up to developer apathy. The 360 controller supports Xinput which is baby simple to use and a lot of people own them so it's an obvious first step. All controllers support DirectInput, but it's a huge pain in the rear end to use without a library. Speaking from experience though, there are good libraries out there and if you plan from the beginning to support any controller it's only a couple of extra days work to support the PS4 pad with onscreen prompts and everything. Also, while I'm complaining about controllers: while the PS4 controller doesn't have the 360's design flaw of one axis for both triggers, it does have the minor flaw of having both buttons AND axes for the triggers. So any typical binding detection system is going to see the button press first and take away the analogue functionality. Some motherfuckers are always trying to iceskate uphill
|
# ? Jun 20, 2017 21:36 |
|
Does anyone know how you'd approach doing the effect where there's a handful of particles or objects spawned and then after a beat they all sort of gather up and arc over to a destination in a satisfying way? I guess I'm thinking like some games where you collect things they have those money animations as they zoom to your inventory or count of total stars or w/e. I'm thinking there maybe is a name for this? Or a common way to do it? I can spawn a bunch of stuff and lerp it over to a destination but that's going to look poo poo I feel like.
|
# ? Jun 21, 2017 13:16 |
|
|
# ? May 25, 2024 12:52 |
|
Lerp it over a spline. Or if you just mean an actual arc, maybe just have its origin at the centre of the circle of the arc and slerp it?
|
# ? Jun 21, 2017 13:43 |