So I originally had my data processing function as part of my StockInfo class;
[code]
size_t [B]StockInfo::WriteData[/B](void *buffer, size_t size, size_t nmemb, void *userp) {
...
}
StockInfo::StockInfo() {
curl_global_init(CURL_GLOBAL_ALL);
curl= curl_easy_init();
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, [B]&StockInfo::WriteData[/B]);
[/code]
But it only would run one time before saying this;
[code]
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
[/code]
So, on a hunch, I took the function out of the class like so;
[code]
size_t [B]WriteData[/B](void *buffer, size_t size, size_t nmemb, void *userp) {
...
}
StockInfo::StockInfo() {
curl_global_init(CURL_GLOBAL_ALL);
curl= curl_easy_init();
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, [B]WriteData[/B]);
[/code]
And now it works. Of course I don't need to have it in the class, but I'd like to know exactly what was going on before just moving ahead blindly.
[QUOTE=ryandaniels;19879649]
And now it works. Of course I don't need to have it in the class, but I'd like to know exactly what was going on before just moving ahead blindly.[/QUOTE]
Class functions have a hidden classType *this parameter so they are not interchangeable with free functions. You can't call a member function stand-alone, you need an object to call it on - therefore, you can't pass a member function to curl as it expects a free function.
[QUOTE=nullsquared;19879899]Class functions have a hidden classType *this parameter so they are not interchangeable with free functions. You can't call a member function stand-alone, you need an object to call it on - therefore, you can't pass a member function to curl as it expects a free function.[/QUOTE]
That makes sense
[QUOTE=nullsquared;19879161]Just FYI your compiler will almost always ignore the inline keyword, it will inline (or not inline) whatever it feels like if it thinks that doing so will bring higher performance.[/QUOTE]
Also note that if you've done your profiling work and are really 100% sure you're correct, you can force inline the following ways:
On GCC: __attribute__((always_inline)) [b]void foo()[/b];
On MSVC: __forceinline [b]void foo()[/b];
Assuming, of course, that inlining your function is actually possible.
Hmm, thinking how to make my hook class asynchronous as that would complete it.
What I mean is that current if you try to remove the hook inside of the callback then it will error because the return code is gone. So I need to figure out the best way to have delete signal the delete when it is safe.
Would be very easy if I didn't have to worry about multiple calls to it at once. Meaning even though it might be safe for 1 thread there might be other threads still executing inside of it.
Also have to account for recursion because the hook can be triggered from calling a function inside of the callback.
[QUOTE=nullsquared;19871058]Oh yeah that was purely an AO render, nothing else.
Here's a shot with everything, but much less AO samples because of the reflections and what-not:
*IMG*
(I know there's problems with the texturing)[/QUOTE]
You inspired me to implement a little code to get that fancy checker board :D
(My first approach would be to use modulo on the hitpos coordinates?
[QUOTE=s0ul0r;19882388]You inspired me to implement a little code to get that fancy checker board :D
(My first approach would be to use modulo on the hitpos coordinates?[/QUOTE]
Yeah you could round the positions and check for odd/even tiles
:v:
First test:
[IMG]http://img204.imageshack.us/img204/2302/fuckingrender.png[/IMG]
[editline]10:21PM[/editline]
Done :>
[IMG]http://img638.imageshack.us/img638/2302/fuckingrender.png[/IMG]
[QUOTE=nullsquared;19879631]That's awesome :D Never thought of using BFS like that :v:
Couple of questions:
- what version of SMB is that, any link?
- how do you keep the state of the game so you can go back and try a different path when there is no solution on the current path? Or do you just spawn a different instance of the game for every path?
That's really cool, I'm curious how you did it (the stuff other than the actual BFS algorithm, that is).[/QUOTE]
The version is just plain ole "Super Mario Bros. (E).nes" the search is done by a Lua file I haven't released yet.
I'm inserting savestates into a MinHeap. The MinHeap is efficient although every save state takes up about 64kb of memory (or so I'm guessing, since there is 0x0 through 0xFFFF bytes of RAM) and there is constant loading and saving, which takes time.
Holy fuck, somethings seriously wrong, this took 15 mins to render, with 1024 ao samples oO
[IMG]http://img141.imageshack.us/img141/2302/fuckingrender.png[/IMG]
[QUOTE=garry;19876463]You really shouldn't be pushing the player back. That's asking for trouble.
The movement code should be like Can we move to this new position?
Yes. Put the player there
No. Don't move. (Or more commonly, trace along that direction and move as far as we can move)
[editline]12:50PM[/editline]
Also, your collision code is pretty weird. Here's an example of how to do it nicely.
[cpp] inline bool RectIntersectRect( const Rect& r1, const Rect& r2 )
{
if ( r1.x1 > r2.x2 ) return false;
if ( r1.x2 < r2.x1 ) return false;
if ( r1.y1 > r2.y2 ) return false;
if ( r1.y2 < r2.y1 ) return false;
return true;
}[/cpp][/QUOTE]
Ah, so that's what I was doing wrong. Thank you so much Garry!
I should probably clean my code too. I need to organize everything in classes.
[editline]05:33PM[/editline]
[media]http://www.youtube.com/watch?v=camX7B_uAhs[/media]
Changelog:
- v3:
-- 5 more boxes added
-- Collisions (though a few bugs)
- v2:
-- Health bar
-- 5 different boxes that you can spawn
-- Added animation for moving up and down
-- Fixed being able to glitch up the animations when holding A and D at the same time (left and right keys)
- v1:
-- First beta with working sprite drawing, movement, and boundaries.
The problem is, when I go under or over the box, he gets pushed to the right probably due to the fact he's intersecting with the X axis.
Messing with OpenGL and heightmaps right now. I'm using Java Monkey Engine, which is basically the equivalent of Ogre in Java. This is pretty basic, given that I'm using a 3D engine, but it's still a fun way to learn.
[IMG]http://imgkk.com/i/Tuaoo1.png[/IMG]
[QUOTE=quincy18;19877926]What happens when you put inline before your function ?[/QUOTE]
See you should have read the links I posted.
That post was a huge waste of time then, I guess...
I have another question - I'm trying to save myself from space and tried to do a for loop to create variables, but I'm having trouble.
Lets say I want to create 5 things of something:
[cpp]
for(i = 1; i <= 10; i++){
int item + i = i; // *
}
[/cpp]
* = How would I create an int variable with a name and by adding another variable to the variable name?
Hope I'm making sense.
[QUOTE=The Inzuki;19886956]
* = How would I create an int variable with a name and by adding another variable to the variable name?[/QUOTE]
You can't in C and C++. You want an array.
[cpp]
int myvars[5];
for(int i = 0; i < 5; i++)
{
myvars[i] = i * i;
std::cout << "myvar #" << i+1 << " = " << myvars[i] << std::endl;
}
[/cpp]
[QUOTE=Lt_Captain;19883398]The version is just plain ole "Super Mario Bros. (E).nes" the search is done by a Lua file I haven't released yet.
I'm inserting savestates into a MinHeap. The MinHeap is efficient although every save state takes up about 64kb of memory (or so I'm guessing, since there is 0x0 through 0xFFFF bytes of RAM) and there is constant loading and saving, which takes time.[/QUOTE]
Oh cool so essentially every step you create a save state and use that for the BFS, interesting. What emulator do you use? I'm interested in how you're detecting the win condition and death conditions, as well as how you interface with the emulator for the loading/saving (unless you're not using an external emulator?)... of course, if you're willing to share the information, if not, oh well :smile:
[editline]08:16PM[/editline]
[QUOTE=s0ul0r;19884566]Holy fuck, somethings seriously wrong, this took 15 mins to render, with 1024 ao samples oO
[IMG]http://img141.imageshack.us/img141/2302/fuckingrender.png[/IMG][/QUOTE]
Well you have lots of reflections and lots of spheres, much more than my simple 2 sphere 1 plane (:v:) scene.
Non-reflective spheres are easier to calculate than other shapes though?
Thank you jA_cOp :D
Also!:
[media]http://www.youtube.com/watch?v=Q7eojK-pUZk[/media]
Changelog:
- v4
-- Fixed collisions
- v3:
-- 5 more boxes added
-- Collisions (though a few bugs)
- v2:
-- Health bar
-- 5 different boxes that you can spawn
-- Added animation for moving up and down
-- Fixed being able to glitch up the animations when holding A and D at the same time (left and right keys)
- v1:
-- First beta with working sprite drawing, movement, and boundaries
Going to have to add AI sometime soon :v:
My friend told me to use vectors, should I?
[QUOTE=nullsquared;19887842]
Well you have lots of reflections and lots of spheres, much more than my simple 2 sphere 1 plane (:v:) scene.[/QUOTE]
LIAR!
:v:
[QUOTE=turby;19888007]Non-reflective spheres are easier to calculate than other shapes though?[/QUOTE]
Um yup? Not sure if you're asking a question or just stating that.
[editline]08:57PM[/editline]
[QUOTE=The Inzuki;19888075]Thank you jA_cOp :D
Also!:
[media]http://www.youtube.com/watch?v=Q7eojK-pUZk[/media]
Changelog:
- v4
-- Fixed collisions
- v3:
-- 5 more boxes added
-- Collisions (though a few bugs)
- v2:
-- Health bar
-- 5 different boxes that you can spawn
-- Added animation for moving up and down
-- Fixed being able to glitch up the animations when holding A and D at the same time (left and right keys)
- v1:
-- First beta with working sprite drawing, movement, and boundaries
Going to have to add AI sometime soon :v:
My friend told me to use vectors, should I?[/QUOTE]
Cool :smile: And yeah use vectors, they make a lot of vector math operations simpler.
[QUOTE=The Inzuki;19888075]
My friend told me to use vectors, should I?[/QUOTE]
Yeah, I'm sorry you shouldn't really use raw C-style arrays in C++ for anything, the STL containers and boost containers (like boost::array and the hash tables) replace them pretty much everywhere.
It's still a good idea to learn about arrays though, they're pretty basic to both C and C++, and you'll want to know them if you ever get deeper into pointers.
edit:
I assumed you were talking about std::vector :v:
Working on a school project. Have to get it done in the next three weeks, school sending us to GDC.
Any idea how would I go about making gravity using XNA and C#?
I'm kind of new to this.. (2D game, if that matters in any way)
[QUOTE=iNova;19892692]Any idea how would I go about making gravity using XNA and C#?
I'm kind of new to this.. (2D game, if that matters in any way)[/QUOTE]
Never used XNA for personal development (just editing the source of Infiniminer for my own personal glee), but I would say it would go along the lines of a typical position/velocity/acceleration system.
Position += Velocity * TimeElapsed;
Velocity += Acceleration * TimeElapsed;
And acceleration would default to whatever your gravity value would be, 9.81 if you were going for a system relating to reality.
That would always be my first guess on an approach to implementing fundamental physics.
I've been working on a quick little mod for GTA IV that allows the player to drive trains.
[media]http://www.youtube.com/watch?v=6FHBeZJQzZ8[/media]
If anyone's interested, I'll post a download.
I hate when people be douchebags and don't just post a download link with the showing off crap instead of asking if anybody wants it then posting a download 10 hours later.
[highlight](User was banned for this post ("Ass" - garry))[/highlight]
[QUOTE=Eleventeen;19893329]I hate when people be douchebags and don't just post a download link with the showing off crap instead of asking if anybody wants it then posting a download 10 hours later.[/QUOTE]
The main reason I haven't posted the download is because there are quite a few steps to installing this mod's dependencies.
You need GTA IV 1.0.2 (tested on 1.0.2, other versions [b]may[/b] work), an ASI loader, and the latest ScriptHook.net
[QUOTE=turby;19893356]The main reason I haven't posted the download is because there are quite a few steps to installing this mod's dependencies.
You need GTA IV 1.0.2 (tested on 1.0.2, other versions [b]may[/b] work), an ASI loader, and the latest ScriptHook.net[/QUOTE]
Oh, my apologies then.
Okay, so I got the basic raytracing working...it's annoying as hell, i'll tell you that much..Thanks for that link guys. Was a good read, and it's actually very annoying to do doom clones haha.
You might think this is a repost but it's not.
I've totally rebuilt the 2D engine.
I'm using tilemap for the texturing and mapping.
The map can be edited by a map.txt file.
The next step is to add some collision to the world so I can add a character
[IMG]http://img715.imageshack.us/img715/194/tilemapown2.png[/IMG]
Sorry, you need to Log In to post a reply to this thread.