My white neighbor thought I was breaking into my own apartment - <AUTHOR> https://www.washingtonpost.com/posteverything/wp/2015/11/18/my-white-neighbor-thought-i-was-breaking-into-my-own-apartment-nineteen-cops-showed-up/?tid=sm_tw <comment> jack-r-abbit I quote the author: _Not long ago, I was walking with a friend to a crowded restaurant when I spotted two cops in line and froze. I tried to figure out how to get around them without having to walk past them. I no longer wanted to eat there, but I didn't want to ruin my friend's evening. As we stood in line, 10 or so people back, my eyes stayed on them. I've always gone out of my way to avoid generalizations. I imagined that perhaps these two cops were good people, but I couldn't stop thinking about what the Santa Monica police had done to me. I found a lump in my throat as I tried to separate them from the system that had terrified me. I realized that if I needed help, I didn't think I could ask them for it._

I'm not sure what she intended to say with this closing paragraph but it seems like she has come to realize why some people get uneasy around certain other people. If you have had bad experiences with some members of a particular group (cops, PoC, lawyers, etc) you might have reservations about future interactions with other members of that group. Even if she doesn't like that she has those thoughts, she is admitting to trying to avoid some people just based on her past experience. This is exactly what other people get called racist for feeling. Something to think about.

</comment><comment><USER2> When I was in HS I forgot my keys, I tried climbing in thru the second floor, neighbors called the cops, cops showed up and asked for ID, showed it to them and incident over.

I didn't get mad at my neighbors. I'm rather grateful they were looking out for neighbors' property, even if they didn't take the time out to determine if it was me or a burglar. I don't expect them to call out to me to confirm I was the person who lived there. Another occasion, my friend lost keys to a chained up scooter. So we took a cutter, it was not easy to break the lock, neighbors seeing us also called the cops. We looked suspicious. Breaking into my house looked suspicious and I'm glad the cops came to investigate. They're supposed to.

Now, it's true, they didn't point guns at me/us in either occasion, but my friends who had similar incidents did have five cops with guns show up in a different instance, maybe because it was night.

I should also point out, I do believe the police have overmilitarized over the last decade(s) and overly aggro, but that does not mean I want them to stop from doing good policing (investigating suspicious activity)

</comment><comment><USER3> I once accidentally mistook my white neighbor as a burglar, as he tried to break into his front door with a plastic snow shovel at 3 in the morning. At least a dozen cops showed up - six police cars, including a K-9 unit. Needless to say I was embarrassed and felt bad, but my neighbor was too drunk to remember. This is in Michigan, so it really does seem to be common practice to send half the force to a burglary in progress. The cops handled it well.

On the flip side of that, cops in Ohio illegally entered my brothers apartment with guns drawn while he was at work, terrifying his wife who called him saying people were breaking in, causing him to race home at very unsafe speeds while trying to contact the local police. When entering they didn't identify themselves, laughed at my sister-in-law, and didn't apologize for having the wrong address. Despite checking with a few lawyers, they were told there's nothing to be done other than file a complaint with the police.

<comment><USER4> As a European, this just reinforces my belief that South Park is a documentary, not a comic extrapolation of reality... :/

I mean.. to begin with, what can they accomplish with 6 cars with 2 cops each that they can't with a third of that force?

Not to start with how much more complicated it must be to coordinate 12 cops compared to 4.

From a foreign perspective: Americans always seem to try brute force, as opposed to something balanced.

My theory: We get better police officers in Scandinavia since it's not a low- paid job here, relatively speaking. It's not a way of the local power-hungry losers to get the positions of power they crave. I know few local and young police officers here; it's my honest assessment that none of them went into this line of work because they craved power.

<comment><USER5> I don't think it's so much try brute force as it is "use it or lose it".

This thinking is pervasive throughout all levels of government in the US. Let's say the police do decide to send three cop cars instead of six, and do so consistently. When it comes time to request budget money, the people in charge of handing out that money can say, "well you don't really need as much funding since so many of your cops are sitting idle at a given time."

<comment><USER4> So people are dying (because of overblown, badly coordinated) police efforts and the reason is the way funds are allocated in the US?

That makes me even sadder. Sounds plausible though.

</comment></comment></comment></comment><comment><USER6> >> I demanded all of their names and was given few. Some officers simply ignored me when I asked, boldly turning and walking away. Afterward, I saw them talking to neighbors, but they ignored me when I approached them again.

Protect and serve...

</comment><comment><USER7> Happened to my one of my half-black friends when we were growing up. In Cupertino of all places.

<comment><USER8> Bear in mind that the police presence, and number of officers responding, had _nothing to do with her being black_ , given that it was wholly in response to the report about a _Hispanic_ "suspect".

</comment></comment><comment><USER8> Santa Monica police chief's perspective:

