Jump to content

  • Log In with Google      Sign In   
  • Create Account

ferrous

Member Since 19 Nov 2013
Offline Last Active Today, 04:54 PM

#5289289 getting fired in software industry

Posted by ferrous on 29 April 2016 - 01:06 PM

It can be really hard on the ego when one gets let go, even if it's a mass layoff.  It is possible to recover, and even be successful.  I've seen folks go from being fired for not working out, to working someplace new, and getting promoted to a lead in a short amount of time.




#5288616 towards a faster A*

Posted by ferrous on 25 April 2016 - 10:45 AM

How does it differ in performance from the std::priority_queue?




#5288168 Adding Subtypes Of A Class [Optimizing Blocks]

Posted by ferrous on 22 April 2016 - 12:29 PM

Also, unless you really need Blocks to have string names, I think I'd go with an enumerated type, that string is probably your biggest field in that class.

 

As an aside, does it matter how members are placed for alignment in a C# class?  My C++ sense wants me to rearrange everything to be largest member variable first, then smallest.




#5288032 How to randomize a string variable

Posted by ferrous on 21 April 2016 - 01:38 PM

 

Dumb question: did you "using System;" at the top of your .CS file?

 

Yes, I was using System.

There seemed to be a problem with System.Random and UnityEngine.Random. Fixed it now by specifying everywhere I used a 'Random' function which library to use.

 

Thank you all for the help.

 

 

Oh, if you're in Unity, I suggest just using their random, instead of mixing and using System.Random as well.  At least until you decide that you need a better random than either and roll your own =)




#5287620 [2D Platformer] Horizontal Loop

Posted by ferrous on 19 April 2016 - 10:13 AM

Similar to the poster's second bullet point above, you can have an offscreen/covered portion, so that you won't have the player in two spots at once.  For example if your character is 10 pixels wide, you could not have the character teleport until they are completely offscreen and are 11 pixels offscreen.




#5287051 c++ should nested switch statements be avoided?

Posted by ferrous on 15 April 2016 - 10:18 AM

While you're nesting those 256 switch statements, you might as well add a few gotos.




#5286876 Loading Screen in Unity3D in c#

Posted by ferrous on 14 April 2016 - 10:16 AM

You might want to look into animation clips?  Otherwise, if you want to do it through code, you might want to look into coroutines, I think it might make it cleaner. 




#5286752 Optimizing Generation

Posted by ferrous on 13 April 2016 - 02:57 PM

Yeah, pull anything you can farther up out of a loop if you can, for example:

Mathf.Pow(ty + (posy * 16) - r, 2) (which in addition to being overkill expensive, especially for integers, only changes when ty changes, yet you are calculating it every time in your inner most loop, so instead of only doing it 16*16 times, you are executing that code 16*16*16 times.

 

I also don't think your multithreaded code is helpful at the moment, you might want to strip it temporarily, especially if Unity's profiler is having a hard time with it.

 

And again, I think you should probably rethink how your iterating.  For example, your cracked code.  Rather than iterating over every block, why not randomly generate how many empty squares you think their should be.  Then randomly generate a set of indices for the number of empty squares, index into those locations and set the block to empty.   Instead of iterating over 16*16*16 squares and mostly doing nothing, you're looping only as many times as you have empty squares.

 

EDIT: Horrible pseudo code:

 

int numCrackedSquares = Random.GetValue()

for(int i = 0; i < numCrackedSquares; ++i)

{

int x = Random.GetInt()

int y = Random.GetInt()

int z = Random.GetInt()

 

blocks[x,y,z] = new BlockEmpty();

}




#5286716 Optimizing Generation

Posted by ferrous on 13 April 2016 - 12:21 PM

I agree with Frob, but that said, just looking at it, there are a couple of things that I can guess at:

 

Your sqrt is unneccessary, you can square both sides of the equation, and you can move the calculation of the various radii your checking against out into variables before the for loops.  And then you can give them meaningful names too =)  EDIT: If its not clear, I'm referring to (r - PlanetSize / 6)^2, which could be renamed minStoneRadiusSquared.

 

