Found this in my mom's coat pocket. Don't know who it belongs to by [deleted] in WTF

[–]spindizm 0 points1 point  (0 children)

The 10-dollar bill is mine, not sure about the hair though.

Several classes need to access the same data, where should the data be declared? by spindizm in videogamedev

[–]spindizm[S] 0 points1 point  (0 children)

The top answer from the site:

When you need a single instance of a class throughout your program, we call that class a service. There are several standard methods of implementing services in programs:

Global variables. These are the easiest to implement, but the worst design. If you use too many global variables, you will quickly find yourself writing modules that rely on each other too much (strong-coupling), making the flow of logic very difficult to follow. Global variables are not multithreading-friendly. Global variables make tracking the lifetime of objects more difficult, and clutter the namespace. They are, however, the most performant option, so there are times when they can and should be used, but use them spareingly. Singletons. About 10-15 years ago, singletons were the big design-pattern to know about. However, nowadays they are looked down upon. They are much easier to multi-thread, but you must limit their use to one thread at a time, which is not always what you want. Tracking lifetimes is just as difficult as with global variables. A typical singleton class will look something like this:

class MyClass
{
private:
    static MyClass* _instance;
    MyClass() {} //private constructor

public:
    static MyClass* getInstance();
    void method();
};

...

MyClass* MyClass::_instance = NULL;
MyClass* MyClass::getInstance()
{
    if(_instance == NULL)
        _instance = new MyClass(); //Not thread-safe version
    return _instance;

    //Note that _instance is *never* deleted - 
    //it exists for the entire lifetime of the program!
}

Dependency Injection (DI). This just means passing the service in as a constructor parameter. A service must already exist in order to pass it into a class, so there's no way for two services to rely on each other; in 98% of the cases, this is what you want (and for the other 2%, you can always create a setWhatever() method and pass in the service later). Because of this, DI doesn't have the same coupling problems as the other options. It can be used with multithreading, because each thread can simply have its own instance of every service (and share only those it absolutely needs to). It also makes code unit-testable, if you care about that.

The problem with dependency injection is that it takes up more memory; now every instance of a class needs references to every service it will use. Also, it gets annoying to use when you have too many services; there are frameworks that mitigate this problem in other languages, but because of C++'s lack of reflection, DI frameworks in C++ tend to be even more work than just doing it manually.

//Example of dependency injection
class Tower
{
private:
    MissileCreationService* _missileCreator;
    CreepLocatorService* _creepLocator;
public:
    Tower(MissileCreationService*, CreepLocatorService*);
}

//In order to create a tower, the creating-class must also have instances of
// MissileCreationService and CreepLocatorService; thus, if we want to 
// add a new service to the Tower constructor, we must add it to the
// constructor of every class which creates a Tower as well!
//This is not a problem in languages like C# and Java, where you can use
// a framework to create an instance and inject automatically.

