Show Posts
|
|
Pages: 1 ... 5 6 [7] 8 9 ... 80
|
|
121
|
Developer / Technical / Re: Backup Best Practice
|
on: February 26, 2014, 12:58:08 AM
|
|
Quick tip regarding version control: Make sure at least one of your backup measures does not involve version control.
For all its many upsides, the big problem with version control is human error. In thirty years of programming I have frequently and consistently heard developers complaining about losing data or having to undertake incredibly complex rescue procedures due to version control errors. Much as it's not very sexy, just take a copy of your entire development folder every so often. It's easy to do, virtually free and one day it may save you from disaster.
(Most of the upsides to version control, incidentally, have nothing to do with backup. Anyone only using it for backup is largely missing the point.)
|
|
|
|
|
123
|
Developer / Technical / Re: Post if you just laughed at your code.
|
on: February 04, 2014, 02:25:55 AM
|
I couldn't work out this morning why my code had a variable called 'roflBlock'. Surely even I wouldn't be that whimsical in my naming? After studying the corresponding code, the mystery is solved: ROFL is an acronym for "Remove Object From List". 
|
|
|
|
|
125
|
Developer / Technical / Re: Has anyone used UDP networking in Flash?
|
on: January 29, 2014, 05:09:02 AM
|
|
I've used it a bit.
The actual UDP networking was fine. The hard part is the firewall punchthrough needed to use this for internet play. When I was testing stuff, Adobe Stratus was briefly free... but as usual Adobe were unhelpfully coy about whether it would remain free and then it got rolled up into Adobe Cirrus and I decided building a full product around something that might vanish was a very bad plan.
Still, the actual UDP stuff is easy and works fine if you can find a solution to the rendezvous problem!
|
|
|
|
|
126
|
Developer / Technical / Re: The grumpy old programmer room
|
on: January 28, 2014, 02:30:09 AM
|
It's funny how hard you can try to fight OO sometimes, only to end up writing more tangled, but still fundamentally OO code. In case anyone's curious, I did eventually track down why this code was written that way. Exactly one of the functions in question was called from a lot of places where the Foo parameter could be null. Coding it as a static function saved wrapping all the calls in "if (myFoo) { ... }". The other functions were C&P'ed then tweaked based on the first, apparently with insufficient thought given to the process!
|
|
|
|
|
127
|
Developer / Technical / Re: The grumpy old programmer room
|
on: January 27, 2014, 09:04:20 AM
|
Today I noticed that I had a set static functions in class Foo that took an instance of Foo as the first parameter in each case... ...Gosh, it seems to come up a lot. If only there was some convenient way to handle that case. 
|
|
|
|
|
128
|
Community / Townhall / Re: should I use unity or not?
|
on: January 07, 2014, 10:02:58 AM
|
I am currently developing 2d sidescrolling platformer in unity and I am just having this bad feeling like if I was cheating because of not using real programming language like java or c++ and doing all the hard way. Unity supports use of real programming languages as part of its projects. C# is an excellent language and UnityScript can be used to write good code too. If it makes you feel any better I've been programming since 1982, have a PhD in Computing and have completed full size projects in Assembler and still chose Unity for my most recent project. It's not a toy - it's a serious development tool.
|
|
|
|
|
129
|
Developer / Technical / Re: How to develop unmaintainable software
|
on: October 15, 2013, 05:05:46 AM
|
|
His point about version control is a bit of a strawman, because the number one reason not to use version control is that if you always archive complete builds then it's always easy to get earlier versions back up and running with a minimum of effort.
(There are other reasons for using version control, of course, but working out which files you need is definitely not one of them.)
|
|
|
|
|
130
|
Developer / Technical / Re: Is There A Way To Manually Code "Move_Towards_Point"?
|
on: October 15, 2013, 05:00:52 AM
|
Calculate which direction you need to take using trigonometry Sometimes you don't even need to do that. I normally code it like this (pseudocode, because I don't speak GML): dx = playerX - enemyX; dy = playerY - enemyY; distance = square_root(dx*dx + dy*dy); if (distance > 0) { dx = dx * enemy_speed / distance; dy = dy * enemy_speed / distance; } move_enemy_by(dx,dy);
|
|
|
|
|
131
|
Developer / Technical / Re: The grumpy old programmer room
|
on: September 29, 2013, 03:48:09 AM
|
OMG!  That's HORRIBLE! That creates a situation where you can see a line that says foo.whatever(), search foo class definition for the whatever() method and not find it!
|
|
|
|
|
132
|
Developer / Technical / Re: How was collision detection done in Diablo 2 / Starcraft 1?
|
on: September 19, 2013, 03:37:12 AM
|
StarCraft's collision detection was grid-based. there's some discussion of it in this article (in the section "How did we get here?"). That's just the scenery of course, you also need to detect collisions between moving objects, but that's no easier or harder than any other game. You either use the naive method of checking all possible pairs of objects or - if that turns out to be too slow - you can maintain a grid of zones and only check objects from zones you're in plus adjacent zones.
|
|
|
|
|
133
|
Developer / Technical / Re: The grumpy old programmer room
|
on: September 13, 2013, 12:54:37 AM
|
But I was told to use node.js with socket.io for the server side stuff, and I just have no idea where to begin. I'm not sure exactly which bits you need help with, but try getting this example to work. Read the comments too, since they clear up a couple of ambiguities.
|
|
|
|
|
135
|
Developer / Technical / Re: Loss of precision
|
on: July 29, 2013, 07:57:59 AM
|
// Rotate the turrent on top of the block view = Matrix.CreateTranslation(-(thisposition.X), -(thisposition.Y), 0); view *= Matrix.CreateRotationZ(tmpang); view *= Matrix.CreateTranslation((thisposition.X), (thisposition.Y), 0); This kind of code is generally not a great idea. This basically amounts to "get new position/orientation by rotating previous position/orientation about (X,Y)". Any time you're constantly tweaking a value like that, your errors build up fast. It's usually better to build the transform you want from the identity each time. So you end up with something like: // Rotate the turret on top of the block turretRotation += tmpang ...then elsewhere in the code (as some kind of per-frame update)... view = Matrix.CreateRotationZ(turretRotation); view *= Matrix.CreateTranslation(turretPosition.X, turretPosition.Y, 0); ...which means errors never accumulate over multiple frames.
|
|
|
|
|
137
|
Developer / Technical / Re: Havok's Project Anarchy is now available
|
on: June 27, 2013, 04:55:44 AM
|
This is brilliant news for C++ developers. No more pressure to use Unity if they don't want to. And given that physics is Unity's weakest point at the moment access to Havok is a pretty big deal. Amused to note that "add PC to free platforms" is the most upvoted request at the moment. Given that Havok Physics alone reportedly costs a five figure sum to licence I suspect there's some wishful thinking going on there! 
|
|
|
|
|
138
|
Developer / Technical / Re: Check overlapping between a high volume of rectangles
|
on: June 06, 2013, 07:17:28 AM
|
|
What happens when rectangles overlap?
The reason I ask is this: you say these rectangles bunch up so much that spatial partitioning doesn't help much. But if that's really the case then the cost of processing the pairs which have collided is going to be even higher than the cost of detecting the collisions in the first place. For example, if there are 100 rectangles right on top of each other that's (at least) 4950 calls to your collision processing function.
Depending on the answer to the question above, what might be worth trying is to use heatmap-like methods to track the net impact of all the rectangles in a given area. So the first one "paints" a region with "+1 rectangle" and then the next one does and so on. Once you've processed them all you discover that the highest rectangle at a particular point is at +38. You don't need to care which one it is. Next time a rectangle at that point tries to move, just assume it's on top of the stack and process accordingly.
|
|
|
|
|