• What are you working on? v15
    5,001 replies, posted
[QUOTE=garry;27346952]Sure, if you want to use it - if you get stuck give me a shout and I'll write a tutorial on the specifics.[/QUOTE] Awesome, thanks. I downloaded it and it looks like I'll be able to figure most of it out from the unit test code. I'll try and make something simple like a calculator later to get to grips with it.
Working on my beat detection algorithm. I'm stuck on one fucking integer and I feel like an idiot.
[QUOTE=neos300;27338257]After 5 minutes and 1 million generations: Top Car: Speed: -388 Acceleration: -133 Attractiveness: 690 Average: 56 Thats one nice looking but shit slow car.[/QUOTE] Nothing slow about it, it just goes backwards.
[QUOTE=garry;27346448]gwen[/QUOTE] After all this time.. The player na[i][b]mm[/b][/i]e hasn't been changed :(
[QUOTE=Jack Trades;27335813]What's up with layla? It's not the first time he's rating me dumb for posting in here. Is he retarded or something?[/QUOTE] Why worry? the guy/girl is a tit anyway, cool design btw how far are you from actually implementing it and have you decided what engine?
Where did the thread with the Facepunch API go?
[QUOTE=sLysdal;27349449]Where did the thread with the Facepunch API go?[/QUOTE] PM'd the link of the forum to you. Not sure if we're supposed to mention it, because it's hidden for a reason.
it's over, gcc, I want my life back [img]http://i.cubeupload.com/2LEYah.png[/img]
[QUOTE=graymic;27348051]Why worry? the guy/girl is a tit anyway, cool design btw how far are you from actually implementing it and have you decided what engine?[/QUOTE] [media]http://www.youtube.com/watch?v=-28aExCW9co[/media]
I found a bug in the irrlicht collada reader (.dae) [url]http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=42581[/url]
in C#, how would I look up the type of a class and create a new instance based on it? I mean I don't know what I'm doing here but I just called some functions that sounded relevant and it seems to perform as I want it to. It even copies derived classes correctly without having to overload anything. [code]class Organic { public virtual Organic Multiply() { Type type = this.GetType(); Organic copy = type.Assembly.CreateInstance(type.FullName) as Organic; return copy; } }[/code] Am I doing something stupid? Is there a preferred/better way to do this? I don't know what the fuck assemblies are
Hey, Don't you hate when something works under the debugger but not without it? Even worse, this is in C#, in release mode - the only difference is whether I start with debugging or start without debugging. :bang:
[QUOTE=ThePuska;27349859]in C#, how would I look up the type of a class and create a new instance based on it? I mean I don't know what I'm doing here but I just called some functions that sounded relevant and it seems to perform as I want it to. It even copies derived classes correctly without having to overload anything. [code]class Organic { public virtual Organic Multiply() { Type type = this.GetType(); Organic copy = type.Assembly.CreateInstance(type.FullName) as Organic; return copy; } }[/code] Am I doing something stupid? Is there a preferred/better way to do this? I don't know what the fuck assemblies are[/QUOTE] Usually if you want a class that's not specified at compile time, you'd have an interface or abstract class it implements or inherits from, so that when you call a method, you're guaranteed certain methods. At least that's how I'd do it. I haven't dealt with that type of reflection in C#, but I've touched on it with Java just a little, so I don't know the exact C# method of doing it.
[QUOTE=limitofinf;27350498]Hey, Don't you hate when something works under the debugger but not without it? Even worse, this is in C#, in release mode - the only difference is whether I start with debugging or start without debugging. :bang:[/QUOTE] Changed any project settings?, you prob only applied them to the debug project profile
[QUOTE=limitofinf;27350498]Hey, Don't you hate when something works under the debugger but not without it? Even worse, this is in C#, in release mode - the only difference is whether I start with debugging or start without debugging. :bang:[/QUOTE] It's worse if it works in release, but not in debug.
Hey, The funny thing is that I'm only using the release profile at the moment, so there aren't any project config issues; the only difference is whether I hit "start with debugging" or "start without debugging" :bang:
I don't know shit, just throwing this out there: Could it be some weird race conditions? Maybe it works when debugging because the game is slowed down by the time it takes to track all calls and stuff so the race condition is never met?
[QUOTE=robmaister12;27350609]Usually if you want a class that's not specified at compile time, you'd have an interface or abstract class it implements or inherits from, so that when you call a method, you're guaranteed certain methods. At least that's how I'd do it. I haven't dealt with that type of reflection in C#, but I've touched on it with Java just a little, so I don't know the exact C# method of doing it.[/QUOTE] I could have a virtual/abstract method Multiply() and just override it for all classes that inherit the base class, ensuring manually that it's always creating a correct instance. [code]class Bug : Organic { public override Organic Multiply() { return (Organic)(new Bug()); } }[/code] But it seems to me that there should be a better way to do this - I mean if it's know which class a specific instance implements (like the "is" and "as" keywords and the GetType() method suggest) then it should be simple to create more instances of the same class.
Hey, Your proposed clone() or multiply() method becomes a lot more useful when creating a subclass requires constructor arguments. If there are no constructor arguments, then doing it the way you're already doing it probably makes more sense.
using XNA, how would I get something to rotate round a point? 2D
[QUOTE=limitofinf;27350733]Hey, The funny thing is that I'm only using the release profile at the moment, so there aren't any project config issues; the only difference is whether I hit "start with debugging" or "start without debugging" :bang:[/QUOTE] Debugging issues like that are normally, in c++ for me, things like initialised pointers and doing stupid things with memory. When you run the debugger, it does lots of annoying things that can make it harder to spot certain bugs in your code
[QUOTE=Loli;27351385]using XNA, how would I get something to rotate round a point?[/QUOTE] In the draw method [url]http://msdn.microsoft.com/en-us/library/ff433988.aspx[/url] There is a parameter origin, this is the vector that your spinning around. It is however in relevance to the top left of the image [img]http://img262.imageshack.us/img262/5994/untitlebd.png[/img] Ofcourse you can make the position a dynamic one like in my game where for the night effect i draw a white image in the shape of the torch light and i spin it so it corresponds to the direction and rotation as the player BTW the position parameter is now the origin, so your image will be the draw position + the origin vector
[QUOTE=ThePuska;27349859]in C#, how would I look up the type of a class and create a new instance based on it? I mean I don't know what I'm doing here but I just called some functions that sounded relevant and it seems to perform as I want it to. It even copies derived classes correctly without having to overload anything. [code]class Organic { public virtual Organic Multiply() { Type type = this.GetType(); Organic copy = type.Assembly.CreateInstance(type.FullName) as Organic; return copy; } }[/code] Am I doing something stupid? Is there a preferred/better way to do this? I don't know what the fuck assemblies are[/QUOTE] return this.GetType().GetConstructor(new Type[0]).Invoke(new Object[0]); looks a bit better, though I can't say if this is a proper solution either; I'm not much of a C# programmer. Though that returns a new instance of the same type, not clone it. If you want to clone it, you can use MemberwiseClone for a shallow copy or implement your own deep copy algorithm.
I understand that, but I need to update collisions too.
[QUOTE=Icedshot;27351393]Debugging issues like that are normally, in c++ for me, things like initialised pointers and doing stupid things with memory. When you run the debugger, it does lots of annoying things that can make it harder to spot certain bugs in your code[/QUOTE] Hey, Yes, in C++, issues that disappear in debug mode are almost always uninitialized pointers and/or other variables which get set to a sane value in debug mode. However, this is in C#, which is [i]really[/i] weird :v:
[QUOTE=Loli;27351540]I understand that, but I need to update collisions too.[/QUOTE] Wel, what method of collisions are you using?
[QUOTE=ZeekyHBomb;27351535]return this.GetType().GetConstructor(new Type[0]).Invoke(new Object[0]); looks a bit better, though I can't say if this is a proper solution either; I'm not much of a C# programmer. Though that returns a new instance of the same type, not clone it. If you want to clone it, you can use MemberwiseClone for a shallow copy or implement your own deep copy algorithm.[/QUOTE] The type and object arrays are used for finding the right constructor and supplying it with the desired arguments? That's great, thanks!
Progress on my interpreted language. [img]http://anyhub.net/file/1rvE-ml.png[/img] The mismatch between ":=" and "=" to assign values is because ":=" sets a constant and "=" sets a variable. Here I've made a Point "table", and showing operator overriding. [editline]11th January 2011[/editline] Every second line in the console is the output.
[QUOTE=Richy19;27351602]Wel, what method of collisions are you using?[/QUOTE] Rectangle, I was thinking of creating a matrix and rotating that way...
[QUOTE=Overv;27350687]It's worse if it works in release, but not in debug.[/QUOTE] Why would you say that? If the problem exists when you are debugging, then you can use the debugger to solve the problem. If it only exists in Release, then how to you supposed to use the debugger to your advantage?
Sorry, you need to Log In to post a reply to this thread.