Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 15 Jun 2006
Offline Last Active Yesterday, 08:31 AM

Posts I've Made

In Topic: Particles form a shape/letter/object

26 April 2016 - 03:48 AM

The cheap way is; Start with the particles where you want them to end up. Design your "physics" that will disperse them and invert it; run it backwards. If your particles run in from a random offscreen location, you give each a random vector and start them 500x that vector away as if you'd scattered them FROM their final pattern. Then just wind that physics backwards... at 0x, they'll all be in their final position.

In Topic: Should getters and setters be avoided?

08 April 2016 - 06:59 AM

Methods on objects should be verbs or questions.


Sometimes it's appropriate that the verb is to set some state.


But generally no, the state of the object should not be visible or changeable from outside the object. So you don't need getters and setters.


If you find yourself with a "bag of values" object, just make it a verbless bag of objects. And make all the members public and save a bunch of typing.


One of the common flaws of developers is that given a setter interface, they try and drive the objects through it, leading to pages of boring settering code instead of a single verb operation to abstract that away -- and which, appropriately named, tells you what it does.

In Topic: C++ Self-Evaluation Metrics

17 March 2016 - 03:58 AM

Some companies do this in order to match interviewer skillsets to candidate ones. But they do supply a calibration for the numbers; in one case 9 is something like "I wrote the book" with a note that there should be an actual book. And there are points like "I write code in it, but need a book handy".


I used to be a reasonably decent C++ dev (my rating is falling these days[1] because everyone wants me to write Python instead -- and at the new gig I've learned WAY more PHP than I ever wanted to) so I used to get assigned to interview people who rated themselves an 8 at it.


Now, my C++ interviews weren't THAT hard and almost none if the high-self-rankers passed them. I tended to ask things like "Write a template for a tree structure which'll store stuff at the leaves" with the rest of the spec being part of the conversation. But people couldn't write the basic bits of templates.


All that the trivia questions tell me is that people can memorise Stack Overflow; not whether they can connect stuff together to build useful things.


Eventually I turned my self-rating on the matching systems down to a 4 so I could stop doing such depressing interviews. I did the same for "UNIX internals" after spending horrible hours trying to interview UNIX experts who couldn't tell me what a file descriptor is or how they work.


Part of the problem is that people think these ratings are part of the assessment for being hired so they inflate them whereas they're supposed to be part of tuning the interviews to work well. All that the over-bigging achieves is to burn a valuable interview slot getting a low score against expectation and it only takes a couple of low scores before you're gone.



[1] I've written no commercial code in 11 for instance, although I still hobby-write code.

In Topic: Packaging a Python game for end-users

29 February 2016 - 04:57 AM

We've been using twitter's Pex to build our software so that we don't have library dependencies on our production machines. The target stills need to install the right version of Python itself (2.7, say) but you can ship all the other pieces in a single blob -- in this case including your known-good version of pygame and so on.


(They're basically zip archives with a header on them that starts a python interpretation -- when you try and import stuff, it'll look in the zip first before looking on the system.)


Pex itself is being ropey and a pain at the moment with 2.7[1], but the PantsBuild project will compile PEX objects for you (and is also a much nicer way of expressing all the dependencies; it's based on Google's BUILD file system). PantsBuild will boot itself with relatively little work.



(It IS possible to build cross-platform PEXes which will run on PY26 and PY27 hosts, but it's hacky)




[1] I think because the twitter devs are moving to PantsBuild.

In Topic: A question about animated sprite timing

29 February 2016 - 04:49 AM

" It both flickered and every single pixel it moved was blurry"


Double buffering -- you draw to the offscreen buffer and then swap them over.


"smooth motion in a point and click style"


To do this you'll need a way of expressing the "state" of a sprite; what animation frame it's on, when to change the coordinates and so on.


The complexity of this varies massively. In the olden days, you'd have 4 frame animations -- so every 4th frame, you check to see what keys are pressed and decide then whether the figure is still walking (keep on this sequence) or stopped (flip to the "standing facing that way" animation or flick to front-facing) or jumping (give the character a Y velocity and switch to the jump animation).


These days they get hugely complicated and you can use things like stacks of state objects to manage logic in more compact ways.




Have you considered just picking up an off-the shelf sprite engine for this? It'll save a lot of grief.