Saturday, June 30, 2012

Crossroads

Oh the interesting qualities of programming...o_O  I've decided to scrap my XNA project and remake it, because the organization is so bad on the old one.  It would be best to have something more organized first.  Fortunately I have a better idea of what I want to do now, and I have been working on some documentation now, instead of just going all over the place, and having no set idea of what i want for the program.

Now, to be honest, I'm at a bit of a cross roads between making an RPG or making a platformer...the RPG would be a bit less mathematically challenging...and I would use a fairly simple system for the program, think old school FF style system.  Probably with the visual qualities of FF1, and potentially a system like 6...although that's still up in the air.

However, something like that requires a lot more organization, and far less spaghetti code...>.>  I've been known to have small sections of spaghetti code.  My main problem is that I don't want to go back and forth between program ideas, and organizations, because I don't want to get stuck with 50 unfinished projects.  Any advice from my few readers out there?

Wednesday, June 27, 2012

Kind of update?

No new news, just updating because my comics apparently just came out...>.>  I don't have a lot of plans tonight, although i'm drinking some alcohol with my dad tonight.  Tis a rare happening, and it's always nice.  :-)  So yeah, no updates on the program, just booze...

Sunday, June 24, 2012

Updated collision detection with ray casting that actually functions but needs more testing!

Alright, so there might be good news...From what I can tell my ray casting algorithm is working so far, however the movement is still very umm....bad.  But, I'm quite glad to see my ray casting algorithm works.  I'll be working on it some more for initial circle collision, then the ray casting detection for more accurate collision detection.  At the moment I'm watching Psych...I'm on season 2 so far so good.  Rather silly, as always, but I never can focus on my programming...I went ahead and posted a few lines of code from my work.  If any readers want to comment on the code, shoot me a comment, I'll read over it and reply.  I'd be glad to hear about things i can do to improve.  :-)

