Saturday, September 30, 2017

make that something -- meaning?


A scene from the movie Pandorum (2009).

The Link to the audio file: http://tindeck.com/listen/guan (here's the YouTube version with a time mark set to take you right to when the scene begins)


Two guys wake up from hypersleep and find themselves on a spaceship floating in space. They don't remember anything from the past and must figure out what to do. One of them crawls into a vent shaft while the other guy communicates with him via something like an advanced version of a walkie-talkie. A few minutes further into the scene, that guy falls out of an overhead compartment, gets up, realizes that it was an overhead compartment he fell out of and says this, "make that an overhead compartment."


I asked an English native speaker and he said this, "he thinks he's in a locker on the floor but when he falls he realizes he was in an overhead compartment. Saying "make that a ____" is a common thing for jokes in movies like that. That's as much as I've got so far, but I'd like to know more about this turn of phrase.



Answer



"Make that a/an..." is a colloquial form of changing a former statement or request.


Your example:



I'm in a (place 1) -> Make that a (place 2)




This works even when statement 1 was made by another person:



Customer A, to waitress: "I'm having a beer"
Customer B, also to waitress: "Make that two."



(The underlying idea is that the waitress wrote down order no. one and now changes it.)


Later in the evening, you might overhear him adding a tip to the bill:



Waitress: "That'll be $16.

Customer: "Make that 20."



graphics - Precomputing Visibility


Having noticed that UDK (Unreal) and Unity 3 include similar pre-computed visibility solutions that unlike Quake are not dependent on level geometry, I've been trying to figure out how the calculation is done.


The original Quake system is well documented: You divide the world into convex volumes that limit both the camera and the geometry. Each volume has a list of all the other volumes that are visible from it.


Visibility would be computed by firing rays at some random distribution of points in the target volume and see if any hit. And because the position of the camera in the source volume could have an effect, those thousands of rays would have to be fired from multiple places in the source cell.


So what I'm wondering is if there's any been fundamental change to this basic scheme in the intervening 15 or so years? I can see how to adapt it to a UDK/Unity scheme that has regular source volumes and deals mostly with arbitrary meshes as the targets, but is there a better way than stochastic ray testing?



Answer



On the exact analytic visibility side:


Rather than casting a gazillion ray in the hope that N=gazillion is actually enough, there are researchers who have developed analytic algorithms, which will compute exactly which triangles, objects or cells are visible from another cell (i.e., the same result as if you case an infinite set of rays).


See Shaun Nirenstein's exact visibility page for a set of publications on this subject. You may note that one of the authors of the 2005 paper is the CTO of Umbra Sotware (the visibility middleware paired with Unity 3). I don't know whether or not this technology is used in the Umbra product or not. For scenes with specific structure (i.e., cell/portal), an analytic solution is covered nicely in Seth Teller's 1992 thesis here. Jiri Bittner's thesis also presents an analytic solution.



Generally, analytic visibility is hard to get right (mathematically complex, numerical issues, speed, etc.), but if done right it would make for a compelling piece of middleware.


On the ray casting side:


The algorithm you described has been around since the late 80's (see Towards Image Realism with Interactive Update Rates in Complex Virtual Building Environments).


There have been many advances in the ray-casting approaches in the last few years. Researchers have devised algorithims that choose fewer, but better rays using heuristics, and also may compute visibility over multiple cells simultaneously. See the papers on Peter Wonka's page (Guided Visibility Sampling and Adaptive Global Visibility Sampling). These get great results.


Probably the class of technique that is still used the most today in practice is the GPU accelerated hemicube algorithms. These just sample visibility from a set of points by rendering a 6 sided cube map and reading back object/triangle/cell indices as data. Occlusion queries can also be used to reduce the amount of data read back. Algorithms based off this tend to be easy to implement and give good results in practice (fast as hell, since they use the GPU), but the sampling distribution (millions of rays cast from a realtively small set of single points), may make it take longer to converge on an accurate solution then one would think. This technique tries to choose better visibility cube source locations than a simple uniform or random sampling.


There are plenty of other visibility techniques (hundreds). I suggest reading some of the background chapters in the theses linked to, if you want to know more.


c++ - Writing a custom model file format


I am using Ogre for my rendering engine, and I planned on just using the .mesh format that is setup by default with Ogre. However, I recently purchased a large number of 3d assets from a company, only to find out that they use 7 blend weights where as Ogre has a max limit of 4.


I don't know much about modeling and animation (which is why I purchased the art) but just from thinking, it is probably fairly difficult to change something like this in the model without having to reanimate it.


So this led me to think about a custom model format. I know the basics of what is stored, verts/polygons/etc, but I am wondering if this is something I am right in thinking I probably need to do? If so, are there any good resources on developing a custom model format? Tutorials/samples/anything would be great. So far all I have found is http://www.falloutsoftware.com/tutorials/gl/gl6.htm which is helpful but not complete.




Friday, September 29, 2017

adnominal - What does this use of 'there' mean?



