Thursday, February 13, 2020

grammaticality - Why must the future tense not be used after 'unless'?



[Source:] !! Do not use the future tense after unless
[✓] I won't go unless you go

[✘] [I won't go] unless you will go. [✘]



Why not? Even if the above is prescriptive, what may be some reasons? In my separate question here, I quote: unless = if not. If not can precede future tense; so why can't unless?


Footnote: This Wordreference.com question motivated this.




Wednesday, February 12, 2020

Past Perfect Tense in Reported Speech




Police had deployed large forces along the major junctions of Hosur Road, where major protests took place on Monday.



(Source: Times of India)


In above sentence which I read in new paper past perfect tense has been used. Past perfect tense is used to refer past of past. I am unable to make out two pasts in above sentence.


Does it mean Police were already aware of this protest on Sunday or before protest and already deployed last forces along the major junctions on Sunday or before protest? I mean deployment of forces is first past and taking place of protest is second past.




project management - Where to look for team mates?


Where is a good place to look for people interested in creating games online? I'll be using XNA.


I'm going to start the project later this week, but I'm definitely commited to it. I'd like to find people who won't hit it and quit it after a month.



Answer



A much better question to ask is "How do I pick the right teammates/project?"


This is an excellent article on the subject


How to Pick Indie Game Collaborators: 11 Things to Watch Out For



... The first groups I joined taught me most of the items I hope to pass on to you in this article. They all had heart, and lots of dreams, but very rarely did they have sufficient talent, dedication and management. I spent easily a year and a half spinning my wheels, going from group to group, before I found a really good one...




c# - Pathfinding for a lot of units, mostly random movement



I'm using a uniform cost eight-directional grid as a map, with buildings that represent unpassable terrain - the map tries to simulate a top-down flat city. I'm trying to fill the city with randomly walking citizens, and with player units with controlled paths.


So far, for the random walking I've just chosen a direction and set a direct line on it ( using berensham's line algorithm), until the unit strikes a wall, but even this slows down the game with 200 units, and that's before more complex routes are looked for by the player.


So, I need:



  1. An algorithm to quickly compute a lot of simple routes.

  2. A good pathfinding algorithm - so far I've read about HPA* and A* with JPS, but to both I haven't managed to find an implementation, which is a problem because the articles are a bit too theoretical for me.


For illustration, the situation is somewhat similar to the movement in Atom Zombie Smasher - there are uncontrolled civilians that walk randomly / run away from a threat, and few player units that walk on prescribed paths, only in my game the player can't affect the path mid-walk.


So, to summarize - I'm looking for a system for pathfinding for a couple of hundred of units which is as quick as possible.



Answer




You may want to look at flocking systems. This way you can just calculate paths for a few objects and have others follow them instead of the path.


You can also check out this link to help you create a basic implementation of the A* path-finding algorithm.


Tuesday, February 11, 2020

Common way of animating 'motion' for walk cycle animations


I've just posted this at the Blender artists' forums before realising I would probably get a better response from a more game development-specific audience, so apologies for cross-posting! It's for the right reasons :)


I'm a programmer trying to animate a character walking for a game project, using Ogre. I've made a very simple walk cycle in Blender and exported it to Ogre, and it plays just fine. By fine, I mean it works, but there's terrible foot sliding. This is because I just animated the walk in-place (at the origin) in Blender, and of course I don't know what "speed of walk" that corresponds to, so when I move the character in-game the motion doesn't necessarily match up with the movement of the feet in the animation.


So my question is: what's the normal approach for this kind of thing? At work we use Maya, and the animators either animate a special 'moveTrans' node that represents the "position" of the character (or have the exporter generate it for them from the movement of the root node), then the game can read this to know how fast the animation moves the character. So in the Maya file, the character will walk forward for one cycle and this extra node will follow along with them by their feet. I've not seen anything like this in open-source land, and there's certainly no provision for that in the Ogre Exporter script. What do you chaps normally do for this?



Answer




There are two ways of doing it: root motion or "in code".


With root motion you have basically exactly what you're suggesting with the "moveTrans" node. You use the motion of that object to determine how quickly to play back the walk cycles. You might be able to do a reverse lookup of sorts to figure out that if you want to be at position X what frame you need to be at. But the real advantage of root motion is that to get truly realistic animations you need to account for the fact that movement isn't a true linear path. Real people move at a variable speed over time, or maybe they're shuffling left and right a bit, or whatever.


Mixamo did a good example with root motion control using Unity. There's a video of it here: http://vimeo.com/12052874


Now root motion does have its drawbacks. It can get tricky with things like trying to get the "walk" animation to work on stairs (ideally you'd have a separate stair/ladder climbing anim and do all the movement for that in the animation as well). I'm also not really sure how IK really plays into it, if at all.


Now doing it "in code" is a lot easier from the programming side of things. What I suggest doing is first making sure all your units are consistent. For example, 1 unit in Maya and your game is 1 meter. Then you get your artists to animate a character walking (complete with forward movement). Use that to figure out the speed of the animation, and export the animation without the forward velocity. Use that to figure out how fast to play back the animation. So if the walk animation at 1x speed is 5 m/s, and you want to have the player run at 7 m/s, you simply play back at 7/5 = 1.4x speed. If your model is scaled up or down multiply the animation playback rate by the inverse of the scale. A half height dude will have to walk twice as fast to move the same rate as a 1x scale guy.


mathematics - Move a sprite in a sine wave along different angles


I understand this piece of code


Enemy.position.Y = StartPosition.Y + (-(float)Math.Cos(position.X / 100) * 100);


However it only works along the X axis. What I want to be able to do is move it along an arbitrary axis; Set an angle as the x axis. How would I go about this?



Answer



I'm not sure if I understand your question but here goes:



I think you want the sprite to wave over an angle back and forth: Not this is pseudocode (as you didn't state the language):


t=(t+wavespeed)%TwoPi;
a = Sin(t)*amplitude;
Position.X=StartPosition.X + Cos(angle) * a;
Position.Y=StartPosition.Y + Sin(angle) * a;

t controls the waving motion; the wavespeed variable is a small value like 0.01 (note that it should slowly range from 0 to TwoPi). amplitude is the maximum you want your sprite to move, a is calculated as the amplitude for that frame. angle is the angle of the axis you want your sprite to wave along.


Difference in sentence meaning between present continuous and simple present constructions


What is the difference between the following sentences?




  1. He is always shooting his mouth off about how good he is. (present continuous)

  2. He always shoots his mouth off about how good he is. (simple present)




In texts they usually use number 1, but I do not see a difference in meaning.




Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...