Basic method for checking if a point intersects a segment.  Edge class contains 2 Vector2's, p1 and p2, which act as a 2D point in electronic nether-space.


        protected bool RayIntersectsSegment(Vector2 p, Edge edge, Vector2 world)
        {
            //This method is strictly used for checking if the specific point p intersects the edges points.
            //First we need to find the 2 vector values a and b.  a must be below b on the y axis.
            Vector2 a;
            Vector2 b;
            float red;
            float blue;

            //Check which one's above and which one's below.  And then increment them by the world translation.  It's very important that we do that...
            if (edge.p1.Y >= edge.p2.Y)
            {
                a = edge.p2 + world;
                b = edge.p1 + world;
            }
            else
            {
                a = edge.p1 + world;
                b = edge.p2 + world;
            }

            if (p.Y == a.Y || p.Y == b.Y)
            {
                p.Y += 2;   //Magic number used to increment y just a little bit to get it out of the path of the vertex itself.
            }
            if (p.Y < a.Y || p.Y > b.Y)
            {
                return false;
            }
            else if (p.X > Math.Max(a.X, b.X))
            {
                return false;
            }
            else
            {
                if (p.X < Math.Min(a.X, b.X))
                {
                    return true;
                }
                else
                {
                    if (a.X != b.X)
                    {
                        red = (b.Y - a.Y) / (b.X - a.X);
                    }
                    else
                    {
                        red = float.PositiveInfinity;
                    }
                    if (p.X != a.X)
                    {
                        blue = (p.Y - a.Y) / (p.X - a.X);
                    }
                    else
                    {
                        blue = float.PositiveInfinity;
                    }

                    if (blue >= red)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }

This method is called in this series of loops here.  The object vertices is a List of vertices, and the object boEdges contains the list of Edge objects in the other polygonal object.


                    foreach (Vector2 cp in vertices)
                    {
                        int bcounter = 0;
                        Vector2 cpw = cp + parent.position + parent.origin + offset;    //Translated to the world.
                        Vector2 oWorld = other.position + other.origin + box.offset;

                        //then check for every edge in oe.
                        foreach (Edge oe in boEdges)
                        {
                            if (RayIntersectsSegment(cpw, oe, oWorld))
                            {
                                bcounter++;
                            }
                        }

                        if (bcounter % 2 > 0)
                        {
                            //If the counter turns out to be odd, return true.
                            return true;
                        }
                    }

If I got anything seems wrong, give me a holler, I'm all ears.  :-D  Also, this was created in C# using the XNA Framework.

Saturday, June 23, 2012

Latest update.

Alright!  I have good and bad news for the day.  I set up a basic raycasting system for my XNA engine project.  It works, however I'm getting a lot of errors with it.  -_-  So, I'm mostly back to square one, but I have a working system up that I just need to figure out what's wrong...essentially.  I'm guessing it has a few other problems going on right now, but I'm working on it.

The problem I'm having is that I can't visualize the segments very well.  I can visually mark the vertices, however I can't make the edges.  For now, vertices work though.

The Player object is also animating well...I have a series of sprites that are very basic, but work fine for now.  The animation also has different beginning and end sections as well, so the animation will run to a specific point, and then when it's done there, it starts back up at a specific point.  It runs from left to right, then back to left on a new row, once it's exhausted that first row.  So you can't have little sections of animation, like a square in the corner dedicated to running, a square in the corner dedicated to jogging, and a square between dedicated to something else...essentially.  Here, I'll draw a diagram, hope it helps, cause it took me a while to make.

[run ][----][----][----][----][----]
[/run][jog-][----][----][----][/jog]
[fall][jump][----][----][----][----]

That diagram would work.  The last 4 tiles in the lower right hand corner can be whatever the fuck you want, idc...but, you can actually make one frame specific to one thing, and it will "animate", essentially.

Run will last until /run, same with jog, fall and jump are individual single frames for the action.  Eric should understand this pretty well...Anyway, there's no limit on size, so far as I know, but it's best to keep it small and simple I would imagine.

As for things that won't work, here's a good example.

[run][run][run][jog][jog][jog]
[run][run][run][jog][jog][jog]

This will not work, because it runs sequentially through this process from left to right in a row, then down a row back to the left, like I said.  :-)

Anyway, enough said, I will be back in a few days with a new update!  :-D

Thursday, June 21, 2012

Game Engine finally done...but not for Impulse Strike 2. :-(

Alright, just finalized my GSP420 class, and that included making a demo with a game engine we developed as a team.  The team included everyone in the GSP 420 class, which is awesome.  I would say I wrote my own game engine, but that would be a complete and utter lie, sadly.  I just wrote the configuration xml parser, and a variety of small code sections.

Oh I have found my next new love...XML.  Apparently C# has a decent XML parser class, which is pretty badass.  I utilized that parser to create levels from an XML document.  I'll be working on creating a nifty level editor with it, so I can update and adjust the level document outside of the class.  :-D  Will be epic.

As for IS2, there's really no updates, this engine class has taken over most of my mornings, and my nights are filled with watching anime lately...>.>  And Monk...I love that show.  I've also been watching South Park every so often.  It's a very unique show...not as bad as Drawn Together, but still killing off brain cells slowly...

Anyway, gonna go find my song of the day, post that, and see you all later.  Take care.

Wednesday, June 20, 2012

AGH! No posts lately! The horrors!

:-O  I haven't posted in ages.  Of course, I haven't made any updates in ages either.  I can blame Eric for that :-P  He got me started on SC2 again...check out my facebook if you want to see some pics of our crazy adventures on there.  We were playing a Terran survival match with only marines...was quite entertaining to say the least.  Lots of blood gore and "You want a piece of me, boy?" :-P

Oh fun times...anyway, as far as updates go, I haven't gotten anything new lately, it's been rather boring on that front.  I've been very busy with finishing up a game engine for class, I'll post that once we're all finished up with it, and people can fiddle around with it as they see fit.  It's really simple (very...very...very...simple.) and probably has more memory leaks and unused code than I'd like to admit, but that's just because it was a team effort where people couldn't agree on how things would work.  And a few people on the AI team seemed to be very green at programming C++.

Of course, I'm still pretty green myself.  I can made the XML Parser in C++ using TinyXML2, which is fairly simple and easy to use.  However, that was basically my introduction to advanced C++ programming...after 5 years of programming in various other languages like Java, C#, and Visual Basic.  I've grown very fond of C# though...and XNA.  Once I got the O'Reilly book about XNA, I'm so happy to see I can do a lot with it.  I just need to learn more math and physics.  I feel like despite nearing my Bachelors degree, I still have yet to touch on a full understanding of the mathematical functions I use.  I just use them, and if they work great, if they don't, I beat it with a stick and do everything I can to understand why it's not working.  And if all else fails, I continue the beatings, and then give up.

So yeah, no new updates, just me babbling about stuff going on.  :-)  Take care.

Thursday, June 14, 2012

Hello my readers of awesome...Sorry for the 6 day delay between updates...I've been quite busy trying not to die on Diablo 3.  Finally made it to Inferno and I went from being somewhat squishy to super squishy...-_-  Even with 56% damage decrease in defense, I take like...40k damage from really annoying rares, or champions, and bosses.  I was one shotted by a mob, and yet I could take down Diablo on Hell in one go...how the fuck does that happen?  When did Diablo's minions become more powerful than him...o.o

Anyway, enough with my rant on Diablo 3...I'm looking forward to the next couple of days.  Eric and I have redirected our game idea a little bit.  I'd rather not get into that too much, but it's still a platformer.  Personally, I've been a big fan of platformers since I played the original Spyro game.  I'm quite happy with the direction we're going, I would just like to get some work done on it.  We're definitely sticking with Torque for the new direction as well, so hopefully we can get something simple out soon on the website.

The reason behind the redirection/change was primarily because of art assets.  Eric's artwork is good, but he's pretty busy with school and work, and various other life...things...anyway, he's busy, so he can't work on the program if he's doing art all the time, and Impulse Strike has always had very complicated artwork associated with it.  If we can get the art pumped out of the way, we'll be fine...Was the original idea behind asking Summer to help, however that has gone nowhere so far.  -_-  Very disappointed with that, but I didn't expect it to go very far originally, was just hoping she would want to have a side project or something she could add to her portfolio.

Friday, June 8, 2012

Ok, so good news...Updated the project a little bit.  Bad news...There's still input issues that I'm unable to resolve.  If this was a polling language it would be easier, but since it's not a polling language, it's a bit more frustrating, and more difficult to find a workaround or something of a similar nature.

In the project, I've added a grenade object, which breaks into multiple shrapnel bits.  These bits have a random frame to choose from when created, and it works very well.  Whenever the shrapnel hits a wall, or the player now, it will stick to the object.  One of the awesome things with Torque is the mount feature, which mounts one object onto another and makes it follow the other object, so when the player gets hit with shrapnel, it essentially mounts to the player, and follows him around for a little while, then it's deleted.  I also want to get the explosion created as well, which some day or another, I'll get a decent explosion animation.  I'm still on the fence about XNA, because I really want to have some 2D physics in this game, and right now Torque is just showing off...>.>

The physics in Torque still need some fine tuning though, it's rather difficult to get correct for me, because it's a bit confusing for me right now.  I understand how they all work, I just don't understand why there's absolutely no friction, even though it's set to a value of 3000 on both objects that are moving.  @_@  So confusing...

On a side note, I also set up a wall class, which was initially required for the shrapnel, but now it's a bit obsolete, since it sticks to everything now...I also need to use that to set up the jumping to not allow constant jumping.  It would essentially use the collision callback to check if it's colliding with a wall on the players feet...that's going to be interesting.  Thankfully, torque has the points where the collision is occurring, I'll take a look into how to check which points they are, or where they are, etc...and see if i can find a good way to verify that the player is on the ground.  I could also use that moment to set the constant Y force to 0...and then when you jump set it to gravity.  :-)  Less work on the system, at least I think...we shall see how it works out.