[Ron] "Look –– they're off Ouch!"
Someone had poked Ron in the back of the head. It was Malfoy. "Oh, sorry, Weasley, didn't see you there."
(Harry Potter and the Sorcerer's Stone)



They say adverbs can modify the head of noun phrase, not nouns. So ‘there’ does not modify ‘you’. What does ‘there’ do: is it a predicative over ‘you’ or is it just an adverb––meaning ‘in that place’?



Answer



Sure, there can modify you.


As McCawley says, pronouns don't "stand for" nouns but for entire noun phrases. Consequently you is a noun phrase, and (by default) its own Head.



You could pick up McCawley's recategorization of adverbs as Ad-Vs, Ad-Ns, Ad-Ss, &c and say that there here acts as an Ad-N´.


And if you want to sound really impressive and be really confusing, you could parallel that recategorization by saying that just as you is a Pro-N´, what there really is is a Pro-P´ or Pro-S, or whatever you think it stands for:



Oh, sorry, Weasley, didn't see you there.
Oh, sorry, Weasley, didn't see you in that place.
Oh, sorry, Weasley, didn't see you standing right in front of me.
Oh, sorry, Weasley, didn't see you blinking stupidly like the proletarian cretin you are.
Oh, sorry, Weasley, didn't see you offering an irresistible target.



grammar - Meaning of "to be" in this sentence?



"We know it to be a drug"




Here, what does it mean by "to be" in this sentence? I know that it is a active infinitive sentence. But my question is what is the full form of "to be" here? If you say the full form of "to be" in this sentence is "is" then if I replace "to be" by "is", it will make no sense like:



"We know it is a drug"





Meaning of "uncle by marriage"


What is the meaning of "his uncle by marriage in the following sentence:





  • Tom was adopted by Sam, his uncle by marriage.





xna - Engine with Terrain and Indoor Areas (BSP-like)


I'm not really a graphics programmer, but I used to toy around with Truevision3D 6.5 a few years ago. It wasn't too bad, but TV3D was just going nowhere so my foray into 3d game dev ended there.


I know nothing of XNA. I think it's time to get up to date.



My goal is to be able to render chunks of terrain from heightmaps (big huge terrain a la Morrowind) and BSP-like indoor areas (think Quake, so moveable objects like doors included).


I googled for "xna engine", "best xna engine" but the quantity of results is a bit scary for a xna-impaired like me.


Can anyone recommend a xna engine (or a combination of libraries) to achieve the desired result? If you targeted similar features, can you share your experience?


(and for a laugh, has anyone tried TV3D 6.5 here?)


Edit: I'm looking for something xna-related.



Answer



One I have heard good things about is the Sunburn engine. (Site seems down currently)


Chances are you're not going to get all you want out the box. However, Riemer has a great tutorial about heightmaps here - in XNA!


EDIT: This is probably a little off what you want, but Sean James has a great (well, I'm not a fan of the architecture of gamescreen/component but other than that I love it) tutorial on writing a simple 3D engine in XNA - it's pretty concise. The advantage is it's free to do by yourself, and if your goal is learning it would be good.


opengl - what is the very last element of a 4x4 transformation matrix for?



while its a similar value to its neighbour - Z translation (and I wont say if thats above or to the left for fear of sparking a religious war!) and it only seems to change when the Z translation value changes, however the value is not quite the same


Normally I just see either this value ignored or just a 1 in all the tutorials I've seen


Can someone explain exactly what this last element does ?




Answer



The value is for Homogeneous Coordinates. Using homogeneous coordinates makes it possible to use things like quaternions and projection matrices. The last entire row is actually for dealing with homogeneous coordinates.


Essentially, the coordinates transformed by a 4x4 matrix will be a 4x1 vector, with (X,Y,Z,W) components. The final values of (X,Y,Z) are determined by taking the homogeneous coordinates and dividing them by W.


E.g. 1


[4,2,1,2] is transformed to [2,1,0.5,1]

Wherein the final XYZ coordinates are then (2,1,0.5). Again, this is useful for dealing with quaternions and creating projection matrices.


E.g 2


Projection of point p onto the plane
orthoganal to the Z axis and distance d

from the 'camera'.

.p
d | <- given
c--------|------------>Z
|

d |.p'
c--------| <- desired projection
|


p' = (d / p.z) * p

x' = dx / z
z' = d

d 0 0 0 * x = dx -> dx / z
0 d 0 0 y dy dy / z
0 0 d 0 z dz d
0 0 1 0 1 z 1


In the case of a projection matrix, homogeneous coordinates allow the projection of scene geometry onto a plane (the screen).


opengl - How can I improve rendering speeds of a Voxel/Minecraft type game?


I'm writing my own clone of Minecraft (also written in Java). It works great right now. With a viewing distance of 40 meters I can easily hit 60 FPS on my MacBook Pro 8,1. (Intel i5 + Intel HD Graphics 3000). But if I put the viewing distance on 70 meters, I only reach 15-25 FPS. In the real Minecraft, I can put the viewing disntance on far (= 256m) without a problem. So my question is what should I do to make my game better?


The optimisations I implemented:




  • Only keep local chunks in memory (depending on the player's viewing distance)

  • Frustum culling (First on the chunks, then on the blocks)

  • Only drawing really visible faces of the blocks

  • Using lists per chunk that contain the visible blocks. Chunks that become visible will add itself to this list. If they become invisible, they are automatically removed from this list. Blocks become (in)visible by building or destroying a neighbour block.

  • Using lists per chunk that contain the updating blocks. Same mechanism as the visible block lists.

  • Use nearly no new statements inside the game loop. (My game runs about 20 seconds until the Garbage Collector is invoked)

  • I'm using OpenGL call lists at the moment. (glNewList(), glEndList(), glCallList()) for each side of a kind of block.


Currently I'm even not using any sort of lighting system. I heard already about VBO's. But I don't know exactly what it is. However, I'll do some research about them. Will they improve performance? Before implementing VBO's, I want to try to use glCallLists() and pass a list of call lists. Instead using thousand times glCallList(). (I want to try this, because I think that the real MineCraft doesn't use VBO's. Correct?)


Are there other tricks to improve performance?



VisualVM profiling showed me this (profiling for only 33 frames, with a viewing distance of 70 meters):


enter image description here


Profiling with 40 meters (246 frames):


enter image description here


Note: I'm synchronising a lot of methods and code blocks, because I'm generating chunks in another thread. I think that acquiring a lock for an object is a performance issue when doing this much in a game loop (of course, I'm talking about the time when there is only the game loop and no new chunks are generated). Is this right?


Edit: After removing some synchronised blocks and some other little improvements. The performance is already much better. Here are my new profiling results with 70 meters:


enter image description here


I think it is pretty clear that selectVisibleBlocks is the issue here.


Thanks in advance!
Martijn



Update: After some extra improvements (like using for loops in stead of for each, buffering variables outside loops, etc...), I now can run viewing distance 60 pretty good.


I think I'm going to implement VBO's as soon as possible.


PS: All source code is available on GitHub:
https://github.com/mcourteaux/CraftMania



Answer



You mention doing frustum culling on individual blocks — try throwing that out. Most rendering chunks should be either entirely visible or entirely invisible.


Minecraft only rebuilds a display list/vertex buffer (I don't know which it uses) when a block is modified in a given chunk, and so do I. If you're modifying the display list whenever the view changes, you're not getting the benefit of display lists.


Also, you appear to be using world-height chunks. Note that Minecraft uses cubical 16×16×16 chunks for its display lists, unlike for load and save. If you do that, there's even less reason to frustum cull individual chunks.


(Note: I have not examined the code of Minecraft. All of this information is either hearsay or my own conclusions from observing Minecraft's rendering as I play.)





More general advice:


Remember that your rendering executes on two processors: CPU and GPU. When your frame rate is insufficient, then one or the other is the limiting resource — your program is either CPU-bound or GPU-bound (assuming it isn't swapping or having scheduling problems).


If your program is running at 100% CPU (and doesn't have an unbounded other task to complete), then your CPU is doing too much work. You should try to simplify its task (e.g. do less culling) in exchange for having the GPU do more. I strongly suspect this is your problem, given your description.


On the other hand, if the GPU is the limit (sadly, there aren't usually convenient 0%-100% load monitors) then you should think about how to send it less data, or require it to fill fewer pixels.


optimization - "Optimal" game loop for 2D side-scroller


Is it possible to describe an "optimal" (in terms of performance) layout for a 2D side-scroller's game loop? In this context the "game loop" takes user input, updates the states of game objects and draws the game objects.


For example having a GameObject base class with a deep inheritance hierarchy could be good for maintenance... you can do something like the following:


foreach(GameObject g in gameObjects) g.update();

However I think this approach can create performance issues.



On the other hand all game objects' data and functions could be global. Which would be a maintenance headache but might be closer to an optimally performing game loop.


Any thoughts? I'm interested in practical applications of near optimal game loop structure... even if I get a maintenance headache in exchange for great performance.



Answer




For example having a GameObject base class with a deep inheritance hierarchy could be good for maintenance...



Actually, deep hierarchies are generally worse for maintainability than shallow ones, and the modern architectural style for game objects is trending towards shallowing, aggregation-based approaches.



However I think this approach can create performance issues. On the other hand all game objects' data and functions could be global. Which would be a maintenance headache but might be closer to an optimally performing game loop.




The loop you've shown potentially has performance issues, but not, as is implied by your subsequent statement, because you have instance data and member functions in the GameObject class. Rather, the problem is that you if you treat every object in the game as exactly the same, you probably aren't grouping those objects intelligently -- they're likely randomly scattered about throughout that list. Potentially, then, every call to the update method for that object (whether that method is a global function or not, and whether than object has instance data or "global data" floating around in some table you're indexing into or whatever) is different from the update call in the last loop iterations.


This can put increased pressure on the system as you may need to page the memory with the relevant function in and out of memory and re-fill the instruction cache more frequently, resulting in a slower loop. Whether or not this is observable by the naked eye (or even in a profiler) depends on exactly what is a considered a "game object," how many of them exist on average, and what else is going on in your application.


Component-oriented object systems are a popular trend right now, leveraging the philosophy that aggregation is preferable to inheritance. Such systems potentially allow you to split the "update" logic of components (where "component" is roughly defined as some unit of functionality, such as the thing that represents the physically-simulated portion of some object, which is processed by the physics system) on to multiple threads -- discriminated by component type -- if possible and desired, which could have a performance gain. At the very least you can organize the components such that all components of a given type update together, making optimal use of the CPU's cache. An example of a such component-oriented system is discussed in this thread.


Such systems are often highly decoupled, which is a boon to maintenance as well.


Data-oriented design is a related approach -- it's about orienting yourself around the data required of objects as a first priority, so that that data can be effectively processed in bulk (for example). This generally means an organization that tries to keep data used for the same purpose cluster together and operated on all at once. It is not fundamentally incompatible with OO design, and you can find some chatter on the subject here at GDSE in this question.


In effect, a more optimal approach to the game loop would be, instead of your original


foreach(GameObject g in gameObjects) g.update();

something more like


ProcessUserInput();

UpdatePhysicsForAllObjects();
UpdateScriptsForAllObjects();
UpdateRenderDataForAllObjects();
RenderEverything();

In such a world, each GameObject might have a pointer or reference to its own PhysicsData or Script or RenderData, for the cases where you might need to interact with objects on an individual basis, but the actual PhysicsData, Scripts, RenderData, et cetera would all be owned by their respective subsystems (physics simulator, script hosting environment, renderer) and processed in bulk as indicated above.


It is very important to note that this approach isn't a magic bullet and will not always yield performance improvement (although it is generally a better design than a deep inheritance tree). You're especially likely to notice basically no performance difference if you have very few objects, or very many objects you cannot effectively parallelize the updates for.


Unfortunately, there is no such magic loop that is the most optimal -- every game is different and may need performance tuning in different ways. So it's very important to measure (profile) things before you blindly go taking the advice of some random guy on the internet.


Thursday, September 28, 2017

xna - How can I prevent text rendering from looking ugly when in motion?


I'm drawing a name above the player's head in a 2D top-down view game. The code to draw the string looks like this:


Vector2 textPos = new Vector2(
(positionX * 2 * world.Map.TileWidth + (16 -(SmallFont.MeasureString(mName).X / 2))),
(positionY * 2 * world.Map.TileWidth - 32));

spriteBatch.DrawString(SmallFont, mName, textPos, Color.White, 0, Vector2.Zero,
1, SpriteEffects.None, 1);


The text is drawn to the position right above the player's head just fine, and it follows the player as he moves just fine as well. But the problem is that when the player moves, the text kind of gets thicker and ugly. I tried screen capping it but the screenshot doesn't capture the problem (because it's just taking a single frame, I presume).


How can I fix this?




collision detection - How are trajectories calculated and transmitted to other players, in multiplayer?


I play a lot of "Call of Duty", and can see tracers for gunfire, missiles, care packages falling from helicopters etc. There is a lot of activity. I am curious to know the algorithm one would use, at a high level, to manage all this action when you have 20 people on a map shooting each other to death.


This question touches on the subject, but doesn't ask for a more in-depth answer as to how you the developers go about calculating and transmitting movement and collision detection for projectiles, be it missles, bullets, or any other object that is flying through the air in real-time.


How are trajectories calculated and transmitted to other players, in multiplayer?



Answer



It depends on how important object for gameplay and how it working.


Generally projectiles like missles move along a predictible trajectory so server can spawn a new object, set its position, direction, speed and transmit data about new projectile to clients. Client-side code will simulate movements of a projectile using this data. If projectile hit something important (world geometry, other player or something else) server process this and inform clients about this.


Human controlled objects require different approach. Since it cannot be fully predicted on client-side, server frequently send updates about position and direction to clients. Often this data include speed of object to allow client to interpolate and/or extrapolate movements of object between updates from server.



phrasal verbs - Correct use of "used to"


I wanted to understand the correct use of "used to". For example:




I used to play cricket over the weekends.



Here, I am talking about the past, not the present.


Can I use "used to" in present tense as well?


Please advise.




meaning in context - "Open shaming of anyone..."



Open shaming of anyone who spoke out discouraged responsible dissent.




How does open with shaming work, grammatically and meaningfully?


Is discouraged modifying "responsible dissent?




Wednesday, September 27, 2017

path finding - How does Flow Field pathfinding work?


Supreme Commander 2 has something called flow field path finding. How does it work? Is there some article available I can read up on how it works?



Answer



I wrote flow fields for sup com 2, and I wrote an article explaining the details. It can be found in the upcoming book "Game AI Pro: Collected Wisdom of Game AI Professionals".



Also, I recently did a video stream talking about flow fields for Planetary Annihilation. I show some debug views and explain how it works at a high level. http://youtu.be/5Qyl7h7D1Q8?t=24m24s


Hope this helps


procedural generation - How can I generate biome borders?


I'm looking for ways to generate random biome borders (like what Minecraft has).


One technique involves choosing specific biomes based on (eg) a rainfall map and a temperature map. But that just determines which biome to place, not where the borders between biomes are.


I don't want to use quantized Perlin noise directly; that would generate certain quantized values strictly within other zones, whereas I'd like finer control over which biomes can abut others. For example, in Minecraft one can see mountainous terrain, forests, plains, or deserts right next to the ocean.


Many of the solutions to "the biome problem" propose computing the whole universe in a heuristic manner. I want to generate infinite terrain, and to me that suggests the algorithm be strictly functional: given an X,Y value (and a world seed) the algorithm can easily spit out a biome value.


So, my question: what are some techniques for identifying random, non-trivial-sized, contiguous chunks of terrain to be of a given biome?




What does this particular phrase mean?


I asked my friend how his exam went and he said "Math bent over for me"


What does it mean? Or is it some wrong phrasing? Either way, what is he trying to say?




Tuesday, September 26, 2017

restrictive or non-restrictive relative pronoun?


I am wondering whether the restrictive relative pronoun that or the non-restrictive relative pronoun which (plus a comma) should be used to modify the Hunting Lodge in the following:



Casa Loma consists of three main buildings — the Casa Loma proper, which has a gothic seven-story tower, the two-story Hunting Lodge that once housed the home’s servants quarters, and a massive stable.



I'd appreciate your help.




Monday, September 25, 2017

physics - Throw object towards predefined place?



I have a 2D side-view game with object attributes such as x, y, speedX, etc. Now I want to throw a given object from any place on the screen onto a defined goal place, in such a way that its trajectory looks somewhat normal (with gravity, it making a curve and such). Imagine an enemy is destroyed and what he stole flies from him back towards the stolen object's origin. (I do have physics via Box2D in this game, but for this particular need, it seems I require a manual approach; for one thing, the object is allowed to pass other bridges and such for the time it flies back to its main bridge.)


How would I go about this? I've tried moving manually by adjusting towards a target speed and such, but the trajectory and timing looks very unnatural. Thanks!



enter image description here



Answer



Wiki has article about projectile trajectory here.


Maybe also this will help you (it helped me). It's brief explanation of two approaches to your problem - variable strength and angle of projectile being shoot. At the end of this post, there's short "Try it yourself!" section, where small JavaScript implementation exists (which may, again, help you).


Good luck!


architecture - How can I separate entities from their actions or behaviours?


I'm having a go at creating a very simple text based game and I'm wondering how I can design the entities (characters, sentient scenery) with regards to the actions those entities can perform.


As an example, I have an entity that is a 'person' with various properties such as age, gender, height, etc. This 'person' can also perform some actions such as speaking, walking, jumping, flying, etc etc.


How would you separate out the entity from the actions it can perform?



Answer



The common answer you'll get is "with components". There are lots of questions with that phrase in them that you can search through.


In particular, here's a good article that has been linked to several times that's worth a read: http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/



Is there a difference between "write" and "write down"?


Is there a difference between "write" and "write down" or it's just a matter of fashion / style?


At the university I see that some of the teachers say "write down" and some of them say "write" without "down"- both are in the same context in the classes (to write notes). Is one of them better or more correct or it's just a matter of style?




What is the integrator used in PhysX?


What type of integrator is used in the PhysX engine? Euler? Runge-Kutta?


I tried to look through the comments in the SDK header and source files. But, could not find any information about this.




Sunday, September 24, 2017

difference - "A little" Vs. "The little" (in reply to "Have you got any money?")



A: Have you got any money?
B: Yes, a little

A: Have you got any money?
B: yes, the little



How a little is differ from the little in above context?


As far as I know the meaning of "a little" is "positive(some)," and meaning of "the little" is "not much" which can also be considered as some.




modal verbs - In depth explanation of the difference between "will" and "going to"?


Background


My wife and I take English classes provided by our companies, so we have different teachers. So now it happened that we had the same topic: future.


Both teachers are native English speakers, but I don't place too much faith on that. I'm a native German speaker but I couldn't teach anyone how the grammar of German future works.


The question



We (my wife and I but also our teachers) both agree that "will" and "going to" indicate something to happen in the future. We also agree that the difference is just a matter of probability. However, we have opposite understandings on that probability.


My wife / my wife"s teacher says:



"Probably", "maybe" and "perhaps" are keywords pointing towards to use of "will".


There are no keywords for "going to", but it should be used when something is very certain to happen.



I say / my teacher says:



"Going to" is used in cases with low probability


"Will" is used with high probability.




The latter model fits very well to what I have learned at school. However, my wife"s teacher says that one reason for Germans to have the difficulty is that we learn it wrong at school.


When to use "will" and when to use "going to"? Is it a matter of probability? Is it a matter of stylistics (e.g. will for the single sentence examples and be going to for the multi-sentence examples as pointed out in one of the comments)? Is it a matter of how far into the future (present prediction vs. future prediction)?


What I have tried


Oxford Dictionary


I looked up the definition of "will (modal verb)" in the Oxford Advanced Learners Dictionary, sixth impression and it says:



1(a) (indicating future predictions)


1(b) (indicating present predictions)


2(a) (indicating willingness or unwillingness)



2(b) (indicating requests)


3 (giving an order)


4(a) (describing general truths)


4(b) (describing habits in the present or past)


5 (insistence on the part of the subject)



From these descriptions, my opinion is that "will" is used for higher probability (a general truth is more likely than something else, habits are more likely than non-habits). I also can't find any of the keywords in the examples given in the Oxford dictionary.


I also tried looking up "going to", but it's neither present under "going to" nor could I find it under "go".


Inlingua textbook


Second, I looked it up in my English textbook, which is Inlingua English 2 Step 1. Unit 7 is about "Planning" and there is an exercise 7.3 about decisions. While I would consider a decision and plans as something with high probability (because I can influence it), all the sentences start with "going to", which contradicts my understanding. Unfortunately, the Inlingua book is quite crap, because it seldom gives definitions and bases everything on examples only.



Third, there is Unit 8 "Predictions" in the same textbook. Under 8.3 there is one of the rare cases of a definition:



We use "will" and "going to" to discuss forecasts that are quite certain.



This finally confuses me even more, since there is almost no difference any more.


English Page


I also had a look at English Page / Simple future. It says



USE 1 "Will" to Express a Voluntary Action


USE 2 "Will" to Express a Promise




However, I don't see much of a difference between those in the examples. If someone says



I will translate the email, so Mr. Smith can read it.



is that a promise, a voluntary action or maybe both? I just don't get it.


The site also says



USE 3 "Be going to" to Express a Plan


It does not matter whether the plan is realistic or not.




If the plan is not realistic, that would be improbable.


Also, what is the difference between a plan ("going to") and a promise ("will")? What if I promise someone to follow the plan?


Is "I will travel to Switzerland" a plan (e.g. I have made a plan how to travel there), a promise (because I talk to my girlfried living in Switzerland) or a voluntary action (which it also is)? So use "will" or "going to" now?



USE 4 "Will" or "Be Going to" to Express a Prediction


Predictions are guesses about what might happen in the future.



Derived from "might", this sounds both suitable for improbable cases.



Answer




BE + going to - Lindsay is going to fly to New York next week.


Forms with BE + going to possibly originated in such utterances as:


1. We are going to meet Andrea at the cinema,


uttered when we were literally going, i.e. on the way, to the meeting. At the moment of speaking there was present evidence of the future meeting. This use has become extended to embrace any action for which there is present evidence – things do not have to be literally moving. Consider now these two utterances:


2. Look at those black clouds. It's going to rain.
3. Luke is going to see Bob Dylan in concert next year


In [2] the present evidence is clear – the black clouds. In [3], the present evidence may be the tickets for the concert that the speaker has seen on Luke’s desk, or it may simply be the knowledge in the speaker's mind that s/he has somehow acquired.


Modal (will) - Lindsay will fly to New York next week.


Will is a modal and, like the other modals, has two core meanings. The two core meanings for most modal are:


(a) the 'extrinsic' meaning, referring to the probability of the event/state (b) the 'intrinsic' meaning, reflecting such concepts as: ability, necessity, obligation, necessity, permission, possibility, volition, etc.



The extrinsic meaning of will is exemplified in:


4. Emma left three hours ago, so she will be in Manchester by now.
5. There will be hotels on the moon within the next 50 years.
6. The afternoon will be bright and sunny, though there may be rain in the north.


In all three examples, the speaker suggests 100% probability, i.e. absolute certainty. (MAY would imply possibility, MUST logical certainty, to take examples of two other modals). Note that while certainty in [5] and [6] is about the future, in [4] it is about the present. It is the absolute certainty, in the minds of speaker/writer and listener/reader, that can give the impression that forms using ‘the will future’ are some way of presenting ‘the future as fact’. Some writers therefore call this form ‘the Future Simple’. Weather forecasters, writers of business/scientific reports, deliverers of presentations, etc, frequently use will, and learners who encounter English more through reading native writers than hearing native speakers informally may assume that it is a 'neutral' or 'formal' future. In fact the particular native writer or speaker is simply opting to stress certainty rather than arrangement, plan or present evidence.


The intrinsic meaning of will is exemplified in:


7. I'll carry your bag for you.
8. Will you drive me to the airport, please?
9. Jed will leave his mobile switched on in meetings. It's so annoying when it rings.


These examples show what we might loosely call volition, the willingness or determination of the subject of the modal to carry out the action. Note that [9] is not about the future, and in [7] and [8] the futurity is incidental. It is context rather than words which gives the meaning.



difference - "came in first place in a challenge" vs "came first " vs "won first place"


I am trying to express that X won a challenge. Which one(s) amongst the following are correct, which one sounds the best, and is there any better alternatives?



  • X came in first place in a challenge

  • X came first place in a challenge


  • X came first in a challenge

  • X won first place in a challenge



Answer



The two in the middle need to be adjusted slightly. The others are correct, but for the fourth one to be more exact and idiomatic, you should probably change it to "won first prize" instead of "place." First place is just a status that tells you where you are in the competition -- the prize is something that you win, because it is awarded to you upon coming in first place. "Coming in first place" means that you ended the competition in first place.


For the two in the middle, you need "in" between "came" and "first." "Came first place in a challenge" is grammatically incorrect. The third option, "came first in a challenge," is both a sexual innuendo and not expressive of what you want -- people will probably understand your meaning, but they'll giggle at the innuendo and know you're speaking broken English.


The first sentence is fine the way it is.


Alternatives





  • X won the challenge.




  • X came in first.




  • X placed first.




  • X is the winner [of the challenge].





pronouns - Grammatical gender of the word "child"


I've been taught that a child is gender-neutral noun. But in the textbook on linguistics I've been reading, the noun is used as feminine. For example, a sentence in the book goes like this:



The child must also learn many aspects of grammar from her specific linguistic environment.




Is there an explanation for the use of the pronoun her instead of its?



Answer



Child is gender neutral. As a result, when referring to a child, one must then choose a pronoun he,she or they when referring to the said child, as English does not have a gender neutral way of referring to that individual. This causes a problem for writers. Whatever you choose could be wrong.


Some would write he, but that sounds sexist and presumptive. Some write they, but this does not confirm the singular as it could refer to many. As an alternative some writers have taken to using she to balance those that historically have used the masculine form.


Other writers go to great lengths to avoid any of these forms by just rewriting the sentences completely.


Stack Exchange questions and answers have the same problem. Do we refer to a writer as he, she, they...? Whatever one chooses makes implications that it may not be correct.


We almost never use it or its to refer to a child, as this form is reserved for objects and not people and thus is considered to be demeaning.


Saturday, September 23, 2017

ranking - Match Making Groups of Players


Given a situation where I have a pool of X people of different scores (ranks) S with game size N. How do I partition the pool into N sized games where the standard deviation of ranks for each games is minimized?


(quality of the game is inversely proportional to STD of ranks)




"By doing [something], you are [something]." - Is the structure correct?


I have phrased the sentence below awkwardly, I assume:



By numbering the examples, you are a genius.



I want to know how it can be fixed to fit a proper and clear structure. And I suppose it would be more natural if it was stated like this:



You are a genius by numbering the examples.



I think of that structure as if-statements but when they actually happen, not if they were to happen, like:




If you numbered the example, you would be a genius.



Also, would "consider" fit in the sentence?



By numbering the examples, you are considered a genius.




Answer



There's certainly a valid sentence structure of the form "by [verbA] you [verbB]". It can use other prepositions, as well, such as in or through.


However, your first example is not natural. It doesn't work. I think that's because the first verb is an action verb, while the second is a stative verb.



The way to say that a person is shown to be a genius by showing the examples is to actually use words that mean that:



By numbering the examples you are shown to be a genius.
By numbering the examples you show your genius.
In numbering the examples you prove that you are a genius.



If you wanted to say that number the examples actually caused them to be, or become, a genius, you want use become:



By numbering the examples you become a genius.




For an example where both are stative:



In knowing all prime numbers less than 1,000,000, you are a genius.



But not, although it is less awkward than your example:



In knowing all prime numbers less than 1,000,000, you become a genius.



This is less awkward, and I'm not 100% sure why... perhaps the first half can be stative and the second half action, but not vice versa. However, this is not awkward:




By learning all prime numbers less than 1,000,000, you become a genius.



More confidence about what sounds awkward is likely to come with practice, rather than learning rules. English is rather lacking in consistent general rules.


Friday, September 22, 2017

Noun used as an adjective in "passenger seat"?


A friend of mine (a native speaker of Japanese) wrote "passenger's seat", which a native speaker of English corrected to "passenger seat".


Onelook.com has entries for the latter but not the former, but I wouldn't be able to explain the grammar of it. Is a noun being used as an adjective?




Answer



Nouns frequently modify other nouns in English, and that is the case with passenger seat. It describes a seat that is meant to be used by a passenger.


Passenger’s seat, on the other hand, is the normal way of saying ‘the seat of a passenger’. It means that the seat that in some way belongs to a passenger. In this particular case it is an unlikely thing for anyone to say in that context, which is no doubt why your friend was corrected. It would, however, occur in a sentence like this:



"I'm sorry, sir, I'm afraid I'm going to have to ask you to move. This is another passenger's seat."



assets - Good resources for learning modern OpenGL (3.0 or later)?



I stumble upon the search of a good resource to start with OpenGL (3.0 or later) . Well, I found a lot of books but none of them can be considered a good resource!


Here two examples:


OpenGL Programming Guide (7th edition) http://www.amazon.com/exec/obidos/ASIN/0321552628/khongrou-20 This is FULL of deprecated material! Almost every chapters begin with a note about that.


OpenGL Superbible (5th Edition) http://www.amazon.com/exec/obidos/ASIN/0321712617/khongrou-20 This book uses a library created by the author to explain the main arguments, hiding what you want to learn! I don't want to learn how to use your library! I want to learn OpenGL!


I hope that you understand this is not the same question like "hey I'm not able to use Google... tell me how to learn OpenGL". I've just finished a full and deep search but I can't find a good and complete resource to learn the "new" OpenGL avoiding deprecated topics.


Can someone heading me in the right direction? I know C++ and I have 10 years of experience in development... where I can find a good resource?! I want to spend time on it and I want to learn deeply.



Answer



I agree about the above books with a few notes:





  • The OpenGL programming 8th guide is now out and has be redone for modern OpenGL 4.3.




  • The SuperBible 5th ed, does provide you will a crutch library to start off but as you go through the book you reimplement the functionality of that library so by the end of it you should be fully versed. I also highly recommend wrapping OpenGL stuff in something if your using a object orientated language. I'm working on my own library for fun which seems to be the way to go, implementing it myself I understand all the ins and outs and I only need to put in the bits I actually use. Also you can abstract away some things like sending data to shaders (isn't shinyMaterial.setColor(Red) much nicer), this can also let you backport some stuff by providing legacy alternatives. There is also oglplus.




The main problem with learning modern 'core' OpenGL is that to get a basic pipeline up and running even if it's just to draw a cube you need to understand the following:



  • Matrix operations (use GLM if you on C++, you will also need a MatrixStack OpenGL Unofficial SDK's version here, or my simple one here.)


  • GLSL shader programming.

  • binding data to shaders and Vertex Buffer Objects. If you wanted to learn just real pure core profile they would all need to be implemented simultaneously and if anything is broken you just wont see anything and have almost no clue where it went wrong. That also doesn't cover things like basic lighting (where you need to learn the shading algorithms in addition to the programming language).


But you don't need to start in the deepend with the core profile. Use some of the deprecated functionality at the beginning, just about everything will still support it, then modernize it.


Another issue is that 'modern' OpenGL can really refer to 3 things:




  • The first one is the programmable shader pipline as opposed to the fixed function pipeline. The core 'modern' techniques have been possible since OpenGL 2.0 was released in 2004 when shaders where introduced (the tutorials just didn't get updated) also 1.5 had Vertex Buffer Objects's which are another cornerstone of modern OpenGL. A problem is that even today OpenGL developers might not even be able to take advantage of all that stuff, there are plenty of crappy netbooks out there with those Intel chipsets that only support OpenGL 1.5 and phones such as older iPhones/Android ones that only support OpenGL ES 1.1. The only real difference between this stuff in OpenGL 2.0 and OpenGL 3.x/4.x is it's now mandatory for the core profile.





  • Modern OpenGL could also refer to the new stuff that's in 3.x, 4.x. Things like Vertex Array Objects, Framebuffer Objects, Uniform Buffer Objects/std140, layout qualifiers, GLSL subroutines and so on. Many of those I have found can make things much much nicer to program with. They can also subtly change your overall engine pipelines. They are also things that with a little effort you can backport by making helper functions and so on (For example write a generic shader manager object that you can use to set uniforms, if UBOs are supported use that otherwise manage uploading the values to shaders manually, maybe put a little shader rewriting stuff in there to automate it). This stuff only runs on new video cards, you wont see any netbooks supporting it or any current generation video game consoles (they use their own subset of OpenGL similar to OpenGL ES). The latest OSX only have 3.2 support and I understand that they will be fixed at this version forever since Apple write their graphics drivers and specify OpenGL versions based on the OS version not the GFX drivers/video card capabilities the only way for a user to get a new OpenGL on a current generation Mac would be to pay for an upgrade to a new version of OSX.




  • The Ultra Modern nextgen OpenGL. OpenGL 4.3 was just released. It comes with compute shaders, glMultiDrawElementsIndirect and shader storage buffers. This allows for a fundamentally different pipeline where you upload all the vertex data to the GPU and then use compute shaders to calculate what should be drawn rather than doing it in your program. Unfortunately this is very new so I don't know of any decent tutorials on it. Take a look at the OpenGL 4.3 review which gives an outline of how this works (also the author says there is a GPU Pro article to be released explaining it). Being brand new it's not going to be supported anywhere at this stage (unless you're on a newer nvidia card with beta drivers). Although you might be able to use OpenCL/CUDA to implement some of it.




I would skip glBegin, glEnd, glVertex*, glNormal*, glTextCoord*, glTranslate*, glRotate*, glLoadIdenity, glModelViewMatrix and so on. Instead start with learning Vertex Buffer Objects without shaders, don't try 3D at this point just a flat white triangle so you don't have to work with 3d operations using matrices (as you will need to learn to bind them to shaders soon so no sense in learning to old way). Next add in in the shaders, you will need to change how your vertex buffer objects are bound since you will now want to use vertex attributes. Learn how to communicate properties to them via uniforms. Then learn matrix operations with GLM, bind the matrices to the shaders and get 3D going. Once you have that done then it's basically just learning more advanced things like texturing, lighting and some special features like framebuffer objects, vertex array objects, uniform buffer objects, GLSL routines and so on (those are all things I recommend you have a look at. Most of it is fairly new except for texturing and lighting but if you learn them as shader concepts rather than as OpenGL ones, you should get the modern approach).


Some general online modern OpenGL tutorials, covering the shader programming pipeline that most of which works with OpenGL 2.0+:



For other general learning resources. OpenGL ES might be a good starting point. OpenGL ES has stripped out all the deprecated stuff. OpenGL 4.1 has full compatibility with OpenGL ES so it should be possible to take an OpenGL ES program and run it in OpenGL 4.1. And the basic principles are the same for both.



Some things to note is that OpenGL ES 3.0 has just been released but as it's new, it won't have any tutorials or hardware support yet. It doesn't seem to have any major fundamental changes (like the difference between fixed pipeline and shader model that we saw with OpenGL ES 1.0->2.0). So you probably won't be learning any out of date stuff.


Also, OpenGL ES will often be using EGL so you will need to learn another way to open a Window but that shouldn't be too hard. Otherwise there are a few OpenGL ES wrappers/emulators around or you can learn on Android/iPhone if you have one (or look at using their emulators).


There is the Addison Wesley OpenGL ES 2.0 Programming Guide which is the equivalent of the red book.


You can also look at GLSL shader focused stuff since that's where most of modern OpenGL lives. You just need to ensure what you learn covers the OpenGL binding 'glue' side of things.


Check out the OpenGL Shading Language 2nd edition (Orange Book).


The OpenGL 4.0 Shading Language Cookbook covers some more bleeding edge OpenGL stuff but isn't itself a comprehensive tutorial. Its definitely worth a look to get some understanding in the latest real world OpenGL practices such as uniform buffer objects and GLSL subroutines.


Finally you could have a look at WebGL, although being in JavaScript that is going to be somewhat different and much harder to debug.


punctuation - About using 'so' as a coordinator


I have heard the following usage of 'so' quite frequently in Indian schools:



He was sick so he did not come.



Isn't this incorrect? I prefer this usage:



He was sick, and so he did not come.



My first part of the question is some kind of attestation on whether the first usage is even remotely correct.



My second part is: Could we improve upon the first sentence using some punctuation? Would a comma before 'so' make it correct if it is wrong? Or, should it be a semicolon before so and then a comma afterwards? I am writing them below:



He was sick, so he did not come. He was sick; so, he did not come.



Please give your valuable inputs, people.


PS: I would also like your comments on whether 'so' is a coordinator in itself. Or should it be 'and so'? I would like answers in formal English, as I need this information as a teacher of English and a writer.




opengl - Using two FBOs results in the second FBO having nothing drawn to



I'm writing a deferred renderer, and I use two FBOs: the first one for G-buffer (color, normal, depth) and the second one for lighting (light output), so the first one has three textures bound and the second one has just one.


Now, the geometry pass works just fine and all the three textures are populated correctly. After this, I try to render a full-screen quad in the lighting pass, but nothing comes to the screen - everything is black. I've even tried to use the diffuse shader program in this pass to be sure it's not a shader problem, and it's not - nothing gets drawn no matter which shader I use.


Here's some code (I've pruned out the non-relevant code)-


G-buffer initialization


// Setup buffers and textures
// FBO initialization
geometryFboId = GL.GenFramebuffer();

GL.BindFramebuffer(FramebufferTarget.FramebufferExt, geometryFboId);

// Texture initialization
diffuseTexture = GL.GenTexture();
normalTexture = GL.GenTexture();
depthTexture = GL.GenTexture();

// Diffuse texture
GL.BindTexture(TextureTarget.Texture2D, diffuseTexture);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, scrWidth, scrHeight, 0, PixelFormat.Rgb, PixelType.UnsignedByte, IntPtr.Zero);

GL.FramebufferTexture2D(FramebufferTarget.FramebufferExt, FramebufferAttachment.ColorAttachment0Ext, TextureTarget.Texture2D, diffuseTexture, 0);

// Normal texture
GL.BindTexture(TextureTarget.Texture2D, normalTexture);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, scrWidth, scrHeight, 0, PixelFormat.Rgb, PixelType.UnsignedByte, IntPtr.Zero);
GL.FramebufferTexture2D(FramebufferTarget.FramebufferExt, FramebufferAttachment.ColorAttachment1Ext, TextureTarget.Texture2D, normalTexture, 0);

// Depth texture
GL.BindTexture(TextureTarget.Texture2D, depthTexture);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, scrWidth, scrHeight, 0, PixelFormat.Rgb, PixelType.UnsignedByte, IntPtr.Zero);

GL.FramebufferTexture2D(FramebufferTarget.FramebufferExt, FramebufferAttachment.ColorAttachment2Ext, TextureTarget.Texture2D, depthTexture, 0);

DrawBuffersEnum[] drawBuffers = new DrawBuffersEnum[] { DrawBuffersEnum.ColorAttachment0, DrawBuffersEnum.ColorAttachment1, DrawBuffersEnum.ColorAttachment2 };
GL.DrawBuffers(3, drawBuffers);

GL.BindFramebuffer(FramebufferTarget.FramebufferExt, 0);

Lighting buffer initialization


lightsFboId = GL.GenFramebuffer();
GL.BindFramebuffer(FramebufferTarget.FramebufferExt, lightsFboId);

lightsTexture = GL.GenTexture();

GL.BindTexture(TextureTarget.Texture2D, lightsTexture);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, scrWidth, scrHeight, 0, PixelFormat.Rgb, PixelType.UnsignedByte, IntPtr.Zero);
GL.FramebufferTexture2D(FramebufferTarget.FramebufferExt, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, lightsTexture, 0);
DrawBuffersEnum[] drawBuffers = new DrawBuffersEnum[] { DrawBuffersEnum.ColorAttachment0 };
GL.DrawBuffers(1, drawBuffers);
GL.BindFramebuffer(FramebufferTarget.FramebufferExt, 0);



// Setup a target texture for the render
lightingTexture = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, lightingTexture);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, scrWidth, scrHeight, 0, PixelFormat.Rgb, PixelType.UnsignedByte, IntPtr.Zero);
GL.BindTexture(TextureTarget.Texture2D, 0);

Render call


// Bind geometry pass
diffuseShader.Enable();
GL.UniformMatrix4(diffuseShader.GetUniformLocation("view"), false, ref Camera.main.modelview);

GL.UniformMatrix4(diffuseShader.GetUniformLocation("projection"), false, ref Camera.main.projection);
GL.BindFramebuffer(FramebufferTarget.FramebufferExt, geometryFboId);

// Render the scene
currentScene.Render();

// Clear shaders and framebuffer
Shader.ClearShader();
GL.BindFramebuffer(FramebufferTarget.FramebufferExt, 0);


// Bind lighting pass
lightingShader.Enable();
GL.BindFramebuffer(FramebufferTarget.FramebufferExt, lightsFboId);
// Misc. parameter passing here

// Render a full-screen quad
quadRenderer.Render();

// Clear shaders and framebuffer
Shader.ClearShader();

GL.BindFramebuffer(FramebufferTarget.FramebufferExt, 0);

// Render output
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.ClearColor(0f, 0f, 0f, 0f);

quadRenderer.Render(gBuffer.DiffuseTexture, QuadRenderer.QuadPosition.TOP_LEFT);
quadRenderer.Render(gBuffer.DepthTexture, QuadRenderer.QuadPosition.TOP_RIGHT);
quadRenderer.Render(gBuffer.NormalTexture, QuadRenderer.QuadPosition.BOTTOM_LEFT);
quadRenderer.Render(gBuffer.LightsTexture, QuadRenderer.QuadPosition.BOTTOM_RIGHT); // Draws just black


Hopefully I didn't miss anything important here. I've checked both FBOs, and they are "complete". I've tried to pass a texture to the quad renderer, but it doesn't seem to matter. I've also tried to replace the lighting shader and lighting passes with the geometry ones, and still nothing.




coordination - The indefinite article applied to a group of things


What does applying the indefinite article to a group of things signify?





  1. Inside the box was a pen, pencil and eraser.





  2. Inside the box was a pen, a pencil and an eraser.





Or, perhaps #2 is ungrammatical and you can only use #1?



Answer







  1. Inside the box was a pen, pencil and eraser.




  2. Inside the box was a pen, a pencil and an eraser.





Both version #1 and #2 are fine and grammatical in today's standard English.


There could often be a slight difference in nuance of meaning, such that a speaker or writer might prefer one version over the other in different specific contexts.



As seen in version #1: a coordination of nouns can sometimes combine with a singular determiner (e.g. "a") when there is a close association between the coordinates. And so, the writer can choose that version #1 to show that association to the reader.


An example of this close association is "a cup and saucer", which will usually be preferred over "a cup and a saucer" (but not necessarily always, see next paragraph).


But the speaker or writer might intentionally choose version #2 if they want to emphasize the individuality of each coordinate (e.g. noun). This might happen if the context is one where a character is identifying each item, one at a time, and each item is important in its own right. (In such a context, a writer might choose to write "a cup and a saucer"; perhaps if the cup is not on the saucer or they don't match each other, and the writer thinks that is significant.)


ADDED: I would like to emphasize that sentences like version #2 will in general often be used, as they make no requirement that the coordinates have a close association among them. (E.g. "The barn contained a copying machine and a horse" -- the second article "a" is most likely required due to that lack of close association of coordinates.) And they will sometimes be used even if there is a close association among the coordinates.


As to sentences like version #1, in general, usually, there will be a close association among the coordinates. (E.g. "His shirt pocket held a pencil and pen".)


In general there are restrictions on coordinations of nouns as to how they can combine with determiners.


For more related info, there's the 2002 reference grammar by Huddleston and Pullum et al., The Cambridge Grammar of the English Language (CGEL), section "Number constraints on coordination of nouns", pages 1334-5.


meaning - Speed vs Velocity


What is the difference between speed and velocity ?


The context is Physics



Answer



Let's start with dictionary definitions:



speed: the rate at which someone or something moves
velocity [physics]: the speed that something moves at in one direction



So, as you can see, in physics, velocity is "speed" and the direction (of something that moves).



Or in an example used by Wikipedia, "Velocity is equivalent to a specification of its speed and direction of motion, e.g. 60 km/h to the north": "60 km/h" is a speed; "60 km/h to the north" is a velocity.


(Because this is an English site, I will not go much into physics. Things could get tricky if we talk about velocity in one-dimension, average vs. instantaneous velocity, angular velocity, and so on.)




That's pretty much about it. However, note that this difference is probably only meaningful in the context of physics, as note in an article by WIRED (with useful illustrations):



But what is the difference? If you ask any person on the street, they might say there is no difference. In non-physics use, they would be correct. However, in physics we have very specific definitions for these terms. Surprisingly, not all textbooks agree on the definition of speed.
(emphasis mine)



phrase usage - "within this year" vs "by the end of this year"


If I'd express the thought that the plan will be published at anytime before the end of this year, which of the following two sentences that I should use?



1) The plan will be published within this year.
2) The plan will be published by the end of this year.





word usage - Does the verb 'to busy' require a reflexive pronoun?




It busied me for hours.



When 'busy' is used as a verb, does it always need reflexive pronouns? In the above sentence, I haven't used the reflexive pronoun.


I am asking because in Merriam-Webster I found the following example of usage



the video game busied the child for hours





Thursday, September 21, 2017

meaning in context - How to understand "throwing science at the wall here to see what sticks"?



It's said by Cave Johnson -- an character in Portal2. Full voice line is:



"Just a heads up: We're gonna have a superconductor turned up full blast and pointed at you for the duration of this next test. I'll be honest, we're throwing science at the wall here to see what sticks. No idea what it'll do. Probably nothing. Best-case scenario, you might get some superpowers. Worst case, some tumors, which we'll cut out."



I don't understand throwing science at the wall. In my opinion, what we throw should be a real thing (a ball, a stone), but science is an abstract concept, how could we throw it at the wall? And how could science (or something) stick to the wall?


Please give me some hints to understand that.



Answer



This figure of speech comes from a test to see if spaghetti is cooked. You take some spaghetti out of the pan and throw it at the wall. If it sticks to the wall then it's cooked.


(Do not actually use this test. It doesn't work well and it makes a mess.)


So when you throw something at a wall to see what sticks, you are testing something to find out if it has the quality you're looking for.



'Science' is being used to collectively describe all the inventions and ideas they have at Aperture Science. They are testing them (throwing at the wall) to see which ones work (stick).


c++ - How to apply Data Oriented Design with Object Oriented Programming?



I've read lots of articles about Data Oriented Design (DOD) and I understand it but I can't design an Object Oriented Programming (OOP) system with DOD in mind, I think my OOP education is blocking me. How should I think to mix the two? The objective is to have a nice OOP interface while using DOD behind the scenes.


I saw this too but didn't help much: https://stackoverflow.com/questions/3872354/how-to-apply-dop-and-keep-a-nice-user-interface




punctuation - possessive apostrophe for two things or persons


What is the difference between the two sentences below? Are they the same or different in meaning?



Jack and Laura's new house is almost ready.


Jack's and Laura's new house is almost ready.



To my perception, the first says two of them have one house and the second says each one has a (different) house (which is almost ready). Is my perception correct?



EDIT: If I don't use "houses" instead of "house" (for my second interpretation), does it mean the sentence is wrong?



Answer



Your first example sentence:



Jack and Laura's new house is almost ready.



has the meaning you mentioned; that there is one house and it belongs to both Jack and Laura.


The second example sentence:



Jack's and Laura's new house is almost ready.




Has the same meaning; there is one house that belongs to both of them. This is because of the section 'house is', which indicates a single house. If you were to change that part to 'houses are', the sentence would be talking about two or more houses.



Jack's and Laura's new houses are almost ready.



If 'houses are' is used to indicate there are more than one house, who owns which of the houses is not clear from the sentence. It says that both Jack and Laura have ownership in one or more of the houses, but the houses may all belong jointly to both of them, or some of the houses may belong to one and some to the other.


Wednesday, September 20, 2017

word meaning - Concerns about "have yet to"



Ashya King's parents have been freed from Spanish custody after prosecutors withdrew a European arrest warrant. Brett and Naghemeh King were detained after taking five-year-old Ashya, who has a brain tumour, from a Southampton hospital against medical advice. UK prosecutors said they were happy any risk to Ashya's life "was not as great or immediate as... originally thought". Despite being released from custody, Mr and Mrs King have yet to leave prison, the BBC understands.






  1. What does have yet to mean?




  2. Does its meaning is a fixed meaning in any other context?




  3. Is it about grammar or idiom or something?




Thanks in advance.





ogre - Open-source 3D models easily usable in OGRE3D/jMonkeyEngine



I'm looking for a source of 3D models (cars, game characters, furnitures etc.) which are usable in an open-source 3D game.


I found various website with free/opensource .blend files. However it is not easy to convert them en mass to jMonkeyEngine compatible format. You must open each one in blender, unpack the texture, and then use a python blender plugin to convert them into Ogre3DXML. It is not very convenient.


I want to try out many models, and find out which suits me the best. Converting each one of them by hand is not very scalable.


How do you get models for your 3D games?


Is there a standalone .blend => usable format in jMonkeyEngine/OGRE3D converted?





Tuesday, September 19, 2017

networking - How does delta compression reduce the amount of data sent over the network?


Many games use the technique of delta compression in order to lower the data load sent. I fail to understand how this technique actually lowers the data load?


For example, let's say I want to send a position. Without delta compression I send a vector3 with the exact position of the entity, for instance (30, 2, 19). With delta compression I send a vector3 with smaller numbers (0.2, 0.1, 0.04).


I don't understand how it lowers the data load if both of the messages are vector3 - 32 bit for each float - 32 * 3 = 96 bits!


I know you can convert each float to a byte and then convert it back from a byte to float but it causes precision errors which are visible.




unity - Method causes OutOfMemory error


If a GameObject in my game has a special ability it triggers it, but I want all the special GameObjects that this GameObject affects to also trigger their abilities, for example if a bomb hits some objects, if these objects are also bombs, trigger them too. I though this would be easy by calling the method that handles all the special abilities recursively, but, as always, it wasn't. Basically what happened is a chain reaction of bullcrap that caused Unity to show an OurOfMemory error. Also makes my PC freeze completely while politely turning all the screens off.


The question is, how can I make it so it triggers all the affected cubes' special abilities, without everything going nuts?


Code:


     //Triggers the cube's special ability, if it has any
private void TriggerSpecialCubeAbility(GameObject specialCube) {
switch (specialCube.tag) {

//Destroy all cubes in a radius from the special cube
case "Bomb":

TriggerBombAbility(specialCube);
break;

//Destroy all cubes of the same color as the special cube
case "Lighting":
TriggerLightingAbility(specialCube);
break;
default:
break;
}

}

private void TriggerBombAbility(GameObject specialCube) {
var nearbyColliders = Physics2D.OverlapCircleAll(specialCube.transform.position, explosionRadius);
Instantiate(particles[0], specialCube.transform.position, specialCube.transform.rotation);
Instantiate(particles[1], specialCube.transform.position, specialCube.transform.rotation);

foreach (var collider in nearbyColliders) {
if (collider.tag == "Indestructible")
return;


var affectedCube = collider.gameObject;
TriggerSpecialCubeAbility(affectedCube);
Destroy(affectedCube);
}

destroySelectedCubes = true;
// Physics2D.gravity *= -1;
// Physics.gravity *= -1;
}


Answer



First of all, you seem to have a bug in TriggerBombAbility(): that return should be a continue.


Now a quick way to fix your issue of infinite recursion is to devise a way to mark a GameObject as no longer triggerable. For instance you could have a hasBeenTriggered boolean, defaulting to false, and you set it to true before triggering abilities:


       case "Bomb":
specialCube.hasBeenTriggered = true;
TriggerBombAbility(specialCube);
break;

Then you only call TriggerSpecialCubeAbility() if the ability hasn’t already been triggered:


        var affectedCube = collider.gameObject;

if (!affectedCube.hasBeenTriggered)
{
TriggerSpecialCubeAbility(affectedCube);
Destroy(affectedCube);
}

Alternatively, you could put that check in TriggerSpecialCubeAbility() itself and do an early exit: Nevermind; this would require a check around Destroy(), too, and is therefore more complicated.


unity - Generate static 2D Tilemap from array


How do I generate a 2D tile map from an array like in this tutorial for XNA ? I basicly want to generate a static map based on my tile prefabs.




Answer



Its actually very similar to the way it is done in XNA , only a few changes in the syntax and loading approach.


Here is the most basic way in which it can be done. You can build on top of it as per your needs.


Before we start, we need to make some tile prefabs and store it inside the resources folder.


enter image description here


Lets define some variables, and initialise them some default values.


    //Your Tile Map
public int[,] tileMap = new int[,]
{
{0,1,2},

{1,1,0},
{2,2,2}
};

public float TileSize;
public Vector2 StartPoint;//top left corner of the map

// Use this for initialization
void Start ()
{

TileSize = 1;
StartPoint = new Vector2 (1, 1);
PopulateTileMap ();
}

The StartPoint is the top left corner of the map. So you can define from where it should start populating on the screen.


Now lets look at the core logic behind populating the tiles , as per our tilemap.


public void PopulateTileMap ()
{
for(int i = 0 ; i < 3 ; i ++)

{
for(int j = 0 ; j < 3 ; j ++)
{

GameObject prefab = Resources.Load ("tile_"+tileMap[i,j].ToString()) as GameObject;
GameObject tile = Instantiate(prefab, Vector3.zero, Quaternion.identity ) as GameObject;
tile.transform.position = new Vector3(StartPoint.x + ( TileSize * i ) + ( TileSize/2) , StartPoint.y + (TileSize * j ) + ( TileSize/2), 0);

}
}

}

Here we instantiate the prefabs from our resources folder. The name is created as per the tile map we have defined earlier. For position, adding the tile size to the starting point will give the top left corner of the individual tile. But as our pivot is in centre we add an extra offset of (TileSize/2).


Hope this resolves your doubt :)


american english - I have to go vs I have got to go



Can we say one of them is more American English or British English?


I have to go to school.


I have got to go to school.


I got to go school.



I gotta go.


Gotta go.




Monday, September 18, 2017

opengl - How to rotate an object around a fixed point?


I have a walking stick:


enter image description here



Some information:



  • The handle is fixed, it cannot move

  • The bottom part can move


Using the mouse click position and mouse movement, how can I rotate this stick with OpenGL?




grammaticality - a software -- can "software" be used as a count noun?


Example:



Some people like to do this using a dedicated diagramming software, like Microsoft Visio.




A friend of mine, who is a native English speaker, says that this sentence doesn't sound weird to him at all. But isn't it true that the word software is inherently a mass noun, so no articles are possbile or is he right that software can be used as a count noun to mean something like program and application? I actually have never seen software used as a count noun like that. I always thought that this word was a mass noun and could not be anything else. What do you guys think?



Answer



My experience has always been that software is an uncountable or mass noun.


I would phrase your sentence as Some people like to do this using dedicated diagramming software.


The usual "unit of measurement" for software is piece. I need a piece of software for diagramming means I need a diagramming application. This seems to be by analogy with silverware and other similar words.


"Six women were there" - is six a noun or an adjective?



Six women were there.



Is the number "six" a noun or an adjective here? Or maybe "six women" is a compound noun?




Answer



When six is followed by a noun, it is an adjective.



The six women put on an outstanding performance


A six-woman team was set up to deal with the problem


Six women were arrested by police



When no noun follows, the six is itself a noun or pronoun.



He wrote a six on the cover of his book (noun)



When he played a six, we knew the game was over (noun- playing cards)


The six from Atlanta played well (noun - a hockey team has six players)


He hit the ball for a six - (noun - cricket term for a stroke that wins six runs)


set the table for six (pronoun representing six people)



Sunday, September 17, 2017

Unity 3d auto-move player forward script


Trying to write a basic script to attach to the player on Unity 3D, I want them to move forward automatically. I'm guessing that will be part of the Update function and using transform, but that's about as far as I get.


I'm assuming it's a Transform.translate function too, but not sure what parameters to use to move forward 1 m/s automatically (for example). Also, how do I block W and S keys moving forwards and backwards, and instead use the for up and down? (My character is 'floating' and I'm looking to incorporate space harrier style controls)



Thank you!



Answer



The first sample code is what you want. http://unity3d.com/support/documentation/ScriptReference/Transform.Translate.html


function Update() 
{
transform.Translate(Vector3.forward * Input.GetAxis("Vertical") * Time.deltaTime);
}

Vector3.forward is the same as (0,0,1), and transform.Translate() is local translate, so Translate(0,0,1) is always moving forward. Time.deltaTime let speed equal to 1 m/s.


And you can change the default key in "Input Manager" http://unity3d.com/support/documentation/Components/class-InputManager.html



grammaticality - 'the body politic' vs "the politic body"


According hereto, politic (with NO s) is an adjective or verb, and not a noun. So shouldn't the body politic be "the politic body" instead? Are both legitimate? If so, what are the similarities and differences?



Source: p 186, The Legal Analyst, Ward Farnsworth



We have been speaking of three usual parties to these situations: the author of the rule, the enforcer of it, and the party to whom it applies. But there may be a fourth party consisting of the body politic; members of the public may take an interest in the law not because they are concerned about how it applies to them personally but because they are wondering if the law ought to be reformed.





Does "before" make the Perfect Tense redundant?


(Sorry for bothering you again with the Perfect Tense, I hope it ends soon.) I took a quiz and a grammar website said that I made a mistake.



Right sentence:



When I showed up to take a look around, there were at least twenty other people who had arrived before me.



My sentence:



When I showed up to take a look around, there were at least twenty other people who arrived before me.



In the second clause I used just arrived because I thought that the word before does all the job. Is it a real mistake? What sentence does sound better? Does “before” make the Perfect Tense redundant?



Answer




You are right that before with the past perfect makes it somewhat redundant. However, using the past perfect is the correct version of the sentence. The sentence is narrating the past and needs to describe a prior event, the exact purpose of the past perfect tense.


As StoneyB pointed out, the key to realizing that the past perfect is needed here is the when clause. The phrase when I showed up specifies a reference time in the past. In order to then talk about something which happened prior to that reference time the past perfect tense is necessary.


And about the redundancy, time adverbials (such as before) with past perfect can make it slightly redundant, but in a clarifying way. It's similar to specifying "positive 2" instead of just "2" as an answer on a math test, it becomes slightly redundant, but is more specific and clear.


So in summary, past perfect + time adverbial is a slightly redundant, but completely correct, grammar construction. And generally speaking, past simple + time adverbial is not a sufficient replacement for the past perfect tense.


meaning - Does "expect" and "expected" make any different sense?


Please help me figure out this two expressions:


"What do you expect to know?" and "What are you expected to know?"




Saturday, September 16, 2017

education - Should I consider a graduate degree in game development?



I am sure you guys can definitely help. Some universities, like NCSU, USC, UCSC for their master's, offer courses based on gaming and game development (some call it MS in Computer Science with an emphasis on game development). I am very interested in this field and I want to give it a shot. But since a master's degree is very costly I have to factor in the future prospects as well. I want to know if this a proper course when a career is also taken into account. Any opinions or ideas? Anyone who has followed this career line?



Answer



I agree completely with mrbinary's answer. I am a student at UNC Charlotte and we have a Game Design and Development concentration with our Computer Science degree (in the Bachelor's and Masters track). Essentially you take four classes: Intro to Game Design and Development, Advanced Game Design and Development, Game Studio (a semester long project class), and an elective class pertaining to something related to games (AI, Games with a Purpose, 3D Graphics, etc.). I also work in a research lab for the University run by the professors that created the Game Design and Development concentration doing research and development of Games with a Purpose. I have many friends who have gone through the program, and I completed it halfway through.


Long story short, everyone I know that has completed the program (some bachelors, some masters) and graduated, then sought out a job in the gaming industry, have failed to get a job. Due to my research work, I have travelled to many game related conferences to present work and see other work in the field, and this discussion has come up a lot. One cool thing about these conferences is that people from industry will attend, as well as academics. What I've heard from many people in industry (and this is backed up by none of my friends who went through our degree program getting jobs in the gaming industry) is that going through a Game Development program may actually hinder your ability to get a job in the gaming industry. This is because the games industry is so diverse in terms of how they develop games. Some companies may use C++ as their language of choice, but use it within a custom engine or a custom framework. Others might use C#, others a scripting language (Lua, ActionScript, etc.), others may focus solely on mobile development and use Objective-C or Java, others may build flash games. The choice of programming languages and development environments are extremely diverse. The problem with Game programs at Universities is it gets you experience in one specific framework and methodology of game development that may not always translate to a game companies needs.



Our program used to teach XNA and C# (which limited us to Windows and XBOX only games), and has now moved into using Unity and JavaScript, as well as WebGL with HTML5. The reason for the transition was that learning XNA and C# for 2 years was getting the graduates nowhere. The game industry has transitioned greatly in the last few years away from consoles to mobile devices and web games, so our curriculum was changed to accommodate for that. It is yet to be seen if this helps our graduates find jobs or not. From my circumstantial observations, plus what I've heard from discussions with people from industry, a Games concentration may not be beneficial when trying to get a job in industry. Of course, if you want to becomes a Games professor, then it's probably just fine! A regular Computer Science degree and some of your own portfolio projects will get you further than a degree focused on games, in my opinion.


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...