[http://santamonicapd.org/Content.aspx?id=54286](http://santamonicapd.org/Content.aspx?id=54286)

<comment> jack-r-abbit Wow... she was _really_ rude on that audio clip. I understand she was a bit freaked out but she was rude while the cops were being very calm with her. She just keeps talking in circles, interrupting them, asking the same questions over again but ignoring the responses. Oh and the clapping. I can totally picture this scene.

</comment></comment><comment><USER9> Why the guns.

<comment><USER8> It's standard to have guns drawn when doing a sweep in response to any report of an unauthorized presence in one's home, even _without_ a claimed eyewitness to a break-in, as in this case.

Years ago, after I bought a new house but had not yet moved in (I was moving individual loads as I had time), I came to the new place to find an upstairs light on. Now, I was fairly sure I would not have done that without noticing as I left, but I saw no sign of forced entry or active presence. So, I called the police, explained that this was _probably_ just my screwup, but if you have an idle unit, could they stop by when they have a chance?

Two officers responded, did a sweep of the house, guns drawn, finding nothing, and were very nice about it all. <facepalm>

</comment></comment><comment><USER10> Absolute trash article.

"I would be dead in the stairwell outside my apartment, because something about me — a 5-foot-7, 125-pound black woman — frightened this man with a gun."

Nice narrative there. Edit: Pigs will be pigs by the way, so I'm not surprised at some of them walking away without giving their names and badge numbers.

</comment><comment><USER4> Another way of looking at it: Someone's visual attributes combined with their behavior caused a concerned neighbor to call the police.

Yes, profiling does work, statistically speaking. Yes, it sucks to be profiled, but yes, (potential) victims are also very thankful when profiling does stop a crime.

My advice: if she is really concerned about this, she should work on reducing crime perp stats for black people.

<comment><USER11> That's some very serious victim blaming you have going on here. You should be ashamed of yourself.

<comment><USER4> I refuse to be ashamed of thinking that profiling based on visual appearance works, since it obviously does.

What can be called into question though is the mentality of US police: "Shoot first, ask questions later." They should learn from European police in this regard.

<comment><USER12> I'd like to question your assertion that such profiling obviously does work. A quick google search finds plenty of material claiming the opposite, but since you said it I was wondering if you could back this up at all.

<comment><USER4> [http://www.huffingtonpost.com/daniel-wagner/what-israeli- air...](http://www.huffingtonpost.com/daniel-wagner/what-israeli-airport- secu_b_4978149.html)

<comment><USER12> If I'm reading this correctly, the security methodology is to screen all people who arrive at the airport with trained agents using "age, race, religion and destination" to determine how the interview should go. This is somewhat different from the kind of profiling we are talking about because a) they screen everyone who passes through and b) their assumption has to be that nearly 100% of people passing through the airport are innocent vs this kind of "that guy looks guilty" profiling.

I have some links: [https://www.schneier.com/blog/archives/2005/07/profiling.htm...](https://www.schneier.com/blog/archives/2005/07/profiling.html) \- a blog post by someone respected by many here on when profiling can be effective vs the risks

[http://www.scientificamerican.com/article/racial- profiling-t...](http://www.scientificamerican.com/article/racial-profiling- terrorism-statistics/) \- discussion of when it might be appropriate statistically based on a study

I haven't found anything that implies that it would be effective in this sort of case.</comment></comment></comment></comment></comment></comment>


Show HN: Procedural Planet Generation - <AUTHOR> http://jarettgross.me/Procedural-Planet-Generation/planets.html <comment><USER2> It's too slow :(.

Are you generating all the points of view before showing it? Can you show a work in progress view of the intermediate steps?

<comment><AUTHOR> I'm generating the entire mesh before showing anything. I'm tentative to display in-progress steps since that would slow it down even more as I'd have to add and remove meshes from the scene. There is a progress bar indicator at the top of the screen to show that something is happening.

<comment><USER2> The progress bar at the top finish long before I can see the image.

I think you can try how it feels when the page shows the intermediate steps. Sometimes a slower page with some intermediate result is nicer than a faster page that is blank for a long time. Something like a splash screen.</comment></comment></comment>


Ask HN: Multiple awesome work opportunities - advice? - <AUTHOR>

So, I currently have a couple of amazing opportunities (that I'm incredibly thankful to have) and I'm hoping some fellow HN'ers who have been in this situation can give me some advice.
A few facts about me:
- Under 25 - Engaged - 1 year-old son
I'm a senior-level front-end developer, mid-level Node.js developer, senior-level designer (UI & UX/web), and have a decent amount of auxiliary knowledge and experience (enough to be a successful freelancer before joining my current employer).
I'm happy with everything about my current employment but the pay, and it doesn't look like that's going to change soon.
I have been contracting with a startup in San Francisco for the past couple of months, with the intent of joining them full-time once they raise more funds. I live pretty far away from SF, so if I moved there it would be a big deal and I'd like to be there for a long time (at least 2-3 years). I'm worried about how much time I'd spend working at this company (I've been made to understand there will be a LOT of burning the midnight oil) but I also believe this company has serious potential.
My other opportunity is to co-found another development shop with a co-worker. We've worked closely and pair-programmed on several projects at my current job (with great results).  We both have pretty sharp business acumen, and I'd consider us good friends. We plan on growing into a products company along the lines of 37Signals/JetBrains/Atlassian.
Both have decent risk profiles, but I'm confident that if either didn't work out I'd find a way to keep food on the table.
Just the act of writing this down has helped me clarify my thoughts, but I'd really appreciate any advice you guys/gals can give (and don't worry about my feelings - if I sound crazy, tell it like is).
Thanks a bunch! <comment><USER2> You don't sound like you can't miss too badly. Many good options.

Decide now, before you get drawn in, what your specific minimum acceptable financial and family time goals are.

If you are going to burn the midnight oil, you get less time with your son and your soon to be wife. Talk to her about it. You want to be a unified team that has a battle plan that you both support and work toward.

Those things you name and want, be sure you are measuring them and getting them. If you succeed and make a lot of money, it can feel right to chase the money long after you've made plenty. If that is a choice you made and own, that's good. If it is a place you wake up and find yourself in, that is not good, even if the result is good.

If you set family as your top thing, don't go home to strangers. Don't be the always too exhausted to interact guy.

If you set money as the top thing, make sure your wife is part of that path and not some other ball you have to try impossibly to hold up. Do this either by her direct participation or by taking the time to keep her looped in when you get home - but do it. She is on your team and you are on hers.

</comment><comment><USER3> Flip a coin and see if you feel you agree with the result internally.

Also I'd like to remind you that there are other fancy choices other than the two - think what you would like to have in your life first.

<comment><AUTHOR> I was actually just about to post a comment, totally forgot to mention my priorities.

My family is my top priority - both spending time with them, and providing a comfortable (but not extravagant) lifestyle.

Second priority is not working myself to the bone. I consider myself a hard worker, and I'm willing to put in an all-nighter where it's needed, but anything over 50 hours per week is not cool.

Finally, I'd like a job where I enjoy my work and have room to grow. I know I won't love every minute of it no matter what I do, but as long as it's not a grind and there's a (fairly) direct relationship between hours in and reward out, I'm game.

I'm not looking to "get rich" \- there's plenty of time for that. Right now though, between contracting and my day job, I work 60+ hours/week and I hate it (but I need the contracting to supplement my income). I still make time for my family but this means sacrificing sleep to make deadlines and I don't wish to continue this any longer than I have to.</comment></comment>


Ask HN: How do I know if I'm violating my non-compete at a major tech co? - <AUTHOR>

I'm an engineer for a major company that you've heard of (Google, Microsoft, Amazon, Apple, etc).
Upon joining, I signed an NDA and a non-compete saying that I can't work on anything that directly competes with the company. But these days all of these companies are working on something major in just about every area of tech.
I'm working on a side-project that I wouldn't consider directly competing, but I could see how one could choose to interpret it that way. But given the array of services these companies offer I feel like I could take almost any project and point out a way it is competing with some if not all of these companies.
Is it actually reasonable to do a side project while working at one of these unless the concept is extremely unique? How can I have any confidence that my project will be safe if successful? <comment><USER2> Dear protoDude,

I am not a lawyer, but did spend some time investigating this after I moved to the US from Belgium. First of all, it appears that state law determines whether or not non-compete clauses are even legal or enforceable. If you are currently living and working in California, for example, you most likely have nothing to worry about.

I have always found the following to be a the best approach in a situation such as this... During contract negotiations, provide a list of 'prior inventions' which are excluded from any non-compete agreement. In Europe this is standard practice, especially when contracting. Secondly, while under contract, and, when you are about to embark upon a new personal project, get sign-off from your manager that these efforts do not create a conflict of interest in your current role at the company.

There are multiple reasons for you to make sure that you dot the i's and cross the t's! You want to make sure that your employer is aware of the multitude of talents you exhibit and is aware of the products you are developing. And for you, it is imperative to make sure that whatever it is you are doing does not constitute a breach of contract. I believe that the benefits and hazards are obvious to this approach.

Finally, I would like to emphasize that your decision to contribute to the success of a company is not a one way street! When embarking upon contract negotiations or re-negotiations as described above, you need to make sure that you fully support your own decision to continuing to help your employer grow. If there is little to no support for the personal growth in which you are interested, you should terminate the contract and, if appropriate, find an employer who does support you as you support them.

Frank.

</comment><comment><USER3> It's irrelevant whether or not you think it's competitive to your employer's business. You can't have any confidence that your project will be "safe". If it has any value, your employer will make the call on whether they view it to be competitive or not. Furthermore, if it's utilizing the same skills you utilize at the employer, they may well stake a claim to it.</comment>


Ask HN: Cargo like software for Python and C - <AUTHOR> Is there any super simple package manager and project creator for Python and C like Rust's cargo ? <comment><USER2> Depends on your definition of simple.

C - Autotools for creation - yes, it's complicated. Since Rust is way more restricted than C code, it's always going to be more complicated to create/compile/manage C projects from templates.

Python - Pip for manager. Paste for creation from templates.

<comment><AUTHOR> These look good, thanks!</comment></comment>


Game Loop - <AUTHOR> http://gameprogrammingpatterns.com/game-loop.html <comment><USER2> While this book seems to get a lot of praise (as it deserves, obviously), I wish the style of teaching complex programming topics walked me through the pain of making something work, exploring a few alternative solutions, showing the tradeoffs, and then after the pain has been experienced by the learner, a proper solution is finally introduced and recommended. IMO it's a much more powerful technique for teaching if you walk the learner through the pains first, then arrive at a solution, and tell them that "you've just invented the game loop!"; i.e. the concept is given a name at the _very end_, not defined at the beginning as a solution to a pain the learner never experienced. Unfortunately very few books/tutorials take this approach.

<comment><USER3> Author here.

This, I think, one of the fundamental challenges of teaching software architecture or other higher-level engineering topics. A lot of architecture boils down to:

1\. Here's an obvious simple way to solve a problem, X.

2\. If you do X at scale, much later, you will run into pain.

3\. So here's Y, which seems weird and non-obvious but solves the same problem as X without the pain.

It's _really_ hard to teach people step 2 when they haven't experienced it first-hand. You can walk them through scenarios, but most scenarios small enough to fit in a reasonable amount of prose feel fake and contrived.

Even when this does work, you can end up with a generation of programmers that cargo cult Y without any real understanding of the original problems it avoids from X. Look at, for example, how "goto" is now a boogeyman in programming well beyond the narrow concrete problems Dijkstra had with it.

For many of the chapters of the book, I try to walk readers through the problems of simpler approaches as well as I can, but it's a continuing challenge. There really is no substitute for experience.

<comment><USER2> Thanks Bob, I appreciate your response. To be honest, I haven't read the entire book. However, I looked at the table of contents, and it appeared to be a run-down of well known game design patterns. For someone who wants to get educated on those patterns, that's probably fine. For someone new to the topic of game programming, they're probably going to benefit from the style I described, e.g. hand-holding them in creating a game from scratch, progressively going from simple to complex after understanding the pains along the way, introducing new concepts as needed and just-in-time. So this may have been just an issue of understanding who's the audience of the book.

That being said, the point about doing X at scale wasn't my issue. Take for example programming language books and/or documentation. The typical approach in almost every book/guide is teaching you about syntax, data types, control structures, etc. While this is valuable information, it's not usually what a person new to the language is looking for. What they're looking for is (most probably) what is unique about this language in solving specific domains of problems. New to Erlang? You probably should be introduced to a problem that deals with concurrency and reliability, and get walked through an example of how Erlang can solve it elegantly. New to Python? You should probably be introduced to a problem that deals with manipulating data, and get walked through an example of how Python can help you wrangle data easily. Etc.

> For many of the chapters of the book, I try to walk readers through the > problems of simpler approaches as well as I can, but it's a continuing > challenge.

Please continue to do so. I'm sure the praise you get for your book is well deserved, and part of the reason is your approach to teaching the patterns.

> There really is no substitute for experience.

Agreed. And part of the teaching style I'm advocating for is making the learner "earn" the skill by showing them the way, not the destination.

</comment></comment></comment><comment><USER4> I have a funny story about the deWiTTERS game loop that I wrote a long time ago (referred to in the article above)

Back then I was doing mobile game development for PocketPC.

After I left that company, some ex-colleague had to do some changes in my code, or port it, I can't remember. So he was looking at that game loop that I implemented, and was thinking "What the hell is he doing here???". So he did a google search to see if he could find something, and immediately stumbled upon an article, written by that same programmer :D.

He told me years later when I saw him, and said "What are the chances that you search something on google because of code you're going through, and find the article that explains it written by the same programmer".

I was still a junior back then, so probably I should have commented my code a bit better (instead of not at all ;)).

I still want to write a revised deWiTTERS game loop article, because the steps in a physics engine could make the extrapolation redundant.

<comment><USER5> When I google "game loop", I found deWiTTERS Game Loop, [http://www.koonsolo.com/news/dewitters- gameloop/](http://www.koonsolo.com/news/dewitters-gameloop/) which I still not fully understand.

<comment><USER4> What is the part that is not clear?

<comment><USER5> The sconed part "Game Speed dependent on Variable FPS". I'm confused about the parameter of function "update_game()". From the code, I think the time length of "curr_frame_tick - prev_frame_tick" would increase at each timestep beacause of function "display_game()".

<comment><USER4> display_game() doesn't change any of these values.

(curr_frame_tick - prev_frame_tick) is the delta time of each loop. So this value is the time it took to do the previous loop.

It doesn't increase each timestep because prev_game_tick is recalculated each step.

Step1 (initial step):

\- prev_frame_tick = 0

\- curr_frame_tick = 0

\- delta = 0

Step2:

\- prev_frame_tick = 0

\- curr_frame_tick = 200

\- delta = 200

Step3:

\- prev_frame_tick = 200

\- curr_frame_tick = 356

\- delta = 156

...

<comment><USER5> Fair enough. I think I didn't understand the difference between game time and real time before. I though the running time of "display_game()" was the game time (curr_frame_tick - prev_frame_tick). Thanks a lot for your detailed explanation.

</comment></comment></comment></comment></comment></comment><comment><USER6> After playing around with making a simple, somewhat function programming-style engine [1], I came to the conclusion (from other people's work) that the game loop is really just iterating on a pure function call that gives you the next world state given the previous world state:

      next_world_state = UpdateWorld(inputs, previous_world_state)

Where inputs is all external inputs (user inputs and "time"). How the inputs is updated (and how frequently) is totally decoupled from how the game engine operates. Additionally, from the next_world_state, you can derive what to render to the screen, what audio to play, what text to render, etc. If you want to drop frames, just don't render each world state.

[1] [https://github.com/allenu/YokosukaJS](https://github.com/allenu/YokosukaJS)

<comment><USER7> Just read something similar with Urbit: [https://urbit.org/docs/introduction/technical- overview/](https://urbit.org/docs/introduction/technical-overview/)

Taking that concept to an operating system essentially.

> Your urbit is a deterministic computer in the sense that its state is a pure > function of its event history. Every event in this history is a transaction; > your urbit's state is effectively an ACID database.

> Because each urbit is deterministic we can describe its role appropriately > in purely functional terms: it maps an input event and the old urbit state > to a list of output actions and the subsequent state. This is the Urbit > transition function.

</comment></comment><comment><USER8> One example of a problem with variable frame rate physics simulation was Quake 3, which allowed you to make otherwise impossible jumps if your frame rate was 125fps. This value exploited the rounding errors in the jump height calculation to get extra jump height. Some custom maps even assumed you'd be running at 125fps and would be unplayable if your hardware couldn't keep up.

Demonstration and explanation here: [https://www.youtube.com/watch?v=P13KmJBNn1c](https://www.youtube.com/watch?v=P13KmJBNn1c)

OpenArena added an option for fixed framerate physics, and an option to disable the rounding.

<comment><USER9> One effect of linking game and real time was seen in Dark Souls on PC (at least it seems like that's what happened): the game was capped at 30fps. Once people hacked out the frame limiter their character's gear degraded at a higher rate.

<comment><USER10> In DS2 they released the PC version at 60fps, and consoles at 30. The equipment degradation was based on the number of frames a weapon's hitbox spent overlapping another model (walls, enemies, etc). They patched this pretty quick.

</comment></comment></comment><comment><USER11> Game loop based systems have trouble using more than one CPU effectively. This is a big problem, since we can now get more CPUs, but not faster ones. The audio guys are happy - they can finally get their own CPU, or a big piece of one, and get out of the game loop. (Audio guys liked the Cell. Nobody else did.) The AI guys are usually running on a much slower schedule than the frame rate, so they're OK with this. The rendering guys think they own the game loop. The physics guys are struggling; they always need more CPU time. The asset loading guys are I/O bound anyway. Back in the main loop, the name of the game is not getting stalled on locks on shared data.

(Somewhere in the Second Life viewers, there's a lock conflict which causes disk delays in loading assets from the local cache to stall input processing in the main loop. All the disk I/O is in other threads, and those threads can talk directly to the vertex buffer memory in the graphics card, so this shouldn't be happening. But it is.)

<comment><USER12> "Multithreading the Entire Destiny Engine" is a 2015 GDC talk by Bungie's Barry Genova explaining how Bungie turned almost every part of Destiny's engine into a job graph that can be processed in parallel.

[https://youtu.be/v2Q_zHG3vqg](https://youtu.be/v2Q_zHG3vqg)

</comment></comment><comment><USER13> Space Invaders exploited the render-dependent timing of it's game loop to increase the speed of movement as the kill count increased.

[https://en.wikipedia.org/wiki/Space_Invaders#cite_ref- RG-3_1...](https://en.wikipedia.org/wiki/Space_Invaders#cite_ref-RG-3_13-5)

<comment><USER14> Yeah: from careful observation Space Invaders seems to move one alien every frame, hence the fewer aliens the faster it gets. I started playing around building my own version, but it's never got beyond the prototype phase: [https://arcade.ly/games/space-invaders](https://arcade.ly/games/space- invaders). I'd love to be able to use lack of time as an excuse but it's really lack of motivation.

</comment></comment><comment><USER15> The book is overall excellent. I learned way more from it (and had way more fun) than I did ever reading something like the Gang of four or its various explanations.

Best book to learn programming patterns in general if you ask me

<comment><USER16> I love this book as well. I think part of what makes it so good is that the patterns are discussed in a very domain-specific context and their usage is not overly abstracted. I often find it hard to see why a particular "widget" or "foo/bar" pattern or structure is used/useful, but when you put the examples in a very specific context like this, it's much easier to understand their value and remember why/when/how to use them.

I wish there were other Pattern and Software-Engineering books that discussed things in more domain-specific contexts, but I suspect game development is one of the few domains large enough, and with enough people looking for domain specific literature, to really warrant such a book.

<comment><USER3> The secret subtext of my book is that almost all of the patterns are perfectly useful outside of games too. Very few patterns here are specific to games (though "Game Loop" is one of them).

Maybe it's just me, but if I'm going to read a few thousand words about some piece of software architecture, I'd rather be reading about trolls and magic than employee record databases.

<comment><USER16> Thank you very much for all your work on "Game Programming Patterns." It's an amazing resource. I was not aware of "Crafting Interpreters" before now. I can't wait to start digging into it.

I've come across very few Design Patterns, and Software Engineering topics in general, that couldn't be taught/explained from the perspective of game development. I'm surprised that it isn't used as a teaching-tool more often then it is. It's an inherently complex domain that most audiences are already quite familiar with; the "why" behind things is either immediately obvious or easily explained. If someone doesn't know what the requirements are for something like an employee record databases, and how such a system might be used, using that as a context for teaching is not much more useful then "class Widget" and "Foo.Bar()".

</comment></comment></comment></comment><comment><USER17> Awesome comment from the FAQ:

Which version pays you the most?

First of all, thank you for caring about this! Since I self-published, I set the prices so that the royalties are about the same for each format. (I also get the lion's share of the money since there's no publisher taking a cut.)

Buy the format you want and I'll get paid pretty much the same either way. If you want to give me money, but don't actually want a physical book, consider giving it to a friend or your local library. I get money, you feel good, and someone gets a free book!

</comment><comment><USER18> Just a friendly reminder to aspiring gamedevs. Global Game Jam 2019 is happening this very weekend. Theme is: What Home Means To You. And there are plenty of teams currently streaming on Twitch. As well as a Discord chat ;)

[https://globalgamejam.org/](https://globalgamejam.org/)

</comment><comment><USER19> Extrapolating up to one physics frame is still not a good solution, it will be noticeable.

For example a falling object will clip in the ground for tens of ms of displacement which is definitely visually significant.

A better solution is to either only interpolate and live with the additional frames of input latency (fine for a lot of games) or resimulate the next physics frame with the new player input, and live with the additional CPU overhead.

<comment><USER20> Glenn Fiedler gives the best solution to this:

[https://gafferongames.com/post/fix_your_timestep/](https://gafferongames.com/post/fix_your_timestep/)

I've had a great experience so far following Glenn's suggested solution.

<comment><USER3> Yes! This article was one of my main inspirations for the chapter.

<comment><USER21> Speaking of inspirations, looking at the sample PDF on your site, I'm getting some pretty intense Edward Tufte style vibe. Was that intentional?

<comment><USER3> Oh, yes. <3 Tufte.

</comment></comment></comment></comment></comment><comment><USER22> I've looked into game loop pattern discussions in the past, and (as a hobbyist doing nothing serious in gamedev, just having fun with the occasional small game) I typically find them to be overly-academic and didn't really communicate why I'd want to use a pattern, simply that I "should". I've also spoken with other developers (who, to be fair, were systems and application developers first, not game developers) over-invest themselves in the theory and architectural aspects of game development, rather than ... well, actually making a fun game.

This article presents the most cogent and approachable explanation of the topic I've seen. It's empathetic style reminds me of the excellent "Head First" design patterns book (which if your ego can get past the initially- jarring style, is IMO the best way to fully grok the patterns). Thanks to the author, to to the person who shared it!

</comment><comment><USER23> Isn't it far better to split these jobs out to different threads?

A rendered frame is just a view on some data. As soon as you couple state updating to rendering you're bound to encounter issues. This is what leads to games like ARMA who's FPS in multiplayer depends heavily on the performance server, which is insane.

<comment><USER24> > Isn't it far better to split these jobs out to different threads?

Not necessarily. For games one of the things you're trying to minimize is time from user input to response on screen - that has to go through your input system, your animation system, possibly your physics system, and then all the way through the renderer. You need strict control of ordering and buffering. To allow stuff to be offloaded to another thread adds latency and can make things messy to control.

For simpler games, threads here don't help. They just hurt. Extra complexity, and likely extra latency (if only through mistakes and synchronization).

For more complex games, you can often get away with just going "wide" _within_ the game loop. You have threads, but it's not about splitting off "animation" and "physics" jobs, but instead going wide when updating animation or updating physics. It's more granular and the high level coordination still happens in a traditional game loop.

If you want to get really fancy, your game loop starts updating a graph of systems of system jobs instead of a hardcoded list of system updates. If you strictly specify all inputs, modifications, outputs, etc. you can start making it automatically parallel by walking the graph and dispatching jobs that don't conflict with running jobs.

Even then you still have a game loop, you've just offloaded most of it's work to a fancy job system. Not all - you'll probably still have some API calls that only work on the main thread hardcoded into the game loop (e.g. for pumping OS UI messages using system provided APIs that aren't thread safe).

</comment></comment><comment><USER25> Very accessibly-written and entertaining

</comment><comment><USER26> We had the exact same problems with building VRS systems in the 90's. A system would runder under DOS written with turbo Pascal. A system would hold 8 cards with 2 lines. The progam had to run in a loop to keep feeding the voice buffers and handle the events from the cards.

</comment><comment><USER27> Back in the days of CRT monitors, you'd wait for a display refresh loop interrupt to fire, and as you knew that the screen refreshed at a particular number of cycles per second, you knew how fast your game would run.

<comment><USER28> Back in the days of CRT monitors and DOS, graphic hardware didnt generate vsync interrupts.

<comment><USER27> Yes it did. I used to use them to keep my games at the right speed.

<comment><USER28> I should of narrowed my statement to VGA under DOS. You had to either manually poll 3dAh, or best case scenario politely ask VESA (SetDisplayStart) to page flip during vsync for you, but even that wasnt always working (for example Quake had a manual switch and treated it as something experimental). Interrupt was a remnant from CGA/EGA standard support, crapshoot on VGA cards.

[https://www.vogons.org/viewtopic.php?f=63&t=58445](https://www.vogons.org/viewtopic.php?f=63&t=58445)

[https://books.google.pl/books?id=gZ5SDTpMR- MC&pg=PA386&lpg=P...](https://books.google.pl/books?id=gZ5SDTpMR- MC&pg=PA386&lpg=PA386&dq=ega+vertical+retrace+interrupt)

</comment></comment></comment></comment><comment><USER29> Implementing a game loop in JavaScript (2011) [0]

[0] [https://codeincomplete.com/posts/javascript- pong/](https://codeincomplete.com/posts/javascript-pong/)

<comment><USER30> doesn't use render interpolation as the OP article describes</comment></comment>


Overview of the Crystal language - <AUTHOR> https://marmelab.com/blog/2017/12/14/lets-cook-some-crystal.html <comment><USER2> The consensus in this thread is that Crystal has lost a lot of steam recently and little is being done. In fact, it's been nearly 6 months since the last release. As a member of the core team, I'll be honest: this is correct.

Manas, Crystal's main commercial backer has had a very tough year and has been unable to donate as much manpower to the project as previous years. The non- manas members of the core team have had difficulty finding time too. This has been a low point in the project, but it's very possible that 2018 will be a different story. Development is picking up right now, extremely basic windows support is just a few days from being merged into master, and the 0.24.1 release is imminent. There will be a blog post regarding this on crystal- lang.org soon.

<comment><USER3> I have had my eyes on Crystal for a while now, and one of my New Year's Resolutions for 2018 is to learn it.

I really hope the project does not collapse. What little I have seen was very, _very_ exciting. I used to love Ruby, I did most my scripting in it for pretty long time.

More recently, I have discovered the joys of strong static typing. A language that combines Ruby's expressiveness with type safety and good performance (let's face it - ruby's performance is not that impressive) sounds really sweet.

This is definitely a language I would like to get to know. ;-)

<comment><USER2> Thanks for your kind words. If you ever find the time to learn it, you'll find the gitter channel useful for any questions.

</comment></comment></comment><comment><USER4> Crystal seems like a great high-level language and alternative to Ruby, but the biggest blocker for me using it more generally is the lack of multi- threading support. There is WIP support for threading but it has not been committed. Moreover the Crystal developers either don't do a great job of updating their multi-threading roadmap [0] or work on multi-threading has died off. (I assume it is the latter because the thread-support branch has not gotten any commits in 10 months [1].) Ultimately if I wanted the high-level aspects of Ruby or Python and wanted more performance and great thread support I'd probably go with Elixir (even taking into consideration BEAM weirdness).

[0] [https://github.com/crystal-lang/crystal/wiki/Threads- support](https://github.com/crystal-lang/crystal/wiki/Threads-support)

[1] [https://github.com/crystal-lang/crystal/tree/thread- support](https://github.com/crystal-lang/crystal/tree/thread-support)

<comment><USER5> What is so good about multi-threading?

<comment><USER6> If you're considering Crystal over Ruby, chances are that speed is part of your reasoning.

And if speed is important to you, then you want to use all 4/8/16 cores of your machine, not just one.

<comment><USER7> Any web application is going to be almost entirely network and database-bound, not CPU-bound. CPU-bound tasks are stuff like scientific computing, video encoding, the Ruby interpreter and Crystal compiler themselves, etc.

The advantage of multithreading in a web application is not "using all cores" but rather that the application can spawn a thread to "asynchronously" wait for a response from the network or database while it continues doing other work in the main execution thread, instead of "synchronously" blocking all work while it waits.

In other words, web applications leverage concurrency with their use of multithreading, not parallelism.

I will caveat that having more cores can give concurrent applications a small performance improvement, because even though each thread is only using a CPU core at around 0 to 15% (in short bursts) of capacity, switching between two threads on the same core is a context switch, a fairly expensive operation. More cores means fewer context switches.

But, unlike with parallelism, making use of more cores is not the reason concurrency offers performance benefits. ~99% of the performance benefit of concurrency is realized on even a single-core machine, whereas parallelism by definition requires multiple cores to offer a speedup. Concurrent applications such as web servers (e.g. Apache, Nginx) typically spawn hundreds or even thousands of threads per CPU core.

<comment><USER8> While this argument is valid and fine, I think it has mostly played out. Previous language design choices that consciously ignored multithreading were made in the mid-late 90s when the future of consumer SMP was unclear. Now it is clear that multi-core is and will be an important component in everything -- we have quad-core phones, dual-core cameras, etc.

While an application may be fine without good/native support for parallelism in most cases, it's really nice to be using a language that allows you to bolt it on easily when it turns out that you _do_ need it. At this point, it's a language feature that's not worth leaving on the table without compelling rationale.

Arguably, the class of high-level dynamic languages that were on the rise in the mid-00s (Python, Ruby) lost a lot of steam to newcomers like Swift and Go due to the language designers' hesitation around embracing parallelism. Crystal should not repeat that mistake.

<comment><USER4> This is exactly the reason I'm concerned about investing in Crystal (and OCaml, where multicore is also in an awkward state). I need to be confident that when I need parallelism, the language supports it (good threading primitives are imperative too, so not just pthreads).

<comment><USER2> We really really want to support parallelism and we've had some basic successes so far. We're very confident we want this, and we're confident we can come up with a performant solution: despite being a different language our parallelism solution will likely end up close to Go's which has largely solved this already.

We're not there yet but I'm confident the main barrier is time and manpower to implement it, not willpower or technical reasons.

</comment></comment></comment></comment></comment></comment></comment><comment><USER9> Worth nothing: Thoughtbot is working on a web framework for Crystal, called Lucky: [https://luckyframework.org/](https://luckyframework.org/)

It looks quite promising, but as others (including core team members) have noted, development on Crystal seems to be losing steam. It's tempting but seems like a bit of a gamble to pick Crystal for anything serious, especially with great new languages like Elixir and Go gaining traction.

<comment><USER10> Surprised this is the only mention of Lucky.

Seems to have a lot of promise. I wrote off Crystal some time ago but Lucky has my interest piqued and I've been building a few things with Lucky recently.

</comment></comment><comment><AUTHOR> Crystal is a Ruby inspired compiled language, allowing it to run blazingly fast with a very low memory footprint. It uses LLVM for emitting native code, thus making use of all the optimisations built into the toolchain.

Website: [https://crystal-lang.org/](https://crystal-lang.org/) Github: [https://github.com/crystal-lang/crystal](https://github.com/crystal- lang/crystal)

<comment><USER11> For me Crystal is what Ruby might have turned out to be, if its designers cared to take some inspiration from Dylan.

<comment><USER12> That makes no sense to me. Most of what makes Crystal different from Ruby results from the former being a static language and the later being dynamic.

I understand that dynamic languages are not popular these days on HN, but it's silly to suggest they should become static languages. They just offer different tradeoffs, a bit like screws and nails.

<comment><USER11> Dylan is a Lisp (thus dynamic) with Algol-like syntax.

Dylan supports AOT compilation like Crystal, and had optional type checking, so one could make it into Crystal if all variable declarations happened to be annotated.

Don't forget Dylan was intended to be used as Newton systems programming language and the team managed to create their own OS, even after C++ was decided to take Dylan's role.

Personally dynamic languages without AOT or JIT support were never popular with me beyond shell scripting tasks.

<comment><USER13> I thought NewtonScript took Dylan's place in Newton development?

<comment><USER11> No, Dylan was supposed to be a systems language in the spirit of Lisp Machines.

But internal politics and battling between teams spoiled it.

Check the comments from mikelevins and wrs.

[https://news.ycombinator.com/item?id=15106802](https://news.ycombinator.com/item?id=15106802)

</comment></comment></comment></comment></comment></comment><comment><USER14> I really want a nice OO language with Garbage Collector / ARC that compiles to native code on Windows, Mac and Linux. Swift is good, but Windows story is weak.

I am personally waiting for Kotlin Native to mature. Until that time Go it is.

<comment><USER15> Red [0] has a fantastic cross-compilation story, is a tiny compiler, and is a kind of Lispy version of Object-Oriented. Includes GUI support in the native runtime. It's meant to be a sort of "better Rebol".

[0] [http://www.red-lang.org/p/getting-started.html](http://www.red- lang.org/p/getting-started.html)

<comment><USER16> Red (and Rebol) are fantastic but unfortunately the learning curve is very steep for people that don't know it. I spent a month reading everything on the internet about Rebol, then Red was obvious but before that it's really hard to get into that world. IMHO Red should have something like a definitive book covering all aspects in one place (like [0]) because it has a vast array powerful features (URI, money, time literals, parse and other dialects) etc. Without concise but a complete guide the language appears to be just a weird "let's use [ ] instead of { }" construct.

[0]: [http://shop.oreilly.com/product/0636920040385.do](http://shop.oreilly.com/product/0636920040385.do)

<comment><USER5> how can it have a learning curve for people already know it?

<comment><USER16> Because "already know it" is not a single defined point on that curve but rather a region. It's easy to prove by negative, if "already know X" would be so easy to pinpoint the entire recruiting industry would cease to exist.

</comment></comment></comment></comment></comment><comment><USER17> Does it support Windows yet?

<comment><AUTHOR> Windows support is still WIP, recently we are making some good progress [https://github.com/crystal- lang/crystal/pull/5339](https://github.com/crystal-lang/crystal/pull/5339)

</comment></comment><comment><USER18> Ruby like syntax huh. Man I wish the Python syntax would catch on more. Most clean and readable code I've ever laid my eyes on. Wish I could use it but it's just too slow for the stuff I do. What would I give for a language at least the speed Java but with a Python like syntax.

<comment><USER18> \+ and strongly typed.

<comment><USER19> Nim is the closest language to what you're describing that I've found so far [https://nim-lang.org/](https://nim-lang.org/)

<comment><USER20> Definitely fits the bill:

* Python-like syntax

* Compiles to C/C++/JS/Object-C

* Supports Windows, Linux and Mac.

* Multithreading

* Extensive metaprogramming

* VERY fast compiler

* Dead code elimination

* Very strongly typed, with related features (eg distinct types)

* Type inference

* Excellent structural generics, type classes, and compile-time concepts

Basically looks like python, runs like C. Because it compiles to C, you can run it anywhere you have a C compiler (which is almost anywhere).

</comment></comment></comment></comment><comment><USER21> Nice language. Is someone use it in production?

<comment><AUTHOR> We have a dedicated wiki page for Crystal production users :) [https://github.com/crystal-lang/crystal/wiki/Used-in- product...](https://github.com/crystal-lang/crystal/wiki/Used-in-production)

</comment></comment><comment><USER22> I don't know why, but off all languages I've tried, Ruby's syntax I just hate. I can't do it, dunno why. That's what turns me off of crystal also.

<comment><USER23> I guess you are a Java enthusiast (in my experience Java coders just tilt with Ruby). Anyway you should try Elixir, it is Ruby "The right way" in my opinion.

<comment><USER24> Please let's stop spreading this "elixir is like fast/better ruby". The syntax is not even that similar, and the runtime is completely different, the patterns and tools available not the same at all.

I know it's probably a hill on which I'm gonna die and get a lot of downvotes, but we should really try to not force Elixir into being a new, fast ruby and let it evolve and solve problems in its own ways.

<comment><USER25> "elixir is like fast/better ruby" is simplistic but it's also not entirely untrue. When I first started playing with Phoenix I found it palpably similar to Rails, but also faster and better in a lot of ways, especially the WebSockets story.

When I started writing Elixir I didn't know how great it was nor did I understand how different it was from Ruby. The BEAM is a challenging thing to grok. As I used it more and more, I did learn and appreciate those things. But at no point, did I feel deceived about how similar Elixir and Ruby were supposed to have been. I was surprised and relieved by how many of the things I had to worry about in Ruby, I didn't have to worry about in Elixir.

At the end of the day, Elixir's similarity to Ruby is part of what gets a lot of people like me in the door. It's a hook and I think it's a good one. I mean, sure, we're going to have to explain to people why they don't need something like Sidekiq, and we're going to do it many, many times. But that's what we do as a welcoming community.

I guess it's a balance. If we have a lot of people trying out Elixir and leaving because they feel they were misinformed, that's definitely relevant. But I don't hear much of that. On the other hand, if we can use this similarity to get OO people to try out this crazy, awesome FP language that uses the actor model, that could really help grow the language.

You're on point that Elixir really is a completely different paradigm, but I don't know if I agree that it really matters from a marketing perspective, particularly when marketing to Rubyists.

<comment><USER26> > when I first started playing with Phoenix I found it palpably similar to > Rails, but also faster and better in a lot of ways, especially the > WebSockets story.

Thing is virtually every language that is used for webdev has a framework that is similar to rails. So that's not much of a discriminatory when comparing languages...

<comment><USER25> The number of languages that do WebSockets well include what would be a small subset of "virtually every language that is used for webdev [sic] has a framework that is similar to rails".

But that wasn't really the point of the comment. The point, for those who didn't feel the need to read all the way through, is that Elixir's surface level similarity to Ruby is enough to make Rubyists, or at least this Rubyist, feel reasonably comfortable, reasonably quickly. Making the Elixir/Ruby comparisons may have some annoying side effects, but they're probably good for the growth of the language.

</comment></comment></comment></comment></comment></comment><comment><USER27> > In Crystal, as in Ruby, everything is an object. [...] When you write > Crystal code, most of the time, you write classes.

Why, God, why?! Really, OOP is a great way of structuring lots of types of code (not all!). But I don't think it really helps anyone to treat everything as an object. Some _things_ are not _objects_ they just are whatever they are. A _function_ is just that, a _function_. If I have to call a `.call` method on a "function" as in ruby, then that's simply not a function anymore. And... _it 's not an object either semantically,_ because objects are about things that can receive and send multiple messages and sometimes encapsulate state... and that's not how _anyone_ thinks about _functions!_

By making _everything_ be an object, you actually f up the concept of "object" itself...

I like Ruby's elegance, but every time I see the "OOP at the core" part, I suddenly get more love for Python and Javascript for at least getting this right.

<comment><USER28> I have never used Crystal before, but I don't understand how you can be against "everything is an object" and then say Python and Javascript are different... Pretty much everything in Python and JS is an object... So really, what does fundamentally differ?

<comment><USER16> > Pretty much everything in (...) JS is an object

Except primitives that are not objects but (some) can be autoboxed to behave like objects.

A riddle:

      var a = 2;
      a.b = 3;
      console.log(a.b);</comment></comment></comment>


Top Free Android Apps Which You Can Use Everyday - <AUTHOR> http://www.techieapps.com/top-10-free-android-apps-which-you-can-use-everyday/ As they say, the entire world is getting smarter using the smart phones and it is high time you started as well. <comment><USER2> Thanks for the great collection of android apps.These are really useful apps and moreover these are all available for free.</comment>


OpenSilver, open-source reimplementation of Silverlight via WebAssembly - <AUTHOR> https://opensilver.net/ <comment><USER2> comments from four months ago, [https://news.ycombinator.com/item?id=22527481](https://news.ycombinator.com/item?id=22527481)</comment>


Pivoting after making $109,000 in revenue in 2019 - <AUTHOR> https://www.publishzen.com/blog/pivoting-after-making-109000-in-revenue-in-2019 <comment><USER2> Situations change! Is anything more true right now? Amazing that you had the opportunity and foresight to completely change your product.

<comment><AUTHOR> Thanks, I appreciate that! Certainly stressful but there is a big sense of relief moving on from something you no longer believe in.</comment></comment>