Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

142 Neutral

About gimp

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks for the answers guys. On first inspection I found the answers sort of off the topic I was asking for which was more around message routing \ handling. I'm sort of half inventing my own RPC type of system. On looking over the last two reply's however I found that the Enet option is kind of appealing. Initially I discarded this answer based on the fact that this is UDP. They however coded a reliability layer on top of TCP that handles streams. The reason streams are interesting is that for a message based architecture each request and response, or 'transaction' under Enet is handled in what they call channels. Each channel controls a steam of data back and forth of course all this is, is probably an int buried in the packet to represent the channel number. I has a look at ASIO and could not for the life of me work out what it was all about. It didnt look like a generic networking library, it didnt look like a network ostream... I don;t know what it is. I'm sure it's cool, but for my project I just HAVE to know whats going on in order to use it. Many thanks to all!
  2. Looks like I'm a silly boy. Somewhere along the line I got the idea that + didn;t work with strings. I guess I was trying on concatinate different string types. Many thanks all. You are all right of course... I probably shouldn't be concerned about the speed of my logging during system startup :)
  3. A few years ago I messed around with a few memory managers, tried some other, most of them just use the old overload new\malloc operator trick and dump a load of rubbish on exit that you're somehow meant to work out. Most of the libraries I tried also seemed to break my game or increate the number of faults though. I tried the VS2005(team only?) memory leak detection routine, but couldn't seem to work out how to get it to help me pinpoint the leak, it just gave me a list fo leaks and an ugly memory dump. Then, today I found this: Very nice. Has integration with Visual Studio, shows you the allocation call stack so you can see how the leak occured. Compiles to nothing in release mode. I found 4 previously unknown leaks today in code that I thought bullet proof (My Log and Factory Classes) so I'm quite happy =) The other reason I don't like tools like this is the integration work. This lib in contrast required me to insert one single include and link against his lib. Thats it. I'm hooked. For me this a keeper... Hope this helps someone...
  4. Maaaany years ago I learnt VB, before c++ in fact. On thing VB does far better than C++ and light years ahead of C is make strings easy to use. In VB I concatenate multiple values together to form a string. I may not have looked hard enough but I never did find a nice way of writing something would look like this: std::string Output = "ERROR [" + Type + "] : " + Message + CRLF; Where Type and Message are std::string's and CRLF is a const char*. Is there a way of doing this that I'm not aware of without creating my own string class and overloading + operator? From what I understand as well the + operator would make a copy of the string from right to left, making the whole process a fair bit slower(Not that I often do this with speed in mind but I'd have to consider it. Right now I do something like this: std::string Output("ERROR ["); Output += Type Output += "] : "; Output += Message; Output += CRLF; Is there a much better way?
  5. I thought of that. Using a map however requires me to manage the unique index myself. If I use and iterator pointing at a container the iterator is unique(4 bytes) and points at something that wont be invalid, when neighbours become deleted\inserted. Any takers? Any thoughts on the general design?
  6. ... and don;t forget that you can do a simple early out test by storing bounding circles in 2D (I do spheres in 3d) so that you only need to check the objects point against the area's bounding circle, if the distance is greater than the circle radius then you know you have popped out of the area without doing the edge tests. HINT, you would be best served by generating the circle on object creation(or when it changes size). Likewise with the area. Using this method you can also detect when an object is straddling the edge. If I recall David Eberly wrote some generic code at magic software that generated bounding circles when you start with an array of points. The algo is easy though. you normalise the centre as you iterate of the array keeping the centre focused on maximum distance of the furthermost couple of point, from memory(4 years ago) they are called the supporting points. It's easier to just copy that code though ;) HTH
  7. I'm building my messaging infrastructure. I want to post messages to the server, have it 'do something' then respond with an ack or data that might be relevant. I plan to send a message over the network, wait for a response then when I get it back be able to relate the response to the original request. The original requestor class is then called back in order to get the data. This seems to be awfully close to what I would expect to be a design pattern. Does one exist or is there a batter way to do this? Second minor question, should I use a std::list to store the Requestor callbacks and use the iterator in the network request, so that when I get the response I can relate it back to the original request(or)? I'm pretty sure I can do delete's from within a list and iterators remain valid unlike a vector. Thoughts and comments are welcome as once I implement this I think it'll be pretty embedded and unlikely to change going forwards... Thanks Guys...
  8. I'm sure this problem is about as simple as it comes. I have an old hunk of code that was sloppily coded. Because I have never known how to define a simple function in a namespace as a template rather than as a class I left it as a Class. Which of course means I have to create this class, which holds nothing just to access the functions. Cleaning this up I can't seem to get the header \ inline syntax correct My attempt looks like this so far: #bit.h (A lot of irrelevant stuff snipped) namespace Bit { template <typename T> void Set(T& a_Memory, const T a_Bit); template <typename T> void Flip(T& a_Memory, const T a_Bit); template <typename T> void Clear(T& a_Memory, const T a_Bit); template <typename T> bool Test(const T a_Memory, const T a_Bit); }; #include "Bit.inl" #bit.inl template <class T> inline void Bit<T>::Set(T& a_Memory, const T a_Bit) { a_Memory |= a_Bit; } NOTE : The .inl file is just included in to the .h so that I can seperate the definition\implmentation I think I'm on the right track in the .h, but the syntax in the .inl file is still based on the old class code. I just can't work out how it should be defined. Oh, and yes I've tried looking though the help files, everything I've found refer's to classes. Is this even possible?
  9. Thanks a lot guys. You've given me something to work on. I'd never have come up with a wastful storage structure that stores all types, so thanks for that. Given the fact that this is just returned data I guess there isn't really that much overhead. The funny thing is I was looking at boost::variant earlier, trying to work out how I could use it to store the column containers, rather than using it to store the individual elements. I even looked at the serialiazation code that converted all values to string form, also as suggested. Being a silly optimist (as in one who optimises things during design) I probably cut off working solutions by limited thinking, so again thanks.
  10. I have to store some rows from a database out in to memory. The database will return, strings, floats and integers. I'd like to populate all these result in to a class and pass that class around. Any idea on how this can be done without me having to resort to storing void*'s and then using a enum to store what type it actually is? Many thanks, Chris
  11. I've noticed that I do the same thing often (Typo's aside, guessing the copde) std::string Error; Error += __File__ Error += __Line__ Error += __Function_ Error += "Message about error" throw std::runtime_error(Error); ... or something like that. I do this so I can get some context as to the location and scope of the error. Some might be caught and logged if they can be recovered from, others might abort the app. In both cases, I, as the programmer want some information about whats up rather than having to type our a good deal of text for every message to work it out. So far I had been building my scope like this: Error = "WMI : CoInitializeEx : A previous call to CoInitializeEx specified a different concurrency model for the calling thread, or the thread that called CoInitializeEx currently belongs to the neutral threaded apartment. "; Which is a lot more work. What kind of macro can I use to speed this up a bit? I'm pretty sure the macro is needed so that __FILE__ stuff ends up referencing the correct file. Do you guys use somethng similar?
  12. Does anyone have and links to document that describe the consideration you would have to make in deciding wether to use a web or binary based GUI as the front end in to a system. Simple answer is of course that the web platform can be agnostic of platform and doesn't require the distribution of a binary. Given that these constraints are not very important what advantages does a web based GUI offer over a binary. From my experience it's just sluggish performance. Thoughts?
  13. I have lots of code where I want to translate a bunch of strings in to internal literals. Because switch statements cannot handle strings I have two possible methods of handling strings. 1) I could build up an index that represents strings by a handle. Then compare handles. This is fast but a lot of work. 2) My current way below. This is easy to write, but slow and takes up a lot of code space. Is there any other \ better ways? if (String == "white") { a_Colour = WHITE; return; } if (String == "black") { a_Colour = BLACK; return; } if (String == "blue") { a_Colour = BLUE; return; } if (String == "green") { a_Colour = GREEN; return; } if (String == "grey") { a_Colour = GREY; return; }
  14. Champion. You helped me find and error in my date checking code. It was not closing a handle. I didn't even realise it was using create file.
  15. No. The app I'm writing is a small utility to control archival of files. When the fil reaches a certain age it's archived and pruned from the OS. The issue is that when I delete the files out of a directory I check afterwards to see if the directory is now empty and remove it if it is. The empty directory check always fails as the files don't seem to disappear until the process exist. All 3-400 of them delete concurrently. I've also double checked this in a command prompt. I've never seen anything like this before... and I'm sure I used to use that function to delete log files before creating a new one and it never caused me problems then...
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!