Recent posts by EndlessSporadic on Kongregate

Flag Post

Topic: Game Programming / Game Idea

There are only 3 things in game programming – arithmetic, comparisons, and storage (there are 4, but 1 is the low level stuff you don’t need to worry about at this stage if you don’t even know the other three). All functions that are “DoSomething” fundamentally break down into these three categories.

Arithmetic

Value = Value + Value2
Value = 1/Value – Value2
etc…

Comparison

if (x < y)
if (x == y)
if (!x)
etc…

Storage

x = y
x.addComponent(y)
x.setColor(y)

Classes and objects can be thought of as storage units. Operations are a combination of comparisons and arithmetic. If x is true, do some arithmetic, else do some other arithmetic. When it comes to collision detection, you have 2 colliders (storage). Think of these colliders as 2D boxes. Are these colliders overlapping (comparison)? I’ll give you some code. I expect you to understand what everything means by the end and I hope you go back to that C++ book and actually learn what is in it.

class Collider {
    int X; //the x coordinate, top left
    int Y; //the y coordinate, top left
    int Width; //the width
    int Height; //the height

    //This makes a box. Do you see why? With these four variables you know where infinite points are in the box.
}

class SomeClass {
    
    bool isCollision(PlayerCollider, OtherCollider) {
       
       //Get the rightmost X
       int x1 = Math.Max(PlayerCollider.X, OtherCollider.X);
       //Get the leftmost X
       int x2 = Math.Min(PlayerCollider.X + PlayerCollider.Width, OtherCollider.X + OtherCollider.Width);
       //Get the top bottom-most Y
       int y1 = Math.Max(PlayerCollider.Y, OtherCollider.Y);
       //Get the bottom top-most Y
       int y2 = Math.Min(PlayerCollider.Y + PlayerCollider.Height, OtherCollider.Y + OtherCollider.Height);
      
       //What we have done above is create a new rectangle that covers the entire intersection area.

       //Checking if this rectangle occupies a positive space.
       if (x2 >= x1 && y2 >= y1) {
 
           return true;
       }
       return false;
    }
}

Assume we are creating a new box that covers the collision area.

x1 gets the left x coordinate.
x2 gets the right x coordinate.
y1 gets the top y coordinate.
y2 gets the bottom y coordinate.

If the right X coordinate is greater than the left X coordinate &&
If the bottom Y coordinate is greater than top Y coordinate, this creates a box with positive area.

Take a look at the image below that demonstrates why this works.

The following image shifts the green block over 6 places to the right. This one has no collision. Why? While the Y creates a positive area space, the X coordinates create a negative space, meaning there is no collision.

 
Flag Post

Topic: Game Programming / Best Way to format numbers? (show in thousands, millions, etc.)

Originally posted by player_03:
Originally posted by Aesica:

Edit: Isn’t it considered bad practice to have multiple return statements in the same function?

Depends who you ask. In my opinion, no.

I go with no as well. Sometimes it is the only way to do things. I utilize multiple return statements quite often, actually. Let’s take a look at a simple function (C++ syntax).

//Static interface for player DoSomething()
bool StaticLibrary::DoSomething(Player* player)
{
    //Check for null pointer
    if (!player)
        return false;

    return player->DoSomething();
}

You will often need to return early if you are trying to iterate over something. Take a look at this example.

Player* StaticLibrary::FindPlayerWithTag(String tag)
{
    for (Player* player : PlayerList)
    {
        if (!player)
            continue;
        if (player->Tag == tag)
            return player;
    }

    return nullptr;
}

As for the switch vs if-else, it all depends. Some compilers can optimize switch statements by putting them into a jump table or indexing pointers, whereas there is rarely optimization done for if-else statements. With this said, sometimes these switch statement optimizations will actually cause it to run significantly worse than if you had used an if-else.

Switch and if-else optimization is something that is so low level that I can almost say with 100% confidence that it won’t be your job to worry about that. If you ever get into a large dev team chances are there will be someone there whose job it is to optimize this kind of thing for you. I tend to use switch for comparables (comparing strings, enums, or flags) and if-else for numeric comparisons. Note that this doesn’t mean it is the right way to go about it, but it is certainly the most readable.

 
Flag Post

Topic: Game Programming / New to Game Development

When it comes to design there is no such thing as outdated. When it comes to actual application the only way to learn is to figure it out for yourself and do your own research. Not only will you be a better developer for it, you will prove to the rest of us that you are serious about developing games.

Start by figuring out what kind of games you want to make and what platforms you want to target. Pick an engine and read up on basic object-oriented programming (OOP) concepts.

 
Flag Post