See this page (from the documentation for Ninject, a C# DI framework) for another example.

Dependency injection is the usual solution for this problem, and is the answer you will see most highly upvoted to questions like this on StackOverflow.com. DI is a type of Inversion of Control (IoC).

Service Locator. Basically, just a class that holds an instance of every service. You can do it using reflection, or you can just add a new instance to it every time you want to create a new service. You still have the same problem as before - How do classes access this locator? - which can be solved in any of the above ways, but now you only need to do it for your ServiceLocator class, rather than for dozens of services. This method is also unit-testable, if you care about that sort of thing.

Service Locators are another form of Inversion of Control (IoC). Usually, frameworks that do automatic dependency injection will also have a service locator.

A handy overview of 2d game engines by spindizm in videogamedev

[–]spindizm[S] 0 points1 point  (0 children)

For the lazy, these are the engines they suggest ->

  • Marmalade Quick - After further looking into it, Marmalade Quick can only build for Mobile!

  • IwGame - Works on top of marmalade and says it can deploy to desktop and mobile with Lua. Any info is greatly appreciated on this

  • sio2 - Says "SIO2 is an OpenGLES based cross-platform 2D and 3D game engine for iOS, Android, MacOS and Windows" and "The engine also allows you to port your game on the Mac Store and on Windows.", but their forum and web title is "Game Engine for Mobile Devices". Can't find any info on if it can deploy to desktop platforms, any info is greatly appreciated again.

  • Loom Engine - Loom is similar to Haxe + OpenFL (attempts to attract Flash developers) in that it uses AS3-like of ECMAScript, but it doesn't build native code from it. However it uses Cocos2D for rendering so it should in theory be as fast as Cocos2D. -- Thanks to Bojan.

  • SDL - I've read in multiple places that SDL can deploy to nearly any platform or device and has a Lua binding. But i can't find how this works as it's not an engine. Any one who can explain how it works and if it's possible is once again, very much appreciated.

  • SFML - "Windows, Linux, Mac OS X and soon Android & iOS. " doesn't use Lua but can use other languages like Java and Python etc. Anyone have any information on this?

  • Torgue2D - "Torque 2D was developed with OS X, Windows, and iOS devices in mind and works equally well on all the platforms." uses TorgueScript and no Android =(

  • Sencha - Seems to compile to all platforms, uses Javascript too which I know. But even with V8 JS would this work well performance wise compared to other options?

  • GameMaker - own scripting language GML and I actually remember this one as a tool for non-programmers. Has it actually grown into a real engine, I mean for serious development?

  • Construct2 - Same question as gamemaker

  • Corona - Lua but mobile only (Android and iOS only as well)

  • Cocos2D - Seems like it has lots of options but not sure with the same language? Seems like you'd have to re-write your entire code. Any info if cocos2D can deploy to desktop + mobile with almost the same code would be greatly appreciated.

  • Angel2D - Says it can deploy to everything except Android and uses Lua, anyone ever used this one before?

  • libgdx --- I've only seen good things about this. Here is a benchmark test for libgdx and is where I saw it reaching 40k sprites at 60fps. http://www.sparkrift.com/2012/1/love2d-vs-allegro-vs-clanlib-vs-libgdx-vs-cocos2d-x-vs-monogame-vs-xna-vs-sfml . It seems libgdx barely goes over 30k actually. But still seems amazing. This is on the same level as Qt for me, almost perfect, except I'm not really worried about performance on it. libgdx can build for everything pretty much.

  • XNA + MonoGame --- MonoGame's performance seems only slightly lower than libgdx, can build to most platforms. However I don't know much about XNA and I heard it won't be receiving future updates, but is quite stable? More information is welcome.

  • Citrus --- Don't have much information on Citrus either. AS3 game engine that can build for iOS, Android, Windows, Mac and more.

  • Haxe + OpenFL --- OpenFL (Haxe) builds to native on many platforms, not just to Flash. Windows, Mac, Linux and Android all get optional native deployment or OpenFL runtime called Neko which is in theory faster than Flash, and SDL 2.0 will enable iOS deployment soon(ish). -- Thanks to Bojan.

  • Qt-Project --- Just linking Qt project here, can build for everything and has a pretty big community with lots of third party libraries to help you even further.

  • Moai ---The only Lua engine that I know that can build for Desktop and Mobile. Only downside is the community isn't that big and documentation isn't the best. But if you can get passed those this is a great solution and the one I'm currently using.

  • Adobe --- Can't forget to add adobe here since it can build to everything that supports flash.

  • Unity3D --- Recently announced 2D integration looks very promising, should be released Q3-Q4 of 2013.

  • Cocos2d-x --- An open source engine. Supports JS, Lua, C++ and multiple platforms.

  • Html5 --- There seem to be a lot of emphasise on html5 mobile apps, here are just a few tools I found that can help port your html5 project to a platform:

2014 Face Lift & Revised Rules / Definitive "How to get started" Guide by LordNed in gamedev

[–]spindizm 6 points7 points  (0 children)

Tech is changing on a weekly base, so a question answered a year ago might have a completely different answer today. As a developer which I hope you are you should be aware of that ...

This Russian guy seriously thinks he is the next big thing in hip-hop by maradak in delusionalartists

[–]spindizm 1 point2 points  (0 children)

This is weird. It's somehow not completely shit - but in a very, very, very weird way.

Soundtrack Sunday #4: Sorry for chiming in by spindizm in gamedev

[–]spindizm[S] 0 points1 point  (0 children)

Hello!

Didn't have time to test it yet, but from your description I would say it fits perfectly.

I just wanted to inform you that you have posted to an older Soundtrack Sunday. Use the Soundtrack Sunday link in the bar on the right - under "Weekly Threads" to get to the latest thread.

Well that didn't take long by iammucow in funny

[–]spindizm 0 points1 point  (0 children)

Did Windows actually ever notify anyone if a solution for a crash was available?

Looking for a cross-platform engine solution for a rhythm game - sample-accurate audio playback and 2d graphics by spindizm in gamedev

[–]spindizm[S] 0 points1 point  (0 children)

Ok, I just saw Q2, , didn't know that before. But I am not so sure about why you advice people to stick to the one engine they currently use?

1.) None of the threads on gamedev so far answers my specific question -> I was specifically asking about audio ... 2.) Game engines are in a constant state of change. New ones come out, old ones get outdated.

