roomforthetuna posted:Nothing wrong with that if it looks awesome. The image is from GIS. It's an overhead image of Pripyat, an abandoned Soviet city near Chernobyl. It's not free or creative commons. Copyright.
|
|
# ? Mar 17, 2012 07:35 |
|
|
# ? May 23, 2024 13:12 |
|
Vinterstum posted:Assuming you're making a C++ Android port (This may be a flawed assumption on my part; I know absolutely nothing about android development), I doubt a port would be much more than a few weeks worth of work on the programming side. If you're porting the whole thing to Java though, forget everything I just wrote. Android stuff has to be done in Java, right? No C++?
|
# ? Mar 17, 2012 14:58 |
|
Bob Morales posted:Android stuff has to be done in Java, right? No C++? There are C++ engines that allow you to develop for Android.
|
# ? Mar 17, 2012 15:05 |
|
Android can do native code; however, when using native code, you can't access features like Services and Content Providers, so you will have to write a Java wrapper. Also, only Android 2.3+ supports the ability to handle events such as onCreate(), onPause(), and onResume() via native code. If you want to support Android 2.2 and below, you will also need to write a Java wrapper.
|
# ? Mar 17, 2012 20:24 |
|
I'm trying to sign up for an account at box2d forums and they have the hardest spam-bot protection ever. Here is one of the questions A ball of mass 3 kilograms begins falling with gravity of 10 meters per second squared. How many meters does it fall in 8 seconds?: This question is a means of preventing automated form submissions by spambots. I still haven't been able to register and ask my question
|
# ? Mar 18, 2012 22:20 |
|
Physical posted:I'm trying to sign up for an account at box2d forums and they have the hardest spam-bot protection ever. Here is one of the questions d = (1/2) * g * t^2 d = (1/2) * (10 m/s) * (8s)^2 d = (1/2) * (10 m/s) * 64s d = (1/2) * 640m d = 320m
|
# ? Mar 18, 2012 22:37 |
|
I'm trying to make a sprite move towards the position that I click on on the screen, which is simple enough, but I want to make sure that the sprite can only move forwards in the direction that it's facing (it also rotates to face where I clicked). I can do both of these things seperately, like so: code:
code:
I am absolutely awful at maths so I might be missing something simple. Any ideas?
|
# ? Mar 18, 2012 23:00 |
|
It sounds like you want to keep the 2nd part of your code--move in the direction it's facing--while replacing the first part with a change in rotation. Figure out the 'destination rotation angle', which can be calculated as a function of the current position and the target position (subtract the vectors and use an arctangent or something, if you don't know how to do this I could elaborate). So now you have two angles, the current angle and the destination angle, and you can interpolate between those two every frame. The result will be an arc-like trajectory to where you clicked the mouse. Is this what you were looking for?
|
# ? Mar 18, 2012 23:36 |
|
Orzo posted:It sounds like you want to keep the 2nd part of your code--move in the direction it's facing--while replacing the first part with a change in rotation. Figure out the 'destination rotation angle', which can be calculated as a function of the current position and the target position (subtract the vectors and use an arctangent or something, if you don't know how to do this I could elaborate). So now you have two angles, the current angle and the destination angle, and you can interpolate between those two every frame. The result will be an arc-like trajectory to where you clicked the mouse. This isn't exactly what I'm looking for, unless I'm misunderstanding which is fairly likely! I made an image to try and make myself clearer. The top part is what's happening now. I'll click somewhere and the image will move in a straight line towards it while rotating. The bottom is what I want. If the image is facing left and I click somewhere to the right of it, I want it to have to do a U-turn because it can only travel forwards. Fake edit: While drawing the image and writing this, I've been thinking and I'm pretty sure I can just perform the rotation like normal while applying acceleration in the forward facing direction until x = destinationX or something. I think I was overcomplicating it! Stiggs fucked around with this message at 01:19 on Mar 19, 2012 |
# ? Mar 19, 2012 01:17 |
|
A couple of Unity questions: 1) I'm using the First Person Controller for the player object (which is simulating a boat with an engine), and want to have separate acceleration and deceleration rates for forward movement. That is, going forward will ramp up to MaxGroundAcceleration fairly quickly, but when the forward input is released, the speed will taper off at a slower rate. I've looked at the CharacterMotor and FPSController scripts, which look like they ought to be the right place, but am not quite sure what to change. 2) I have the controls for turn left/right assigned to keys, by redefining the MouseX section of the Input Manager. I turned down the MouseX sensitivity so that holding down the left/right keys will increase the turn speed, but I would also like the turn speed to taper to zero when not turning. Additionally, I only want the player to be able to turn when moving forward (since it's a boat). Where/how can I define this behaviour?
|
# ? Mar 19, 2012 06:36 |
Stiggs posted:Fake edit: While drawing the image and writing this, I've been thinking and I'm pretty sure I can just perform the rotation like normal while applying acceleration in the forward facing direction until x = destinationX or something. I think I was overcomplicating it! This is correct, simply apply thrust while continuing to rotate until you are facing your destination. Just be sure that your acceleration doesn't force you into an eternal orbit around the destination point. Edit: I actually have code for this in two languages (Monkey and AS3) if you need further help. In my code, the actor is continuously following the mouse, but it would be easy to modify it to aim at a single point.
|
|
# ? Mar 19, 2012 09:07 |
|
Centripetal Horse posted:This is correct, simply apply thrust while continuing to rotate until you are facing your destination. Just be sure that your acceleration doesn't force you into an eternal orbit around the destination point. I'd love to take a look at your AS3 code if you don't mind, I'm still getting a little stuck over here.
|
# ? Mar 19, 2012 14:55 |
|
h_double posted:A couple of Unity questions: Have you considered making the boat a rigidbody instead and just applying forces to it? It would make this process a lot less complicated since rigidbodies already have a drag element that you can alter.
|
# ? Mar 19, 2012 15:10 |
|
I need help with a (perhaps simple?) physics problem. Corner collisions. I'm using a very basic engine that can handle sprites and has collision detection. So far I have set up a collision detection for the ball and the rectangle, if there is a collision I have some code that determines what side of the rectangle is hit, if a side is hit make vX = -vX, and if the top or bottom are hit I make vY = -vY and this is ok so far. I've read about making the corners tiny circles, but I have no idea how to implement this, I understand what a 'normal' is but again I don't know how to articulate this in to code (this engine is C++ fyi)
|
# ? Mar 19, 2012 16:54 |
|
Use the circle's normal instead of the square's normal for the deflection and you'll get the collision you want pretty effortlessly, I think. It's not as simple as just reversing a direction, but you can get rid of your reversing a direction code. I always have to look up the math of deflections so I can't write the code for you without doing the same work you'd have to. Unfortunately, once you get into this you're probably going to run into all the problems with what happens when objects are overlapping and stuff too. roomforthetuna fucked around with this message at 17:03 on Mar 19, 2012 |
# ? Mar 19, 2012 17:00 |
|
Stiggs posted:This isn't exactly what I'm looking for, unless I'm misunderstanding which is fairly likely! I made an image to try and make myself clearer. code:
|
# ? Mar 19, 2012 17:49 |
|
SuicideSnowman posted:Have you considered making the boat a rigidbody instead and just applying forces to it? It would make this process a lot less complicated since rigidbodies already have a drag element that you can alter. Thanks; I'm not sure if I need a rigidbody, but you got me to consider that I was probably overthinking things by using a FirstPersonController, which has a lot of extra functionality I wasn't going to be using anyway. I'm writing a simple movement script with variables for forwardVelocity and rotationRate and it's easy enough to manage the necessary motion controls that way. Another question: anybody know of any decent replacement water shaders for Unity Free, or suggestions for tweaking the built-in Simple Water? When the camera is close to the water, you can't see the wave ripples and it all looks like a flat single-colored plane.
|
# ? Mar 19, 2012 19:27 |
Stiggs posted:I'd love to take a look at your AS3 code if you don't mind, I'm still getting a little stuck over here. I'll dig it up when I get home, tonight.
|
|
# ? Mar 19, 2012 19:39 |
|
For the turning-arc-to-face-a-target algorithm, here's what I use:code:
|
# ? Mar 19, 2012 20:45 |
|
Appropriate turning arc to move to a target is rather dependent on the mechanisms involved, too - an Asteroids ship would get to a point behind it most quickly by turning on the spot at least half way before even starting to accelerate, and it would seem kind of dumb for it to follow an arc like the one depicted. A car has to be moving before it can turn, so it will have an arc that starts out moving away from the target (assuming it can't reverse) but its turning speed is linked to its wheel speed so you won't get the same sort of arc as you would with constant turning speed and constant acceleration - you'll get the same curve regardless of speed (also assuming no skidding). A person can turn so quickly that it would be daft for them to start accelerating before they're pointing the right way (but if they're already moving then a curve might be better than coming to a stop straight). Helicopter and aeroplane are different again.
|
# ? Mar 19, 2012 22:37 |
|
I'm currently using Unity3D for 2d game development (using Sprite Manager 2) and wondering how to do an animated ray, the problem is it's length isn't fixed. Basically I've got some pngs for ray animation and can tile themselves, so what I wanna do is draw this sprite from certain point to another with the texture repeating itself. Stuff I've tried so far doesn't work and I'm really lost, any clues how to do this?
|
# ? Mar 19, 2012 22:53 |
|
Stiggs posted:This isn't exactly what I'm looking for, unless I'm misunderstanding which is fairly likely! I made an image to try and make myself clearer. I believe that proportional navigation is better than the "turn directly towards the target" method. It's especially better when the target could be moving. I think it's also better if you are accelerating. Edit: To clarify, you are still turning towards the target, but this method tells you how much you should turn towards it. HappyHippo fucked around with this message at 23:27 on Mar 19, 2012 |
# ? Mar 19, 2012 23:23 |
|
HolaMundo posted:I'm currently using Unity3D for 2d game development (using Sprite Manager 2) and wondering how to do an animated ray, the problem is it's length isn't fixed.
|
# ? Mar 19, 2012 23:32 |
HolaMundo posted:I'm currently using Unity3D for 2d game development (using Sprite Manager 2) and wondering how to do an animated ray, the problem is it's length isn't fixed. Is SM2 worth the $150? I ran through the demos a couple years back with an old version and it was a little buggy, but pretty cool.
|
|
# ? Mar 20, 2012 01:25 |
|
I hear 2D Toolkit is better (and cheaper, too), but I haven't tried both.
|
# ? Mar 20, 2012 03:35 |
|
This is something that has been bothering me for awhile - whats the best way to handle drawing? Should each sprite object have it's own Draw() function? Or should I give the Canvas object it's own Draw() function? If I gave each sprite a draw function, it'd be a long chain of passing the Canvas object from the GameEngine down to the Sprite so that it could be blitted to the screen(GameStateManager.Draw(canvas) -> GameState.Draw(Canvas) -> Sprite.Draw(Canvas)) However, it'd give me more options as to how everything gets drawn. Maybe I could have a pointer in each GameState that points to to the GameEngines canvas? But, if I gave the Canvas object it's own draw function, it'd be a long chain of passing the Sprite from up from the GameState(GameStateManager.getState().GetAllSprites())), and I wouldn't have an easy time having different options(such as what if every sprite has a particle effect with it?) I'm at a loss as to what the "best" way to handle this would be. Any suggestions?
|
# ? Mar 20, 2012 03:54 |
|
I have no idea what language or framework you're using, but typically when you have a pervasive object like a drawing canvas that needs to be used by just about everything, you make it accessible globally in some way. How you do that depends on your language. In most class-based languages you'd probably define a static property or method that gives you the canvas object. Then in the drawing code for each sprite you could grab the canvas by doing something like Game.canvas or Game.getCanvas() or whatever. And just to be clear, you want to have all of your drawing code inside of each of your sprite classes rather than doing all of the drawing in your global canvas object. The latter will get out of control very quickly.
|
# ? Mar 20, 2012 04:47 |
|
Gordon Cole posted:I have no idea what language or framework you're using, but typically when you have a pervasive object like a drawing canvas that needs to be used by just about everything, you make it accessible globally in some way. How you do that depends on your language. Whoops, should have specified. I'm using the SDL libraries with C++. Is it safe to be using global variables? Everything I've been taught goes against the idea. But, I guess I could make a global namespace that holds things such as gravity, Canvas, etc etc. I just won't like it.
|
# ? Mar 20, 2012 06:28 |
|
In general, yes, it's a bad idea to use global variables, but in certain applications they make sense. This is definitely a classic situation where they can be useful. Even if you don't make the canvas a global variable, I would argue that by passing around a reference to it through a bunch of deeply-nested function calls, that object is essentially global anyways, just in a very roundabout and cumbersome way. It's good to keep in mind that these kinds of conventions are often not set in stone. Here are some quotes from the first Google result for "why are global variables bad": quote:As with all HeuristicRules, this is not a rule that applies 100% of the time. Code is generally clearer and easier to maintain when it does not use globals, but there are exceptions. quote:When global variables represent facilities that truly are available throughout the program, their use simplifies the code. Wikipedia actually mentions your use case exactly: Wikipedia posted:However, in a few cases, global variables can be suitable for use. For example, they can be used to avoid having to pass frequently-used variables continuously throughout several functions. In games it's very common to make very widely-used objects like the player and the current level globally-accessible. Imagine needing to pass around a reference to the player to everything that needs to interact with it -- the code would become almost unmaintainable for all but the simplest games. Anyways, this is all just a long-winded way of saying that global variables are fine if you know when and how to use them. dizzywhip fucked around with this message at 07:44 on Mar 20, 2012 |
# ? Mar 20, 2012 07:24 |
|
In most languages, standard output is global, right? Your canvas fulfills the same purpose as stdout, so it too should be accessible globally. (Though it isn't always idiomatic to simply declare it in global scope and call it a day.)
|
# ? Mar 20, 2012 07:40 |
|
roomforthetuna posted:I don't know about with Sprite Manager - I'm using cubes to mount my sprites, and you can do this by setting the cube's position and scale to make it the shape you want (and maybe rotation), then renderer.material.SetTextureScale("_MainTex",new Vector2(numberofrepetitions,0)); (or 0 first if you're wrapping it top to bottom). Where numberofrepetitions can include a fraction if you want, and is raywidth/spritewidth. Great I'll try this and see if it works, thanks. Centripetal Horse posted:Is SM2 worth the $150? I ran through the demos a couple years back with an old version and it was a little buggy, but pretty cool. It's a nice tool, however I'd probably try 2D Toolkit first (it's cheaper as someone said) and I've read it's easier to work with.
|
# ? Mar 20, 2012 14:53 |
|
In my opinion, making the canvas global is not the correct solution, but if it works for you go for it. Personally, I like to have my game objects have a 'Render' method that, instead of actually rendering anything, creates a 'RenderInfo' object which contains all of the information that a separate class (GameRenderer, or something) can consume. For example, in an game I'm making, everything is rendered as a Quad, so the RenderInfo object consists of 4 vertices, texture, texture coordinates, 'layer', and a few other things. So, every frame, I iterate over all sprites and get a List of RenderInfo objects and pass those along to the GameRenderer, which does additional transformations based on the camera, viewport, etc. It also is in charge of sorting by layer and by texture to minimize texture switches, then draws back to front.
|
# ? Mar 20, 2012 16:59 |
|
Orzo posted:In my opinion, making the canvas global is not the correct solution, but if it works for you go for it.
|
# ? Mar 20, 2012 17:21 |
|
The Radix posted:I hear 2D Toolkit is better (and cheaper, too), but I haven't tried both. I've been using ex2D for my spriting, it's simple and has worked well for what I've used of it so far, and it's on sale for like $15 right now.
|
# ? Mar 20, 2012 17:48 |
|
Is paying for plugins just something you should get used to for Unity? I'm surprised all these libraries cost money.
|
# ? Mar 20, 2012 18:07 |
|
a lovely poster posted:Is paying for plugins just something you should get used to for Unity? I'm surprised all these libraries cost money. I actually really like that there's some financial incentive for people to develop and support reasonably good quality packages that you can just download and use wholesale. Saves a lot of time writing dumb support libraries, and the creators get a little out of it. Seems like a win for everyone.
|
# ? Mar 20, 2012 18:10 |
|
a lovely poster posted:Is paying for plugins just something you should get used to for Unity? I'm surprised all these libraries cost money. Yes, that's always been my problem with Unity. It's great that they even have a free version of this tool but it's severely limited compared to the $1500 version. That and while there's some good free libraries, the best ones you have to pay for.
|
# ? Mar 20, 2012 18:10 |
|
SuicideSnowman posted:Yes, that's always been my problem with Unity. It's great that they even have a free version of this tool but it's severely limited compared to the $1500 version. That and while there's some good free libraries, the best ones you have to pay for. Unity as a base engine, even the free version, is quite fantastic. You don't need plugins to extend it, you can just write your own. For our last game, I wrote my own A* pathing algorithm, despite there being some plugins for that. If you don't want to write your own? Then, yeah, you pay for them. ... but if you have the money and are making a business of it, most of the plugins are very worth just buying instead of duplicating. They tend to be very cheap relative to what they actually do.
|
# ? Mar 20, 2012 19:06 |
|
a lovely poster posted:Is paying for plugins just something you should get used to for Unity? I'm surprised all these libraries cost money. My thought exercise: Will writing a system where a decent plugin already exists bring me joy or will I learn something from it? I'll probably write it on my own if so! Will writing my own take a while and be boring? Then I'll pay! I imagine using Unity as a student is a very different thing than using Unity as someone with a job doing screwing around in my spare time. Paying $15 so I don't have to reimplement yet another drop-down console or $20 to have a reasonable tweening system? Done deal. Sure, I could do it for less, but as the goblins tell us, "Time is money, friend!" That said, I'm often surprised at just how nascent the Unity marketplace is. Lots of basic things are missing as Good, Well-Implemented Versions. In the coming years, as more and more casual developers hop on Unity, I bet there's a fair bit of change to made in recreating age-old libraries in Unity.
|
# ? Mar 20, 2012 20:46 |
|
|
# ? May 23, 2024 13:12 |
|
Orzo posted:In my opinion, making the canvas global is not the correct solution, but if it works for you go for it. Makes sense, but I think either I'm misinterpreting you or you're misinterpreting me. The canvas object is basically what it's name says it is: the surface where everything gets drawn to, the game window, whatever you call it. I couldn't think of any decent way to get the gamescreen from the GameEngine class down to the sprites, but I guess the best way would be to make the Canvas global.
|
# ? Mar 21, 2012 00:57 |