Topic: Game Programming / Best game engine!

Drag and drop isn’t always a bad thing, though I do have thoughts on that topic which I don’t feel the need to express due to irrelevance.

I believe Drakim’s post went ahead and stated my thoughts.

The reason I don’t think it is a bad thing is that if you aren’t aiming to be a programmer it doesn’t matter. Flowgraph (CryEngine) or Blueprints (Unreal) are great and necessary for level designers and content creators. It allows them to hook up their stuff without having to waste their time on something they have no business doing. Programming should be strictly restricted to programmers. It is the programmer’s job to make the core systems and create interfaces that allow the other departments to use the tools they have created. It does not matter what these interfaces take the form of as long as it lets the other departments do what they need to do in a way that doesn’t bottleneck the rest of the system.

When it comes to indie development or, a step below that, Game Maker development, there is usually only one person working on it. They can drag and drop stuff, sure, but the underlying foundation is not completely there for the creator to make what they want – if that person wants to do something that isn’t supported by Game Maker they are royally screwed. The counter argument is that they could add it in manually, but if they knew how to program they wouldn’t need to use Game Maker.

As Drakim said, drag and drop, when used by a single person to make the core systems of their game, is a very bad practice and can’t be called real game development.

 
Flag Post

Topic: Game Programming / 3D model search engine

Very cool, though I am disappointed by the lack of texturing.

 
Flag Post

Topic: Game Programming / Best game engine!

it’s always going to be tainted as that “Drag and drop tool used to make video game”

Unreal Engine 4’s blueprint system is also essentially drag and drop. Drag and drop isn’t always a bad thing, though I do have thoughts on that topic which I don’t feel the need to express due to irrelevance.

Game Maker, as Pugzy clarified, is great for quick prototyping and simple 2D games. Ultimately that is all it is good for. Many devs who take themselves seriously will want to expand into unknown territory and see their ideas come to life. Game Maker just doesn’t have the framework to support this kind of thing. Game engines are trees, setting the foundation to let your ideas grow. Your game is a branch, utilizing the tree while expanding into the sky. Game Maker is a cactus. It has a core and tiny needles that reach out but don’t quite get anywhere. It may have a limb or two, but they do not touch the sky.

To clarify that metaphor, Game Maker is a tool that is only decent in one or two places and doesn’t leave much room to expand and grow. There is nothing wrong with specialized engines (cacti), but that engine is meaningless if there are versatile engines (trees) that can do the same thing better.

 
Flag Post

Topic: Game Programming / Need a unity fullscreen script

Google is your friend. So is the Unity Documentation.

 
Flag Post

Topic: Game Programming / How to make a game

facepalm

 
Flag Post

Topic: Game Programming / Max width over 800px?

They may receive special permission. Cases outside the norms are handled on a case by case basis, so you may need to email support once your game is uploaded to have them change the accepted width. This goes double for game file size.

 
Flag Post

Topic: Off-topic / Ebola hypothetical question.

I’m prepared to die, but I’m not going to purposely go out just to get laid.

 
Flag Post

Topic: Game Programming / What's with all the hate on Unity?

Originally posted by Draco18s:
Originally posted by StallionGriefs:

I hate on Unity because it has far too many limitations, even in Unity Pro.

Just FYI, this is like saying that you hate Flash 2004 because it has too many limitations.
Seriously. Unity is a young platform.

Yet they are selling it for 77x what their competitors are selling their engines for. It’s not even the fact that nothing is implemented – it is the fact that they actually hide the functionality from us. For example, they hide almost all of the FMOD functionality. I will respond to your analogy with another – it is not OK to sell an early access game for $300.

 
Flag Post

Topic: Off-topic / All these newfigs...

I see nothing has changed since I left. You’d think after 4 years all of the two year olds here would have started acting like 6 year olds. I was wrong.

 
Flag Post

Topic: Game Programming / i need help in c++

Also of note is that if you do “>”, you want to start with the higher number first. Likewise, if you do “<”, you want to start with the lower number first.

if (a>90)
     doSomething();
else if (a > 20)
    doSomethingElse();
else
    doSomeOtherThing();
 
Flag Post

Topic: Game Programming / Couple of questions about UDK

.UDK files can’t be opened in versions past 4.0 as they have switched to the “.uasset/PAK” format. You would need to find the older versions of UDK (should be easy – look for the May 2013 UDK). You can find the homepage for Unreal 4 here. I do not know all of the payment plans they accept.

 
Flag Post