Anyway, gotta go, sorry for the long post, but I hope I can get some insights from anyone that's reading this. Thanks!
Looks like as of right now there's no new updates to the program. I'm still getting used to the engine, and potentially looking into XNA, however I'm sort of still on the fence.  I haven't told Eric about that yet, it's rather complicated...To say the least, I would need to create a way to check for concave polygonal collision detection and include physics with that, and it's just...too complicated for me right now.  Unfortunately I don't have a good understanding of the formula, or a way to simplify it for a GUI based tool...So...complicated, yes, possible yes, but would take a very long time for me to master and understand the concepts, and I just don't have that kind of time...

So I think Eric wins on this one then...Torque works.  Anyway, I'll be working on creating more classes for Torque tonight potentially, but over the next week, I'm sure I'll have some decent classes in the mix here to provide some interesting physics, and demonstration.  As for the file that I recently placed on the website, it's really a template right now that's just...incredibly basic, and not very useful right now.  If you want to try it out, feel free, but there's little to nothing to do on it right now.

Oh, and I mentioned this earlier, but our game engine of choice right now is Torque Game Builder 1.7.6.  It's got a decent built in physics engine, and a rather complex and powerful scripting language that I still need to learn a lot more about...@_@  We shall see how this goes.

Tuesday, June 5, 2012