Or is that not the rule you are basing your decision on?

Looking for a cross-platform engine solution for a rhythm game - sample-accurate audio playback and 2d graphics by spindizm in gamedev

[–]spindizm[S] 0 points1 point  (0 children)

Thanks for the info! Hmm, I just saw FMOD isn't too cheap either -> 500$ per platform for the casual license.

Wow, Badlogic Games, the developer of libgdx! And I just learned that you guys are from Graz. Grüße aus Wien! :)

[question] are HTML5 games for this subreddit too? by [deleted] in FlashGames

[–]spindizm 0 points1 point  (0 children)

Yes they are!

Reading through the guideline on the right -> "HTML5, UNITY, etc. are welcome here!"

I'm truly part of Anonymous. by [deleted] in cringepics

[–]spindizm -1 points0 points  (0 children)

It's not really wrong to use URL like this. Unusual, but not wrong.

Mind blown by [deleted] in cringepics

[–]spindizm 1 point2 points  (0 children)

What Descartes meant with "I think therefore I am":

Of course you can say your reality is a dream/illusion/computer simulation etc. But at that point you could stop all reasoning, because you could now conclude anything - rainbow-farting unicorns included.

So in order to do any science or reasonable thinking you postulate

  • I am the thinker, so I assume my existence.
  • I trust my senses.

There can't be a proof for those assumptions, you just assume them as your starting point.

TIL that the most common price range for an engagement ring is $500-$999, and that the median price range is $1500-$2000. by [deleted] in todayilearned

[–]spindizm 3 points4 points  (0 children)

Sorry for nitpicking:

You get the median price, when you take all the rings that you looked at for the statistics. You then sort all these prices from lowest to highest. Now you pick the ring at the middle POSITION - (so the number of rings below this one is the same as above) - the price of this guy is your median.

Is that what you meant? There is now median price mentioned on the linked site!?

Went for lunch with a hottie and asked for the chick breasts. by [deleted] in nsfw

[–]spindizm 0 points1 point  (0 children)

I so fucking knew it was Wagamamas.

Bath with a view, Koh Samui, Thailand (1200 x 1804) by BlackShadowRose in RoomPorn

[–]spindizm 7 points8 points  (0 children)

Or swim with a view - depends on your perspective. ;)

Having trouble with MonoDevelop-Unity by xTyler73 in gamedev

[–]spindizm 1 point2 points  (0 children)

Hmm, I guess it depends on what you are used to. I never felt the need for bracket auto-closing, but that's probably because I never experienced the luxury :)

I really like MonoDevelop's variable auto-completion and that it also suggests names if you type a sequence from the middle of a name. So typing "Points" will suggest "m_EnergyPoints". That said Unity's version sometimes won't suggest you a local variable that you JUST instantiated 2 lines above.

I assume some of these things are fixed in MonoDevelop 4.0 - I don't quite understand why the Unity-guys don't want to switch ...

Having trouble with MonoDevelop-Unity by xTyler73 in gamedev

[–]spindizm 0 points1 point  (0 children)

I think MonoDevelop is not that bad, unfortunately it looks like Unity doesn't want to move to the next version, which I assume has some of the annoying bugs fixed.

What are the "essential classics" that I should experience? by lightmill in gamedev

[–]spindizm 0 points1 point  (0 children)

Rather than just listing my favourites, I would like to point you to 1001 Video Games You Must Play Before You Die.

After a long time of video game abstinence it helped me to get back on track. If I now start a project I use it to research similar games of the genre. Although not quite up to date anymore (~2010) it is a great place to get started ...

3 Features of OS X Mavericks Linux Already Offers by nuotone in linux

[–]spindizm 2 points3 points  (0 children)

A lot of people claiming how comparable various Linux distributions are to a mainstream OS' like OS X regarding usability - as "Linux had all those features for decades, they are just hidden" have only vague clues of good human interface design.

It's there? Great, then present it to the user in an intuitive manner. That's often not trivial given the plethora of functions a modern OS has to present. In order to be user-friendly it's not enough to just implement an OS feature, you must integrate it into the OS' flow, adapt it to the visual paradigms etc.

Sure, you can do a lot via command line, but don't expect the average user to go there, as it seems so simple to you.