Jump to content

  • Log In with Google      Sign In   
  • Create Account

Dagz

Member Since 15 Mar 2010
Offline Last Active Nov 01 2012 06:47 PM

Posts I've Made

In Topic: C#/XNA Simulations always get laggy over time

27 October 2012 - 12:51 PM

Dagz

This is symptomatic of using Event Handlers but not unhooking them. Its a common mistake to make if you are new to .net. Look for any event handlers you hook up and make sure you are unhooking them deliberately at some stage. What tends to happen is they get hooked at some stage but never unhooked. This means that the class that has the event declaration has references to all those classes that hook that event, and if that event raising class is a static or long lived class, the classes that are hooking its events never get released to be GC'd - and even worse continue to have events raised on them long after their utility has gone.

This might not be precisely your problem but its a common anti-pattern that leads to memory loss and laggy behaviour in .net systems of all kinds.


I'm not sure what event handlers are or what it means to unhook them, but thanks I'll look into it. Google is my friend :P

In Topic: C#/XNA Simulations always get laggy over time

25 October 2012 - 09:50 PM

Thanks for the quick replies. I think you guys are right, it must just be that I've written very poor code in the past. These are past projects that I'm talking about so while I'm not certain, I am pretty sure that I wasn't making any of the mistakes you guys spoke of. Nevertheless I did write up a simple 2D physics sim and left it running all day and it never slowed down due to lag.

ATC I'm not very experienced, but I've always been trying to take on projects that are outside my skill level. I'm very interested in AI and evolutionary algorithms though. As soon as school works slows I want to implement some new ideas and I'll have to scour through my code and make sure there are no memory leaks.

In Topic: Neural Network Genome Help Please :'(

25 March 2012 - 06:36 PM

So my problem is Number 5.


Okay tell me if I'm wrong but your problem is that you want to take two parent networks, and combine them to form a child network as some sort of simulation of sexual reproduction? How you do this depends entirely on what kind of neural network you're using.

If you're using a fixed topology (meaning the graph-structure), that never changes and thus every one of the creatures neural networks is the same then it's super easy to get the child's neural network (or geneome). All you have to do is run through the child's genome and select genes for it's father or mother randomly to fill the same location the gene would have filled in the parent, like

Father: A, B, C, D
Mother: 1, 2, 3, 4
Child: A, 2, 3, D or 1, B, C,4 or any random configuration.

If the topology of the neural network evolves along with the weights of the network then things are a little more difficult. You would need to use what is called the NEAT algorithm, it's a little tedious to read up but if you just google it you should find pdf documents explaining it. I would suggest just sticking with fixed topologies. I don't know Java so I can't actually help you out with code, but I could explain algorithms maybe in more detail.

In Topic: New to C++, could I get advice? (switching from C#)

14 March 2012 - 06:33 PM

:/

I am rather curious about where you heard this as OpenGL is known to be easier to learn than DirectX and both are equal in terms of what can be achieved (although I prefer the way DirectX is structured).

From people who I suppose were no better informed than me.

Anyway you dont have to leave C# to use DirectX / OpenGL, theres well known stable wrappers that have all the benefits of DirectX / OpenGL, have a look at SharpDX, SlimDX or OpenTK and if you are still worried about performance, which tbh you shouldnt be as the performance difference is unnoticeable, have a look at http://code4k.blogsp...11-apis-vs.html it is an old thread and I typically avoid benchmarking articles but it does give an idea on how close C# can be to C++

Thanks, yes I have descided to stick with C# and continue using XNA. I'm planning to start trying to duplicate many of the features of the game Ragnerok Online. I love tilebased/3rd person/mouse action games like RO, and I'd like to make one like it some day. Happily I've found a website that's ripped a ton of sprites from the game, creating graphics is such a hassle :P

In Topic: New to C++, could I get advice? (switching from C#)

13 March 2012 - 11:30 AM

Okay thanks guys, I'll take your advice and stick with XNA and C#. I'm suprised I got 9 replies in only one day, this community must be quite active.

PARTNERS