Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - StormWingDelta

Pages: [1] 2 3 4
1
General / Free IDE Hunting
« on: December 19, 2016, 06:14:51 pm »
Needless to say as much as I like Visual Studio I can't keep up with its massive updates and likelihood of needing to pay for the better versions.

Are there any other Free IDEs out there that work well with C# and the .Net Framework and other .Net languages? Ones that also can compile SFML if needed?

Been looking into things like SharpDevelop but not sure if it has everything needed up to date to compile something like SFML.

Any others people have that might work?

2
General / Error when trying to use SFGUI with Visual Studio 2013
« on: June 23, 2015, 10:46:55 pm »
No idea what is going on here. Just copy & pasted the helloworld example of theirs to test something and got this error;

Unhandled exception at 0x01FCB4D7 (ig4icd32.dll) in SFMLCPPGUITesting.exe: 0xC0000005: Access violation writing location 0x057A3000.
 


Here's the code if anyone wants it but not sure it is the code that is causing the problem. :(

(click to show/hide)

Was planning on checking if my setup to another class for using SFGUI was the issue but since I got the same error with their setup I'm not so sure of what is going on.  I'll post more useful info if needed later.

3
General discussions / Funny errors you've made or run into?
« on: June 21, 2015, 02:47:42 am »
Those little oops error that take longer than they should to find kind of errors.  The ones you spend a while hunting down and just laugh about later.

Just curious what some of those are.

In my case I was linking to a DLL file instead of a LIB file earlier and it didn't register on my brain until I checked what I had linked before. >_>

4
Needless to say I ran into something rather interesting.  It's common knowledge that most tutorials have some bugs in them, especially ones from people that might not know as much as they are letting on but still want to try their best to help.


Most of the time when I'm hunting for tutorials I'm trying to find out something I didn't know but more often than not I also run into my fair share of ones that have bad coding habits and styles in them that might end up teaching some people those vary bad habits.  So I figured why not rip the thing apart and clear out as many bugs, bad habits, and just plain bad code as I could find.


Wasn't sure where to post this either but it sounded like an interesting discussion topic.  Most of the time we get told to shy away from tutorials due to things like bad code practices and other negative things. 

Here's one I did find while hunting for a state machine design to work with: https://www.binpress.com/tutorial/creating-a-city-building-game-with-sfml-part-1-state-manager/123

Now I'll warn you now that some chunks of the code aren't something you want to just C&P.  Make sure when you run into any tutorial to read the code closely and also how the person that made it did things.  This way you can avoid the same bad habits if there are any.  Like others have said in the past don't just straight up C&P the code.  Make sure you understand it well beforehand and try to correct anything that looks like it needs to be in what you run into.  I've found trying to correct other people's errors helps me learn what I want to better and it helps speed things along later as well.


5
Feature requests / IPv6 Support for the networking lib
« on: March 09, 2015, 12:11:35 am »
Just wondering since I didn't see anything to do with IPv6 in there.  Might be useful for later but not really needed.  I know full well we'd need to either add onto the existing IP Address class or make another for IPv6.  It'd likely be easier to just add the ipv6 format to the existing list of formats that can be used but who knows.


I know right now it isn't needed but it might a nice addition for those types that like to get cut by the edge they are at. :)



6
Network / Does the network lib have the ability to use IPv6 addresses?
« on: March 03, 2015, 03:29:22 am »
Just wondering since I haven't seen any examples of them being used yet and figured it would be an interesting experiment.  I know full well we got IPv4 but not sure about IPv6.

7
General / Linker Error when trying to use the 64 bit version of SFML
« on: February 23, 2015, 03:12:57 am »
Error   1       error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'       c:\Users\owner\documents\visual studio 2013\Projects\SpaceFighterRTS\SpaceFighterRTS\sfml-graphics-s.lib(Color.cpp.obj) SpaceFighterRTS

 

Didn't think I'd be getting this type of error.  I've tried to solve it on my own but got no clue what's up.  I was trying to use the 64 bit version of SFML a moment ago or at least I could have sworn it should have been the 64 bit version.  In any event has anyone run into this while trying to use it? 



for the 32 bit version I'm having another migraine.

Error   1       error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in SpaceFighterRTS.obj  c:\Users\owner\documents\visual studio 2013\Projects\SpaceFighterRTS\SpaceFighterRTS\sfml-system-s.lib(String.cpp.obj)  SpaceFighterRTS
Error   2       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in SpaceFighterRTS.obj  c:\Users\owner\documents\visual studio 2013\Projects\SpaceFighterRTS\SpaceFighterRTS\sfml-system-s.lib(String.cpp.obj)  SpaceFighterRTS
 