Also, you'll probably want to invert your for loop order, and do z, y, x, it's more memory friendly.  If you are wondering why, imagine if you had a single array that was of length 16*16*16, and think of how you're jumping around in it as you travel through your innermost for loops.

 

EDIT:  Though taking a deeper look, it looks like you're just trying to make blocks of a band of a sphere set type, which seems like something you could make separate iterations, without any radial checks at all, especially since those are going to be constant per planetsize, and your dealing with integers.  (Which is why you should really deeply consider frob's questions)




#5286363 Good places to learn Universal App development

Posted by ferrous on 11 April 2016 - 02:16 PM

I think it's meant to be mostly transparent, if you're familiar with win8.1 app development, it should be fairly similar.  It's still manifests and appx's and whatnot.  Though I say that as a lazy developer who clicks on, "Build UWP" in Unity.  If you're interested, all that does is spit out a solution that is a UWP app with source code.  You may want to take a look at it, as I'm guessing you'd want to do something similar if you're doing a multiplatform game.  Though if you're not, then maybe you could take advantage of XAML better.




#5285345 A* A star vs huge levels

Posted by ferrous on 05 April 2016 - 03:07 PM

another thing mentioned in the article was agent radius, and not generating paths too close to walls and such.

 

they recommended "growing" obstacles by the radius of the agent to compensate.

 

all fine and good for your typical shooter where everyone is a human with the same radius. 

 

now, what if you have 50 entity classes with radii anywhere from 1 to 20 units?

 

multiple collision maps at different resolutions for different sized critters?

 

one collision map for each radii?

 

or maybe 3 or 4, and choose the closest size that's not too small?

 

anybody dealt with this before?

 

 

I have seen it where each tile stores a clearance, of how close something can get.

 

(More, better explanation of the tilegrid clearance: 

http://aigamedev.com/open/tutorials/clearance-based-pathfinding

 

haa-trueclearance_annotatedmap.png

 

I have seen some research papers that do something similar with a navmesh though.  Here's one, though there was another floating around with a code sample.  (EDIT: Oh, and I guess Havok's Anarchy engine has clearance:  http://anarchy.cn/manual/12/HavokSdk_ProgrammersManual/aiNavMeshPathfinding.html#reusingNavMeshes)

 

EDIT2: Oh, this one had a code sample somewhere, I definitely recall this being the first paper I saw on it.




#5285052 In terms of engine technology, what ground is left to break?

Posted by ferrous on 04 April 2016 - 11:53 AM

I haven't seen really amazing water with physics outside of Nvidia tech demos.




#5282736 Is a good idea publish for windows phone/windows 10?

Posted by ferrous on 22 March 2016 - 03:13 PM

It depends on how much work will be involved in porting your app to Win10.  Depending on your framework, it could be as little as changing the dropdown to build UWP instead of for Android or whatever.   In that case, I'd go for it.




#5282378 (split thread) c-style casts

Posted by ferrous on 21 March 2016 - 10:51 AM

Const is super handy as a programmer for helping me parse what the heck an API is likely to do. 

 

void Foo(Bar& bar) and void Foo(const Bar& bar), it becomes immediately obvious that the second function, bar is an 'in' parameter, while the first one is both an input and output.  And void Foo(Bar& bar) const, tells me that that the method won't modify the original class, so it's most definitely all about modifying bar.




#5282261 Too good to be true?

Posted by ferrous on 20 March 2016 - 08:44 PM

It's not impossible, but it takes time, skill, dedication, and filling a niche that isn't crowded.  Stardew Valley is a pretty good example of a game that could probably be made with RPGmaker, (I don't know if it was or not, certainly could've been)

 

Also Stardew valley took, what only 4 years of self-imposed crunch =)






PARTNERS