Almost ready for an update...almost as in maybe 3 days?

Alright, so I'm starting a little bit of work with the engine.  I have control over the player, at least a little bit.  Nothing super fantastic and useful with it.  I'm just glad to see how easy it was to do it, with minimal syntax pains.  I don't really want to talk about the new engine we're using yet, I'll talk with Eric, see if I can post about it yet, but it's actually quite powerful and useful.  I'm just not 100% sure yet about how it will work with other aspects of the game.

I'll be working on updating the program some more over the next few days, but no promises on posting an update yet.  Another quality of this engine is the size of the file went up considerably...so I have to start considering my space on the Google site now, hehehe.  Also, tonight's song of the day is just fucking epic...listen to it when you get the chance!  I have loved The good, the bad, and the ugly since I was a kid, and this song is just...fantastic.

Monday, June 4, 2012

No updates yet. :-O

Looks like we're still in the development phase.  I've been reading up on tutorials for the new engine, to see if I can figure it out, and it seems simple enough, despite all of its complexities.  We've got a decent idea of how the game's going to work, we just need to flesh it out, see what happens, and adjust the program from there.  :-)

I'll try to get something worked on by Wednesday, but no promises right now.  I still need to convert the old image files over to the new engine.

Also, because I've been playing Diablo 3 so much lately, I found a decent way to contain the files.  ^_^  I'm going to use my soulstone USB drive to contain all the files I need for development.  Gotta love collectors edition games with USB drives, right?  I just hope it'll fit my laptop while I'm using my lapdesk.  Hehehe.!

Friday, June 1, 2012

More development, less work! :-P

Alright, long time no see.  I talked to Eric for a little while, looks like I'll just be updating about...three times a week now, instead of semi-daily.  Essentially whenever my favorite comics start updating their comics, I'll be updating my blog.  :-D  Looks like Mon,Wed, Fri for now.  To be perfectly honest though, I haven't gotten anything done.  Eric and I are working on developing the project idea further, and it looks like we may be switching engines.  I can't talk about it too much...need to keep some illusion of interest, right?  Hehehe.  We're trying to focus more on developing the game, rather than me fucking around with a program.  It's fun to fuck around, but difficult when you have no direction yes?

With the decision to switch engines, comes the decision to essentially scrap the work I've done, and start all over.  It'll be nice getting a different view with another engine, and some more experience as well.  Fortunately they seem to use a similar scripting language, but I doubt this new one will be nearly as easy as Game Maker...however, Game Maker did have its major flaws and limitations that we didn't particularly like, I will say that much.

To be perfectly honest, I love using XNA as a game engine.  It works stupendously well, and supports windows platforms, however, I think Eric and I need to work on a broader spectrum of systems.

So all in all, updates to the game are currently suspended until further notice, which may or may not be the next...4-10 business days...>.>  Or something silly like that.  At which point it will be something very simple and/or simple.

Anywho, I must be getting to sleep, Dr. appt in the morning.  Latorz!