This repeats over and over for the other parts of the lib and if I change to 64bit mode I get the same error as the 64 bit one but in reverse.  No idea what is going on here either. :(

8
Just wondering since I'm busy setting up the C++ version of SFML for once in a hundred years and forgot the order.  Also was wondering if we still needed to have it in a particular order like back in 1.6.


Also for those of you that link to a lib folder within your own projects is there a way to shorten the path and do something like this: ~\ExternalLibs\SFML   ???

9
I forget how to do this.  I know there is a way to build a texture or image from things drawn on the screen but forget how to do it.  Say a black square acts as what will be transparent and there are many green triangles draw connected together with either Shape or Vertex.  I'm working on a unit builder/editor with this and I'm going to save the created image in a database or in memory for use later in a game I'm working on.  The database would only care about the points needed to remake the image later so the only real issue is the creation of the image itself.

The idea is a player uses the editor to make some unit or structure with some shapes that gets saved as a new image for use by that unit or structure later.  In game it would be a single texture or image but in the editor it is the many smaller textures or images used to make it.

Any ideas?

10
I know it's some simple combination of what we have use of but forget exactly what it looks like to do this kind of check.  I see something for checking when a sound or music has been stopped by the programmer but don't see what to use for if it just ends on its own due to running out of sound or music to play.

11
...a transparent color?

Because I'm messing with an idea of sticking an SFML window on a form and having the form itself have a full background image covering it but still having it visible through the SFML window itself too.  Or do I just make the SFML window fill the form and stick the smaller form controls on top of it for this effect?

12
Not in the slightest clue what's going on but for some reason the arrow keys don't want to work but if they aren't hit first none of the other keys work until at least one of them is clicked once.


Seems the KeyPressed event isn't firing for the arrow keys but does for KeyReleased event.  Not sure what's going on but too tired to post a min example right now due to fight with this strange issue all day and wasn't sure what was going on.

Everything works just fine if the SFML window is all by itself but the arrow keys don't seem to fire the Pressed event when in a SFML Window is in a form.

I'll post an example at some point tomorrow when I get around to it and see if I can replicate it.

13
General / Treating all sprites in a group as one sprite
« on: May 03, 2014, 07:39:25 pm »
Been curious about this for a while and I know it involves list or arrays but what else?  Got several games I've been tinkering with and one involves a  Bejewelled-like setup but instead of the blocks vanishing and clearing the way for more they turn into boosters and try to shove the bricks above them and themselves off the map.  The issue here is syncing groups of sprites so they move as one even if another slams into them or more start adding thrust.

Anyone ever do this before or have ideas how?

14
General / Collision Detection Issues
« on: May 02, 2014, 11:02:29 pm »
Seems sometimes it'll detect the collisions and sometimes it won't for some odd reason.  I've been taring apart an XNA Quadtree example and converting it to SFML and so far it is working but the issue seems to be SFML related I think but not sure.

Yes I'm working in C# but this is more of a general issue from what I can tell. :)
class TreeAbleSFMLSprite : RectangleShape, IQuadStorable
    {
        private Vector2f vel;
        private Color collisioncolor, normalcolor;

        public TreeAbleSFMLSprite(Vector2f pos, Vector2f vecd, Color collide, Color normal)
            : base()
        {
            this.Position = pos;
            Velocity = vecd;
            collisioncolor = collide;
            normalcolor = normal;
            this.FillColor = normalcolor;
        }
        public TreeAbleSFMLSprite(Vector2f pos, Vector2f vecd, Color collide, Color normal, Vector2f size)
            : base(size)
        {
            this.Position = pos;
            Velocity = vecd;
            collisioncolor = collide;
            normalcolor = normal;
            this.FillColor = normalcolor;
        }
        public TreeAbleSFMLSprite(TreeAbleSFMLSprite copy)
            : base(copy)
        {
            Velocity = copy.Velocity;
            collisioncolor = copy.collisioncolor;
            normalcolor = copy.normalcolor;
        }

        public Vector2f Velocity { get { return vel; } set { vel = value; } }

        public void UpdateSprite()
        {
            Move(Velocity);
           
        }

        public Boolean HasCollided(TreeAbleSFMLSprite otherrect)
        {
            return this.GetGlobalBounds().Intersects(otherrect.GetGlobalBounds());/* ||
                (this.ThisContains(otherrect) || otherrect.ThisContains(this))*/

        }

        public Boolean ThisContains(TreeAbleSFMLSprite otherrect)
        {
            return this.GetGlobalBounds().Contains(otherrect.GetGlobalBounds().Left, otherrect.GetGlobalBounds().Top) ||
                this.GetGlobalBounds().Contains(otherrect.GetGlobalBounds().Left + otherrect.GetGlobalBounds().Width, otherrect.GetGlobalBounds().Top) ||
                this.GetGlobalBounds().Contains(otherrect.GetGlobalBounds().Left, otherrect.GetGlobalBounds().Top + otherrect.GetGlobalBounds().Height) ||
                this.GetGlobalBounds().Contains(otherrect.GetGlobalBounds().Left + otherrect.GetGlobalBounds().Width, otherrect.GetGlobalBounds().Top + otherrect.GetGlobalBounds().Height);
        }


        public void ColoredCollisions(TreeAbleSFMLSprite otherrect)
        {
            if (this.HasCollided(otherrect))
            {
                this.FillColor = collisioncolor;
            }
            else
            {
                this.FillColor = normalcolor;
            }
        }

        public void Move(Vector2f vec)
        {
            if (vec.X != 0 && vec.Y != 0)
            {
                this.Position += vec;
                HasMoved = true;
            }
            else
            {
                HasMoved = false;
            }
        }

        public FloatRect Rect
        {
            get
            {
                return this.GetGlobalBounds();
            }
        }

       

        public bool HasMoved
        {
            get;
            private set;
        }
    }
 

class SFMLXNAQuadRunner
    {
        private QuadTree<TreeAbleSFMLSprite> quadtree;
        private List<TreeAbleSFMLSprite> spritelist;
        private RenderWindow window;
        private VideoMode vid;
        private Random rand = new Random();
        private Text text, text2;
        System.Diagnostics.Stopwatch gametimer = new System.Diagnostics.Stopwatch();
        long timestarted = 0;
        float currentfps = 0, framecount = 0, wantedfps = 60;
        int maxdepth;
        public SFMLXNAQuadRunner()
        {
            vid = new VideoMode(600, 600);
            window = new RenderWindow(vid, "Quad Testing");
            quadtree = new QuadTree<TreeAbleSFMLSprite>(0, 0, (int)vid.Width, (int)vid.Height);
            spritelist = new List<TreeAbleSFMLSprite>();
            window.Closed += new EventHandler(OnClosed);
            text = new Text("Test", new Font("Fonts/00Starmap/00TT.TTF"),20);
            text2 = new Text("Test", new Font("Fonts/00Starmap/00TT.TTF"), 20);
            text2.Position = new Vector2f(text2.Position.X, text2.Position.Y + 20);
        }


        public void GenerateSprites(int amount)
        {

            for (int i = 0; i < amount; i++)
            {
                float x = rand.Next(-5, 5), y = rand.Next(-5, 5);
                if(x == 0.0 || (x < 1 && x > -1))
                {
                    x = 1;
                }
                if (y == 0.0 || (y < 1 && y > -1))
                {
                    y = -1;
                }
                TreeAbleSFMLSprite tasfmls = new TreeAbleSFMLSprite(new Vector2f(rand.Next(100, (int)vid.Width - 100), rand.Next(100, (int)vid.Height - 100)),
                    new Vector2f(x, y),
                    Color.Red, Color.Green,
                    new Vector2f(rand.Next(5,20), rand.Next(5,20)));
                //TreeAbleSFMLSprite tasfmls = new TreeAbleSFMLSprite(new Vector2f(vid.Width / 2, vid.Height / 2), new Vector2f(), Color.Red, Color.Green, new Vector2f(10, 10));
                spritelist.Add(tasfmls);
                quadtree.Add(tasfmls);
            }
       
        }


        public void UpdateLoop()
        {
           
            if (spritelist != null && spritelist.Count() > 0)
            {
                foreach (TreeAbleSFMLSprite item in spritelist)
                {
                    item.UpdateSprite();
                    if (item.GetGlobalBounds().Top < 0 || item.GetGlobalBounds().Top + item.GetGlobalBounds().Height > (int)vid.Height)
                    {
                        item.Velocity = new Vector2f(item.Velocity.X, item.Velocity.Y * -1);
                    }
                    if (item.GetGlobalBounds().Left < 0 || item.GetGlobalBounds().Left + item.GetGlobalBounds().Width > (int)vid.Width)
                    {
                        item.Velocity = new Vector2f(item.Velocity.X * -1, item.Velocity.Y);
                    }
                    quadtree.Move(item);
                }
            }
            text.DisplayedString = "Quad Count: " + quadtree.Count() + " Sprite Count: " + spritelist.Count();
            text2.DisplayedString = "FPS: " + currentfps + " Max Depth: " + maxdepth;
            //quadtree.
        }
        public void RenderLoop(ref RenderWindow win)
        {
           
            if (spritelist != null && spritelist.Count() > 0)
            {
                foreach (TreeAbleSFMLSprite item in spritelist)
                {
                    win.Draw(item);
                }
            }
            //RecursiveDrawQuad(ref window, quadtree, 0);
            win.Draw(text);
            win.Draw(text2);

        }
        public void MainThreadLoop()
        {
            GenerateSprites(rand.Next(1000,10000));
            window.SetFramerateLimit(60);
            gametimer.Start();
            while(window.IsOpen())
            {
                window.DispatchEvents();

                framecount++;
                if (gametimer.ElapsedMilliseconds > timestarted + 1000)
                {
                    timestarted = gametimer.ElapsedMilliseconds;
                    currentfps = framecount;
                    framecount = 0;
                }
                //Console.WriteLine(currentfps);
                UpdateLoop();
                RecursiveCollisionQuadCheck(quadtree, 0);
                //LoopTLoopCollision();
                window.Clear();
                //RecursiveCollisionQuadCheck(quadtree, 0);
               
                RenderLoop(ref window);
                //RecursiveCollisionQuadCheck(quadtree, 0);
                window.Display();
            }
        }

        void OnClosed(object sender, EventArgs e)
        {
            window.Close();
        }



        private void RecursiveDrawQuad(ref RenderWindow win, QuadTree<TreeAbleSFMLSprite> tree, int depth)
        {
            if(tree != null)
            {
                RecursiveDrawQuad(ref win, tree.RootQuad, depth);
            }
        }

        private void RecursiveDrawQuad(ref RenderWindow win, QuadTreeNode<TreeAbleSFMLSprite> node, int depth)
        {
           
            if(node != null)
            {
                RectangleShape rect = new RectangleShape(new Vector2f(node.QuadRect.Width,node.QuadRect.Height));
                rect.Position = new Vector2f(node.QuadRect.Left, node.QuadRect.Top);
                rect.FillColor = new Color(0,0,0,0);
                rect.OutlineColor = new Color(255,255,255);
                rect.OutlineThickness = 1;
                win.Draw(rect);

                RecursiveDrawQuad(ref win, node.TopLeftChild, depth+1);
                RecursiveDrawQuad(ref win, node.TopRightChild, depth+1);
                RecursiveDrawQuad(ref win, node.BottomLeftChild, depth+1);
                RecursiveDrawQuad(ref win, node.BottomRightChild, depth+1);
            }
        }

        private void LoopTLoopCollision()
        {
            foreach (var item in spritelist)
            {
                if (item != null)
                {
                    foreach (var item2 in spritelist)
                    {
                        if ((item2 != null) && (!item.Equals(item2)))
                        {
                            item.ColoredCollisions(item2);
                            item2.ColoredCollisions(item);
                        }
                    }
                }
            }
        }

        private void RecursiveCollisionQuadCheck(QuadTree<TreeAbleSFMLSprite> tree, int depth)
        {
            maxdepth = 0;
            if (tree != null)
            {
                RecursiveCollisionQuadCheck(tree.RootQuad, depth);
            }
        }
        private void RecursiveCollisionQuadCheck(QuadTreeNode<TreeAbleSFMLSprite> node, int depth)
        {
            if (node != null)
            {

                if (node.TopLeftChild == null && node.TopRightChild == null && node.BottomLeftChild == null && node.BottomRightChild == null)
                {
                    if (node.Objects != null)
                    {
                        foreach (var item in node.Objects)
                        {
                            if (item != null && item.Data != null)
                            {
                                foreach (var item2 in node.Objects)
                                {
                                    if ((item2 != null && item.Data != null) && (!item.Equals(item2) && !item.Data.Equals(item2.Data)))
                                    {
                                        item.Data.ColoredCollisions(item2.Data);
                                        item2.Data.ColoredCollisions(item.Data);

                                    }
                                }
                            }
                        }
                    }
                    //node.Objects
                }

                maxdepth = Math.Max(maxdepth, depth);
                RecursiveCollisionQuadCheck(node.TopLeftChild, depth + 1);
                RecursiveCollisionQuadCheck(node.TopRightChild, depth + 1);
                RecursiveCollisionQuadCheck(node.BottomLeftChild, depth + 1);
                RecursiveCollisionQuadCheck(node.BottomRightChild, depth + 1);
            }

        }
    }
 

the two files above are mine.

Here's the quadtree I've been ripping apart. :P
Had to post it in an attachment because it was too big. >.>

15
General / Various fast ways of collision detection?
« on: April 30, 2014, 08:52:16 pm »
Asking since the usual two loops of each sprite against the others gets slower than I'd like after a while.  I know of quadtrees but puzzled how to get one working for a map that goes all the way out the the max/min boundaries of the datatype.  Could just go for resizing its outer most size area as needed but that would end up causing the treenodes to rebuild their area as well.


Meantime any other ways of fast collision detection that could be used too? ???  Also any ideas on how to get them working for what I have in mind?

Pages: [1] 2 3 4