Jump to content

  • Log In with Google      Sign In   
  • Create Account

ChaosEngine

Member Since 09 Jun 2000
Offline Last Active Yesterday, 09:18 PM

Posts I've Made

In Topic: So Would you dress like a deer in hunting season

Yesterday, 09:19 PM


Of course one could ask how a holiday about souls became a holiday about candy.

 

http://en.wikipedia.org/wiki/Trick-or-treating#Origin


In Topic: So Would you dress like a deer in hunting season

Yesterday, 08:40 PM

to drag one up from the depths....

cool story bro


In Topic: Problem with List of inherited objects

Yesterday, 03:18 PM

Could you elaborate on your line about encapsulation, maybe with some pseudocode? I'm not sure I understand what you mean

 
So you want to call BuildEntity with some arguments like this
// build planet entity
BuildEntity(entityKey, parentId, position, rotation, spinRate, name)

// build station entity
BuildEntity(entityKey, parentId, position, rotation, affiliation, loadout, name, description)
but you can't really do that. So you could do something like this
 
public abstract class EntityData
{
}

public class PlanetData : EntityData
{
// Position
// Rotation
// Spin rate (how fast it rotates)
// name
}

public class StationData : EntityData
{
// Position
// Rotation
// Affiliation (which faction it belongs to)
// Loadout (which weapon turrets, etc are mounted on it)
// A name (given by an ID refering to a database)
// A description
} 
Then pass that to BuildEntity
    public abstract class Archetype
    {
        public string Nickname { get; set; }

        public abstract void BuildEntity(string entityKey, ulong parentId, EntityData data);

    }

    public class PlanetArchetype : Archetype
    {
        public override void BuildEntity(string entityKey, ulong parentId, EntityData data)
        {
            var planetData = (PlanetData)data;
            // build planet using data
        }
    }
I don't really recommend it though. That kind of downcasting is a code smell and potentially brittle.

In Topic: Windows PowerShell is the greatest ever

29 October 2014 - 07:10 PM

Is there a point to this, or did Powershell just touch you inappropriately that one time?


In Topic: Is optimization for performance bad or is optimizating too early bad?

29 October 2014 - 03:10 PM

To give a figure, my Windows 7 desktop costs me about 4.23€ (~ $5.39) per month in electricity. The same desktop was running Windows XP Professional until about a year ago, which is just slightly less energy efficient overall.
The same desktop cost me about 5.14€ (~ $6.54) per month in electricity back then, that is a difference of nearly 12 Euros per year.
 
Now imagine you write some software, and 500 million people use it, and every one is paying 12 Euros per year for nothing... you could as well have harvested another 6 billion in currency instead of having them waste it on electricity.


If you are writing the most widely used desktop OS on the planet, I 100% agree that you should work as hard as you can to make it as efficient as humanly possible.

 

On the other hand, if you're writing a game/app that will be used by 100000 people (if you're lucky), you are almost certainly going to waste more energy spending the time to optimise it (development time costs energy) than you'll ultimately save.

 

Besides the environmental question, there is also the question of your responsibility to your employer. If the game/app/whatever works on the target platform and is good enough, unless you can demonstrate that what you are doing will increase revenue, you're wasting your employers time.

 

All of this is a matter of judgement in individual cases of course, but there are plenty of instances where "fast enough" is fine.


PARTNERS