make Initialize return self
var c = new Class().Initialize();
[editline]16th January 2012[/editline]
or something to this effect:
[csharp]
public static class Utils
{
public static T Make<T>() where T : new()
{
dynamic o = new T();
o.Initialize();
return (T)o;
}
}
[/csharp]
[QUOTE=dije;34238913][img]http://dl.dropbox.com/u/41041550/Game/Game2%21.PNG[/img]
Trying to figure out how to draw a building, and also will try to make a new renderer that is based on tileX and tileY, not pixel coords[/QUOTE]
You're using Java, right?
[QUOTE=voodooattack;34235646]Wow, loving that sanity meter. I can't wait to play that already.
Are you using te4 or did you write everything from scratch though?[/QUOTE]
Thanks :) It's written with XNA
For raytracing, do you want the starting point of the ray to be the 'eye of the person' (aka in the center of the screen, behind it) or should I make the starting point on the screen and just give it a Z direction?
[QUOTE=neos300;34239582]For raytracing, do you want the starting point of the ray to be the 'eye of the person' (aka in the center of the screen, behind it) or should I make the starting point on the screen and just give it a Z direction?[/QUOTE]
starting point like an eye is a good start but the best way would be to implement a viewing frustum ([url]http://en.wikipedia.org/wiki/Viewing_frustum[/url]) takes a little bit of math but in the end it will pay out if you want to go further in your ray tracing project. as you can do some pretty easy culling to speed up the process.
This is from my raytracer I did a while ago in Java:
[IMG]http://www.binarybit.ch/imgs/ray.jpg[/IMG]
I just noticed that this isn't my final version where I even implemented caustic (with photon mapping)
[QUOTE=wingless;34239167]You're using Java, right?[/QUOTE]C# with XNA
I made a program that solves sliding puzzles. (these things [url]http://play-shot.ab-archive.net/graphics/screenshots/15_classic_slide_puzzle-18148.gif[/url])
It's not too fast but it solved one that needed 14 moves in less than a second so I'm pretty proud.
The thing is, input is horrible
1 7 2 3
5 6 11 4
9 12 - 8
13 10 14 15
and the output is non-exsistant. It solves the puzzle but I'm way to lazy to do the backtracing to get the actual solution.
I might go low tech and just store the current steps in every new Queue push.
Fury Monitor is pretty much finished.
[img]http://i.imgur.com/3m4KX.png[/img]
It shows the full sized image when you roll the mouse over it, checks every hour for a new shirt and will popup if there is one. Has a tray bar icon which lets you unhide, view the shirt and go to the site.
The code is up on [url=https://github.com/Weetbix/FuryMonitor]Github[/url]
[QUOTE=Darwin226;34240720]I made a program that solves sliding puzzles. (these things [url]http://play-shot.ab-archive.net/graphics/screenshots/15_classic_slide_puzzle-18148.gif[/url])
It's not too fast but it solved one that needed 14 moves in less than a second so I'm pretty proud.
The thing is, input is horrible
1 7 2 3
5 6 11 4
9 12 - 8
13 10 14 15
and the output is non-exsistant. It solves the puzzle but I'm way to lazy to do the backtracing to get the actual solution.
I might go low tech and just store the current steps in every new Queue push.[/QUOTE]
So I got it working.
The solution to the one I gave you is
Right Down Down Left Left Up Up Right Down Right Up Up Left Left
It's nothing flashy so most wont even notice is but if someone is interested in solving things with with algorithms please give me your opinion on the following:
The competition that I take place in yearly is about solving problems with algorithms. The solution I used to solve this puzzle is a simple breadth-first search. What bothers me is that the only advantage it has over other possible solutions (the ones not using BFS or similar search algorithms) is that it finds the solution that has the LEAST amount of moves.
Otherwise it's slow and worst of all IMPRACTICAL.
The competition would require me to write something like that and I hate it. If anyone remembers my previous rants about these things, the winners of the country wide competitions usually get noticed by large companies like Google and Facebook and can land great jobs but these people usually can't write a practical program to save their life.
I can bet that Google would prefer a fast and practical approximation over a precise but slow one.
As an another example, everyone knows what BFS, DFS or Djikstra's algorithm is but they've never heard of A*.
[QUOTE=dije;34237810]Is it okay if I use "some" of your code to make a project?
An early picture: [img]http://dl.dropbox.com/u/41041550/Game/Game%21.PNG[/img]
Basically, what I used was your way of storing "tiles".
[editline]16th January 2012[/editline]
The map is random[/QUOTE]
Of course!
thanks for making me feel special. :v:
Do any of you have experience with displaying videos in C#? I need to display streaming video for a certain project and I was wondering what I should use to do that. I can either feed it a raw byte stream or an URL, that's not a problem.
overv
[media]http://www.youtube.com/watch?v=kg-z8JfOIKw[/media]
Or you could just use WMP in winforms for it.
[QUOTE=C:\;34241444]overv
[media]http://www.youtube.com/watch?v=kg-z8JfOIKw[/media]
Or you could just use WMP in winforms for it.[/QUOTE]
Nah, it's not YouTube videos. It's AVI and MKV I want to play with support for all common formats.
error: template argument 1 is invalid
error: template argument 2 is invalid
std::vector<Light*> Lights;
C++ you so silly
On the topic of videos, does anyone have any docs on/libraries for encoding video?
[editline]16th January 2012[/editline]
in C#
[QUOTE=Overv;34241525]Nah, it's not YouTube videos. It's AVI and MKV I want to play with support for all common formats.[/QUOTE]
[QUOTE=supersnail11;34241746]On the topic of videos, does anyone have any docs on/libraries for encoding video?
[editline]16th January 2012[/editline]
in C#[/QUOTE]
You guys might like this...
[url]http://sourceforge.net/projects/directshownet/[/url]
[QUOTE=Socram;34237065]Got A* working on my rts-y thing.
[img]http://i5.photobucket.com/albums/y192/BobMa/before.png[/img]
[img]http://i5.photobucket.com/albums/y192/BobMa/after.png[/img][/QUOTE]
I'm no expert but this looks shorter:
[img]http://i.imgur.com/UShgP.png[/img]
[editline].[/editline]
Oh no imgur!
How far should I go in terms of lighting if I want semi real time raytracing?
[editline]16th January 2012[/editline]
And I screwed it up again.
I really wish I had uploaded this to version control.
[QUOTE=neos300;34241969]How far should I go in terms of lighting if I want semi real time raytracing?
[editline]16th January 2012[/editline]
And I screwed it up again.
I really wish I had uploaded this to version control.[/QUOTE]
compute all possible directions :v:
[QUOTE=jalb;34232448]I didn't understand integrals. So typical programmer fashion, I decided to program them:
[IMG]http://dl.dropbox.com/u/11093974/Junk/integrals1.png[/IMG]
[IMG]http://dl.dropbox.com/u/11093974/Junk/integrals2.png[/IMG][/QUOTE]
You're actually using the "trapezium method" There. That'll only give you an estimate.
To do it you need to.
1 > Intergrate (Add one to the power, divide by new power)
eg. [SUP]3[/SUP][SUB]1[/SUB]∫ x[B][SUP]2[/SUP][/B] + 3 dx becomes [x[SUP]3[/SUP]/3 + 3x]
2 > Sub in the bounding values
eg. x = 3... 9 + 9 = 18
x = 1... 1/3 + 3 = 3 1/3
3 > Take them away from each other
eg. 18-3 1/3 = 14 2/3
And that's the area bounded by the curve and the X axis when 1 <= x <= 4
Pointers do not like me today, for whatever reason.
My std::vectors seem to be getting randomly corrupted when I pass them around.
[QUOTE=neos300;34242357]Pointers do not like me today, for whatever reason.
My std::vectors seem to be getting randomly corrupted when I pass them around.[/QUOTE]
I think that's one of the main reasons I told C++ to get fucked... Pointers can be a bitch.
[QUOTE=Maurice;34241800]I'm no expert but this looks shorter:
[img]http://i.imgur.com/UShgP.png[/img][/QUOTE]
A* is designed so that depending on the heuristic you use, you can get longer paths that take much less time to find. I don't think that applies in this situation though, since a greedy algorithm would have found the shorter path anyway... It's a mystery.
Ha. Changing my containers to be std::vector<Sphere> (derived type) - no problem
std::vector<Shape> (the base type) NO FUCK YOU
Or anything else really, I've tried references, pointers, you name it.
[QUOTE=Socram;34237065]Got A* working on my rts-y thing.
[img]http://i5.photobucket.com/albums/y192/BobMa/after.png[/img][/QUOTE]
Hey that's a coincidence, I just made a path finder kind of based on A*, not nearly as fast though
(starts from bottom right, no diagonals)
[img]http://i.cubeupload.com/D7hLY4.png[/img]
While we are on the subject of pathfinders.........
[img]http://img713.imageshack.us/img713/3669/screenshot2012011612505.png[/img]
Red is visited, not the solution.
[QUOTE=neos300;34242525]Ha. Changing my containers to be std::vector<Sphere> (derived type) - no problem
std::vector<Shape> (the base type) NO FUCK YOU
Or anything else really, I've tried references, pointers, you name it.[/QUOTE]
If you store just a shape in your vector it won't work, you'll need to store a Shape*. Paste your code, it'll be something you're doing which is causing issues.
[QUOTE=neos300;34242585]While we are on the subject of pathfinders.........
[img]http://img713.imageshack.us/img713/3669/screenshot2012011612505.png[/img]
Red is visited, not the solution.[/QUOTE]
Interesting. I thought heuristics were bad for mazes.
[QUOTE=neos300;34242525]Ha. Changing my containers to be std::vector<Sphere> (derived type) - no problem
std::vector<Shape> (the base type) NO FUCK YOU
Or anything else really, I've tried references, pointers, you name it.[/QUOTE]
One does not simply, store references.
[QUOTE=neos300;34242357]Pointers do not like me today, for whatever reason.
My std::vectors seem to be getting randomly corrupted when I pass them around.[/QUOTE]
Make sure you're passing vectors either by reference or pointers. Preferably, pass objects around by reference unless it can be null.
[QUOTE=neos300;34242525]Ha. Changing my containers to be std::vector<Sphere> (derived type) - no problem
std::vector<Shape> (the base type) NO FUCK YOU
Or anything else really, I've tried references, pointers, you name it.[/QUOTE]
To use polymorphism with the standard template library (or anywhere in C++), they [b]must[/b] be either a reference or a pointer to the base type. I use pointers when dealing with STL containers like std::vector because then you own the object. You must also remember to delete them when you're finished, generally within the constructor.
Sorry, you need to Log In to post a reply to this thread.