Topic: Game Programming / Couple of questions about UDK

Whoa whoa whoa, hold up, Draco.

UDK is now the same thing as Unreal 4. You can export directly to HTML5 with Unreal 4. If you are so inclined, you can purchase Unreal 4 for a one-time payment of $20USD (assuming you do not want updates). 5% of what you make will need to be paid to Epic.

 
Flag Post

Topic: Off-topic / Anime Addicts Anonymous (AAA)

Originally posted by 10crystalmask01:

Ha ha, reviews here about the anime aren’t looking so bright (Agreeing with you EndlessSporadic, SHAFT is the only thing that made me notice this anime’s existence).

Looking back from now, would you consider skipping this anime?

It’s not bad enough to skip. Just don’t expect anything out of it.

Speaking of SHAFT, I started watching Arakawa Under the Bridge. It was nothing like what I expected, but it has its own charm. I can’t say it is amazing, but it is different and pulls it off quite well.

 
Flag Post

Topic: Off-topic / Anime Addicts Anonymous (AAA)

This thread has turned into text walls. Gross.

Originally posted by 10crystalmask01:

Anybody watched Mekakucity actors?

I did. It was meh. I love Studio SHAFT though, so it has that going for it.

 
Flag Post

Topic: Game Programming / Some Advice Against Unity

Originally posted by Loserface117:
Originally posted by EndlessSporadic:

If you want your game to get a lot of plays, I would suggest not making a web game.

And what, pray tell, would you suggest they use as a platform for their game, then?

Anything but web. Hell, I’d even say go Linux over web.

 
Flag Post

Topic: Game Programming / Some Advice Against Unity

If you want your game to get a lot of plays, I would suggest not making a web game.

 
Flag Post

Topic: Off-topic / Petition to make forum mods be able to silence users

This won’t happen. Kongregate said they wanted to separate the forums and the game chat. Silencing would interfere with both. Silence separation is something Kongregate has said they wanted to do, but I see they haven’t done it in the 3 years since that was said.

 
Flag Post

Topic: Off-topic / Anime Addicts Anonymous (AAA)

Originally posted by Meistheman:
Originally posted by Indy111:

So myanimelist.com got hacked.

If you look at my list or yours you’ll see a bunch of over 9001 episodes of “SSJMaster vs Xinil”

Mildly interesting….

Lol you are right

This isn’t the first time this has happened. The exact same thing happened a few months ago as well. That is when I started backing up my list onto AnimePlanet.

 
Flag Post

Topic: Off-topic / Anime Addicts Anonymous (AAA)

Originally posted by RollerCROWster:

wtf do you need HD quality cartoons for?

do u rly need to see the intricate details on the black outlines and solid colors?

or are you just wasting space on ur hard drive so u can brag about having ur japanimations at 43643737p

Still up to your pathetic trolling, I see. I’m surprised you have managed to keep it up for this long.

Really though, there is a huge difference in 420p compared to 720p, especially in scenes with a lot of motion. I’m sure there is no difference for you though since it doesn’t matter much with Barney or Blues Clues.

 
Flag Post

Topic: Off-topic / Anime Addicts Anonymous (AAA)

Originally posted by Indy111:
Originally posted by MelbourneBoy:

Re-downloading Nagi no Asukara with an mp4 format. I got the whole anime already downloaded on my computer, but it is in mkv, and wanted to put the anime onto my iPhone, so yeah. All good quality episodes too, all in 480p.

Good quality…in 480? Uh….

I chuckled at this too. 420p isn’t good quality. That said, it is hard to find a difference between 720p and 1080p since most 1080p versions are upscaled.

You can convert MKV into MP4 using VLC, Melbourne. No need to redownload the series. I wouldn’t even say Nagi no Asukara is worth wasting the bandwidth on a second time.

 
Flag Post

Topic: Game Programming / Unity

He is moving away from Game Maker and moving into Unity, and you immediately throw shaders at him? You are an evil person, Draco ;)

 
Flag Post

Topic: Game Programming / The future of flash

I’m going to throw all of the flash fanboys under the bus here because they need to wake up and smell the coffee. Flash is dying as a medium for making profitable and respectable games. Flash will still exist in the future in the form of Scaleform, but you will not make a steady career out of making flash games. Any flash “games” you make that are profitable will only be so because you most likely designed it around making money, in which case you should be ashamed to call yourself a game developer.

I will fight to death (not really) that you will not have a stable, well paying career based solely off of Adobe Air or Flash. It is another story if you also learn C#, C/C++, or Java.