Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 May 2000
Offline Last Active Yesterday, 08:55 PM

Posts I've Made

In Topic: Drawing solid triangle

24 October 2016 - 12:35 PM

your code is incredibly hard to follow as the names for variables is poorly chosen and there are not too much in the comments department.


also, what happens when some of your points have the same y value?  step through your code and see if you can see what happens?


what is a bottom half and top half of triangle?  what is a top, middle, and bottom point?  perhaps draw a pic and put it with your post? 

In Topic: How to code patrol() function for my bots?

24 October 2016 - 12:29 PM

key point for your problem that Kylotan stated is that "when you're close enough".  When you are getting your movement direction in endPoint - startPoint, don't get the normalized version right away.  First get the magnitude and that will tell you how close you are.  If it is within a certain threshold, then change your endPoint to be the next point.


furthermore, the else movementDirection *= -1; at the end of your function does no good at all since movementDirection is a local variable in the function scope, it looses all meaning after the function returns.  The next time the function executes it will not be as if movementDirection had been reversed.

In Topic: Running into what I believe is a networking issue regarding a server/client t...

24 October 2016 - 08:49 AM

Agree with Khatharr.  I am a professional Network Engineer (although not for a Telco) and latency over mobile networks can be very erratic.  Your occasional 1-2 seconds could be related to this but the 15-20 seconds does not.  No packet should take that long (even Earth to the moon is about 1.3 seconds).


Switching to UDP would not help in this case.


Most likely there is some kind of bug in your networking code itself that causes these errors to pop up?  Are your sockets blocking?  If so, what is the timeout set on them?  Example: lets say you set 5 seconds as a timeout, and you send a packet from the sender to a receiver but it gets lost/dropped along the way, you wait 5 seconds and resend, it gets lost, you wait 5 seconds and send again and it makes it.....there is 15 seconds there due to 2 consecutive lost transmissions.  Lost/dropped packets on mobile are much higher than other networks as well.

In Topic: Sunlight theory

17 October 2016 - 06:22 PM

but for all practical purposes, yes use a directional light on your planet from the sun and not a point light

In Topic: Sport management game - what's best for both menu and 2D design?

16 August 2016 - 07:10 AM

I would recommend the c# binding of SFML.  I have used it in conjunction with Winforms before.  You can just throw a control on your winform (I choose a Panel) to represent the area on your form you want to draw the graphics.  You then pass in the control.Handle in when creating a RenderWindow.


Then you will override the OnPaint and OnPaintBackground events/functions of your control.  In the OnPaint you will do all your SFML drawing.  In the OnPaintBackground dont do anything (prevent it from painting background of the actual control).  This will redraw when the control detects it needs to like something covering the window then uncovering it.  If you need to continually redraw then you can do something like override the Idle function/event of the Form and call the Invalidate of the control from there to force a redraw.  Or setup a Timer and call invalidate when the Timer fires.


 How to use SFML is documented on their website on how to go from there.  No real documentation on the embedded thing but on how to draw with SFML. http://www.sfml-dev.org/