• Advertisement

nomichi

Member
  • Content count

    156
  • Joined

  • Last visited

Community Reputation

211 Neutral

About nomichi

  • Rank
    Member
  1. pixel in line of sight?

    Well my implementation will be in 3d using an orthographic projection. I should of mentioned that, now I feel kind of bad. I'm not sure if any of that 2d stuff will translate to 3d or not. I started trying to implement this in the source engine but I think the mod access may be too limited. Here is a vid of my hacky attempt. I was trying to draw black polygons over locations out of line of sight. It's a bit glitchy and it was using a lot of tracing so probably not the best way to do it. Thank you very much for your reply. If you have any ideas about doing this in 3d let me know.
  2. I wasn't sure what to title this. From a top down isometric style view is it possible to determine if a pixel is in line of sight of a character occupying the center of the screen. If so is it possible to not render pixels (or render them black) that are not in this line of sight. Alternatively, could there be a light at the players origin that anything the light does not reach would not be rendered. Still having other lighting affect the level but the areas the "line of sight" light does not touch would be black. Hope that makes some sense. Maybe I'll draw up a diagram of what I mean. I'm just trying to come up with some ideas to solve this as I'm still relatively new to graphics programming. I'm sure it's possible but I'm having trouble implementing it. Hopefully there's a free game or graphics engine I can use.
  3. [C++] string display problem...kinda [SOLVED]

    Quote:Original post by Koolchamp It compiles now but I still get his warning: \main.cpp(19) : warning C4309: '=' : truncation of constant value Also when I run the program a box comes up and says: Debug Assertion Failed! Program: ... File: .\xstring Line: 1508 Expression: string subscript out of range For information....(continues on) So...I think I'm still stuck. I think that is because you created a string variable without initializing it to anything and then tried to access/change an element that wasn't valid. Would probably work fine if you do this first: string s_variable2 = s_variable; and then do your for loop.
  4. [C++] string display problem...kinda [SOLVED]

    How about this? s_variable2 = string(s_variable.size(), '_'); if you use phrases you will need to check for spaces and add those. for ( int i = 0; i < s_variable.size(); i++ ) { if ( s_variable[i] == ' ') s_variable2[i] = ' '; } HTH
  5. OpenSVN

    great, thanks again OT!
  6. OpenSVN

    thanks. when I check out do I check out everything and it will only get things that are changed or does it have to copy/overwrite everything? Do I just check out single files?
  7. OpenSVN

    I'm looking into learning to use subversion. I found this site https://opensvn.csie.org/ which has free svn hosting so I am trying to set up on there. I made a project but I'm unsure what to do next. I have downloaded TortoiseSVN and installed and am picking through the help files but I'm a little confused. How do I move my files to the server? If anyone can lend a hand that would be great.
  8. points on same plane?

    yea I think that's what I was looking for. I was just stating what I was trying to do. I meant to give thanks. Just a bit tired, too much programming and lack of sleep. Off to bed for me. Thanks guys.
  9. points on same plane?

    i have a point on a plane ( a wall ). I'm trying to test if another point is on that same wall from a traceline im doing.
  10. points on same plane?

    How can I test if 2 points lie in the same plane in 3d?
  11. I'm working on an isometric style mod for half-life 2. I'm trying to implement a line of sight system similar to how they did it in the game Nox. I'm working in 3d with an orthographic projection to simulate the 2d isometric view. Does anyone know a good method of creating the shadowed areas?
  12. I have a orthographic projection(I think that's what it's called). I'm trying to simulate isometric 2d game view in 3d. I have the view but I can't seem to figure out how to convert my mouse coordinate to the world coordinate on the floor plane. I've tried to do ray picking and while that works fine if my view is changed to a perspective instead of ortho, it won't work for ortho. I may not even have access to things I need since this is a mod of half-life 2 but here is what I have set up: In the engine you just specify if the camera is orthographic and a size for the plane. My orthographic plane is 1024x1024(I just sorta chose this at random, I dunno if the dimensions need to be a certain way). The view is rotated left 45deg and pitched down 30deg(I think this is correct for isometric). I can access a worldToScreen matrix but I can't seem to invert it with the engine function(the inverted matrix is just zeroes). This may be an engine bug with orthographic? I also can access a worldToView matrix but I don't think I can access a projection matrix. Is there a way I can find what this would be based on my above settings? I assume I am gonna need the projection matrix. Anyway, I've tried various things to convert the mouse coords but I really don't know what I'm doing and just trying things. Sorry if all of this sounds noobish. I'm still getting the hang of all this 3d stuff. here is a pic of how it looks. If anyone could help me find a solution that would be great. Thanks for reading. [edit: added a pic]
  13. TICPP: ch15 ex 33.

    Thanks EC. That worked nicely and I found the double. I guess I only found the ints because they were less than 255. [smile] I guess I was supposed to do things more how Zahlman was saying so I gave it a shot the "C++ way". [smile] I don't think this book has covered much of reinterpret_cast yet. I think it was mentioned but that's about it. I'm not sure if std::fill or std::copy were covered but I remembered memcpy so I used that and I wasn't sure if I needed ZeroMemory but I did that just to be safe. Anyway, here is what I have now. Does this look about right? [edit: Oh and thanks Zahlman too!] #include <iostream> using namespace std; #include <Windows.h> #include <algorithm> #include <iomanip> class MyClass { int i; int j; double d; public: MyClass(const int& ii, const int& jj, const double& dd) : i(ii), j(jj), d(dd) {} virtual int f() const { return i;} virtual int g() const { return j;} virtual double h() const { return d; } }; class NoDouble { int i; int j; public: NoDouble( const int& ii, const int& jj ) : i(ii), j(jj) {} virtual int f() const { return i; } virtual int g() const { return j; } }; int main() { // Caveman way? =) MyClass m(10, 15, 10.10); size_t sz = sizeof(m); unsigned char* data = new unsigned char[sz]; ZeroMemory(data, sz ); memcpy(data, &m, sz ); cout << "\nFunction Test:\n" << endl; cout << "Calling f(): " << ((MyClass*)data)->f() << endl; cout << "Calling g(): " << ((MyClass*)data)->g() << endl; cout << "Calling h(): " << ((MyClass*)data)->h() << endl; cout << "\nSearching:\n" << endl; for ( int i = 0; i < sz; i++ ) { if ( *(int*)(data + i) == 10 || *(int*)(data + i) == 15 ) { cout << "Found: " << *(int*)(data + i) << " at (data + " << i << ")" << endl; } else if ( *(double*)(data + i) == 10.10 ) { cout << "Found: " << *(double*)(data + i) << " at (data + " << i << ")" << endl; } } delete data; // Shiny C++ way? NoDouble no(333, 1020); sz = sizeof(no); const unsigned char* const cp = reinterpret_cast<unsigned char*>(&no); data = new unsigned char[sz]; std::fill(data, data + sz, 0); // ok i dont need to do this but it's practice using fill :) std::copy(cp, cp + sz, data); // more practice... // make the hex output look better cout.setf(ios::hex | ios::uppercase); cout << "\nHex Dump:\n" << endl; for ( int i = 0; i < sz; i++ ) { // I think Zahlman was saying to use the cp, not a copy? cout << "cp + " << dec << i << " = " << hex << std::setw(2) << std::setfill('0') << static_cast<int>(*(cp + i)) << endl; } cout << endl; delete data; return 0; }
  14. TICPP: ch15 ex 33.

    Thanks Zahlman. I hadn't touched this book for about a month and just recently had time to come back to it. I played around for a while and this is what I've come up with so far. #include <iostream> using namespace std; #include <Windows.h> class MyClass { int i; int j; double d; public: MyClass(const int& ii, const int& jj, const double& dd) : i(ii), j(jj), d(dd) {} virtual int f() const { return i;} virtual int g() const { return j;} virtual double h() const { return d; } }; int main() { MyClass m(10, 15, 10.10); size_t sz = sizeof(m); unsigned char* data = new unsigned char[sz]; ZeroMemory(data, sz ); memcpy(data, &m, sz ); cout << "Testing:\n" << endl; cout << "Calling f(): " << ((MyClass*)data)->f() << endl; cout << "Calling g(): " << ((MyClass*)data)->g() << endl; cout << "Calling h(): " << ((MyClass*)data)->h() << endl; cout << "\nvPtr at [0]?" << endl; cout << "i at [8]: " << (int)data[8] << endl; cout << "j at [12]: " << ((int)data[12]) << endl; cout << "d at [?]: " << (double)data[16] << endl; cout << "\nSearching:" << endl; for ( int i = 0; i < sz; i++ ) { cout << "data[" << i << "] = " << (double)data[i] << endl; } delete data; return 0; } I can't seem to find the double in there and I don't really understand why the size of MyClass is 24. I guess it's padding like you mentioned. I'm assuming the vPtr is at data[0] and the double should be at data[16]. So where is the double hiding? [help]
  15. TICPP: ch15 ex 33.

    Well I've come across another exercise that I'm not quite sure how to handle. Quote:Create a class with data members and virtual functions. Write a function that looks at the memory in an object of your class and prints out the various pieces of it. To do this you will need to experiment and iteratively discover where the VPTR is located in the object. I'm not sure how to make the function is requires. Any hints would be appreciated.
  • Advertisement