MattEvans 473 Veteran Poster Team Colleague Featured Poster

If you're doing this for the purpose of input sanitizing, there are probably less 'safe' characters than there are 'unsafe' characters, create a new empty string ( string 2 ) loop over the input string ( string 1 ), one character at a time, if the character is in the range a-b, A-B, 0-9, then place it at the end of string 2, otherwise place the code of the character at the end of string 2. Simple as anything.

Don't bother trying to replace every special character ( especially if your sanitizing for a database or a shell script ) because you'll likely miss one, if you only allow the safe characters, the only risk is that you forget to allow something safe, and that's quite a bit better than forgetting to block something unsafe. Basically, it's always safer to whitelist than it is to blacklist.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ajax stands for asynchronous javascript and xml. Note that you set the onreadystatechange handler to that anonymous function, but you dont have any guarantee that that function will be executed immediately.. i.e. the request will go out, then the rest of the code in the function will execute, then at some undetermined point in the future, the code in the onreadystate handler will be executed, by then, the function that set the handler may have long since returned. If you really want synchronous ( in other words, the running of the function wont continue until the request is done ), change:

req.open("POST", "/includes/_process/getPortfolioCount.php", true);

to:

req.open("POST", "/includes/_process/getPortfolioCount.php", false);

But I've heard of support issues with this, so, if you can restructure slightly i.e. put the tail end of the function ( the part dependant on the state changing ) into the handler function, then do that instead.

Also, based on what I've just mentioned, it would be wise to call req.send(null); AFTER setting the readystatechange handler, since theres a non-zero chance that the request will be satisifed before the handler is actually assigned.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The differences aren't that complex. There's practically a 1-1 mapping between any ( solely ) XHTML document and an equivalent HTML document. Some of the potential XML-specific features won't be supported yet, but there's no harm in ( and it's certainly easier to ) write in the XML syntax.

All of the major browsers parse and render a document that is solely XHTML reasonably correctly; where reasonably implies that, where a browser falls down on rendering an XHTML form, it usally falls down on the equivalent HTML form. Syntactically, iIt's 'easy' to implement an XML representation if you already have a sufficiently general SGML parser, since XML syntax restrictions can be expressed in an SGML doctype; if you don't have a sufficiently general SGML parser, support can always be special-cased. Most of the browsers do one of these things. Opera and Firefox actually parse XHTML properly ( if requested to do so ), IE will just accept the syntax ( I don't know if they special-case it or not ).

Perhaps elaborate on what you mean by 'support', since it's a given that support isn't black-and-white. Your statement implies that browsers wont support any level of XHTML. Semantically, they support the level of XHTML which could be expressed at their supported level of HTML - at minimum - and sometimes more.

If speaking about pure HTML ( i.e. not considering the potential expandability afforded by mixing different XML languages in the same document ), the only noticable …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Yes, you can learn XHTML without learning HTML. You should probably learn the difference, though. With regards to the actual code, most XHTML is valid HTML, but somewhat less HTML is valid XHTML ( with some notable exceptions, i.e. a small number of HTML tags are forbidden to have a close tag, making the XHTML equivalent invalid HTML ). Other than that, there are a few differences with regard to the 'id'/'name' attributes, and XHTML is namespaced, and should be ( but rarely is ) transmitted with different content-type headers...

TBH, you'll be better off learning XHTML; the close tag rules for HTML make it somewhat difficult to write, and it's much more difficult to process automatically.

The core 'difference' is that XHTML is based on XML, and HTML is based on SGML. As it happens, XML is also based on SGML, but XML started off as a strict subset of SGML, and as such, has more neatly defined ( i.e. context-independant ) syntax rules.

XML is also a more general framework, you can mix XML languages in a single document, i.e. XML + XHTML + MathML + SVG ( all in the same file, without using external resources ), but popular browsers are only just starting to fall into line with regard to implementing these standards and others.

You can also ditch XHTML entirely and write 'pure XML' with CSS styling ( i.e. make up your own tags ), but that works in even fewer browsers.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Thank-you both, I read through that wikipedia article ( again =p ) and also this page from IBM http://www.ibm.com/developerworks/aix/library/au-endianc/index.html?ca=drs-, and I get it now. All I need to decide now is whether I want to force one endian-ness in the file format, or do something at the beginning of the file to indicate endian-ness. I can live with the 32-bit float assumption.. at least until I find an un-ignorable platform where there isn't a 32-bit floating point type...

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I'm aware of potential issues involved when directly writing struct values to binary, so I already break the objects into primitives, but the smallest primitive I can break down to is a float, I'm happy to do this, it makes a certain amount of sense in a context which is basically, a load of arrays of float and uint32_t, with only a very tiny amount of considered structure ( a 16 byte header for each group of arrays, which may be hundreds/thousands of elements long ). The data is certainly not easily human-readable/writeable, so I wouldn't gain that usual advantage of a text format, only the portability. In any other situation though, I'd certainly go for a text format.

All I really need is a ( somewhat ) platform independant way of storing individual floats in binary format, I say somewhat platform independant, since PC and Mac are the only targets I'm focusing on.

But, based on what you've said, I guess that the second piece of code I posted would work ( reading and writing each byte of each float one at a time using get/put, and always reconstructing in the same order ), as long as floats are 32-bit, and are represented in the same way at bit-level on the target platforms...

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Thanks for the info on storing things into the i/ostream directly, that could come in useful elsewhere :P, but, the reason I wanted to determine the open mode is to stop a method being inadvertently called with a stream in the wrong mode.. so, that won't work.. but I seem to get the same results in light testing when writing to a stream opened in 'the wrong mode' anyway.. hence my second question.

The endian-ness thing, I'm still not sure I get it... a more specific example of what I'm doing, writing 32-bit floats to and from binary files, I don't have access to a machine with a different endian-ness.. But, lets say I work on a PC, and I want my files to open in a Mac ( which is apparently reverse endianess to PC ).. [ I am happy to assume that floats are 32-bit on my targets.. and that they're represented the same... although, is that even a safe assumption on Windows, Mac, Linux? See I really don't want to have to resort to a dodgy handrolled file representation for non-integers, and using a text representation for floating point arrays never really appealled to me. ]

Anyway, assuming that the representation is the same.. if I do this:

int main( void )
{
  std::ofstream out( "test.bin", std::ios::binary | std::ios::out | std::ios::trunc );
  const float f1 = 123.456f;
  out.write( reinterpret_cast< const char * >( &f1 ), sizeof( float ) );
  out.close( );

  std::ifstream in( "test.bin", …
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Again, just because you can do something on one compiler doesn't mean that you should. See the output I posted when trying to compile your code with G++ 4.2.1. ( a very recent version ).

If I uncomment the line const int GamePlayer::NumTurns; , then the linker error goes away ( still with G++ ).

Maybe VC++ has been lax about issuing an error, and/or has implemented the feature in a way that differs from other compilers. For best portability, follow this author's recommendation.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I guess.. just because you can do something doesn't mean you should.. What version of VC++ do you use? If I remember correctly, it didn't use to be possible to create even a static integer in-class declaration in VC++.. because I've had to use enums to achieve the same effect previously..

I can imagine that the reason it's allowable to define a constant integer at the same place as the declaration ( something which would usually result in multiple definitions every time the header was included ) is that a constant integer can just be 'copied' everywhere its used ( much the same as an inline function ), so taking the address of the variable would be impossible without a single definition, since there'd be no single address.

Compiling with g++, I get a reasonable error, well, compiling is fine, but linking fails.

[matt@localhost ~]$ g++ -Wall testabc.cpp
/tmp/cccdhGzW.o: In function `main':
testabc.cpp:(.text+0x190): undefined reference to `GamePlayer::NumTurns'
collect2: ld returned 1 exit status
[matt@localhost ~]$
MattEvans 473 Veteran Poster Team Colleague Featured Poster

I have a few ( slightly related ) questions about binary i/o in C++, I can't seem to find full answers to these anywhere..

- Is there any way to tell if an i/ostream passed to a function has been opened in binary or text mode?

- If not, are there any nuances to look out for when using put/read/write methods on an i/ostream that was opened in text mode? Would a process that assumes an i/ostream was binary, and worked 'correctly' in that case, be in any way incorrect if the stream it used was instead opened in text mode?

- How does endian-ness work? If two bytes A and B are written ( in that order ) into a file using put, then read on a machine with reversed endian-ness, do the bytes come out in a different order ( i.e. B, A ), or do they come out in the order A, B, but with the actual bits themselves being backwards? Or does the ( binary mode ) i/ostream normalize this so that it's not a problem? What if the bytes are written using ostream.write directly from an array reinterpret_casted to a char * ? ( and then read using istream.read )

MattEvans 473 Veteran Poster Team Colleague Featured Poster

There are no specific server-side requirements for ajax in itself, but people do often write/use ( custom ) programs that run on their server, and communicate back and forth with certain ajax-enabled pages.

It may be that this ajax application requires a similar custom server side program/script, but that's not necessarily the case.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Google don't take kindly to people running automated queries ( including scrapes ) without using their "official APIs", so you may find they block your server from communicating with the Google site if it makes alot of requests like this.

Which is hypocritic to say the least, since that's exactly how Google gathers its own information.

But anyway, certainly good stuff for a proof of concept.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Thats a severe problem with the parser, so ideally, fix the parser. Is it an inhouse solution? If so, use a base framework like SAX2/DOM rather than manually writing the parser component. Will save on alot of potential headaches.

If you absolutely must use this parser without fixing it, do the following in elements that may be empty:

<desc>
<xs:comment>parser bug fix</xs:comment>
... other potential content...
</desc>

which will expand to the following on the occasion that desc is otherwise empty.

<desc>
<!--parser bux fix-->
</desc>

Your substandard parser does support comments, right?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

one of my main concerns is rotation, both how to detect collisions with rotations, and the physics involved when rotating objects collide (tired of not knowing calculus, without it i don't get the equations) but enough talk, i'll be back with (probably non-working) code that i will be sure to ask questions about

For rotated objects, you should pick a method that works with arbitrary orientations. For rotating objects, there aren't any general method for detecting the time-of-contact. For translating objects, there are methods for find the exact time of contact, namely conservative advancement for generalized shapes, or specific tests for certain shapes ( moving sphere vs sphere is a very nice algorithm, you can predict time-of-contact upto [ but not including ] a relative speed of "infinity" [ ignoring probable floating point innacuracy at those magnitudes >_> ] ).

A nice theory is as follows.. for any combination of moving shapes, you can treat the linear velocity ( translation ) as relative, that means that any test between one moving and one static object can be used to find time-of-contact for two shapes, by simply subtracting the velocity of one shape from the other.

Interestingly enough, form is relative to, and you can 'subtract the shape of one shape from the other'. This is the essence of the Minkowski difference operation. This means that any test between static shapes can be converted into a test between a point ( at the origin ) and the minkowski difference …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

For 2D point-in-convex or point-in-non-convex, see the crossing test on this page: http://www.erichaines.com/ptinpoly/. As its given there, that test will work in 2D only, for a 2D shape embedded in 3D, you have to project the point onto the plane of the shape first, if the projection is impossible, obviously the shapes don't intersect. The same theory should apply for polyhedra, the number of face/edge crossings determines the 'side' ( inside or outside ) that the point is on,

Of course, it becomes more difficult when you start incorporating different shapes to collide with ( i.e. not just polygon-against-point ).

Most shapes can be decomposed into more simple shapes. In your example, the shape could be decomposed into a pair of triangles, and to detect if triangles and other shapes intersect there are a number of popular methods.. If you can decompose into cuboids, spheres, tetrahedra, etc, ( rects, circles and triangles in 2D ) you'll be able to find existing optimized methods.

For generalized convex shapes, see below, but for generalized concave shapes, there aren't any efficient methods ( it's one of those 'difficult problems' in geometry ).

There also aren't effective generalized methods for converting any shape into the simplest decomposition of non-convex shapes, although there are certainly generalized triangulation routines. If you know the shapes involved before hand, you can either preprocess, or manually specify the bounding poly[gons|hedra].

My favorite method, at the moment, is to perform GJK on the …

Ezzaral commented: Excellent post. +11
MattEvans 473 Veteran Poster Team Colleague Featured Poster

assuming that look at and 'up' are at roughly at right angles; take the cross product of the look-at and up direction. this will give you a vector that points from the characters left to right ( or right to left ). if the look at and up aren't at right angles... this still should work, but you must normalize the result.

now, calculate the normalized vector between the listeners position and the source position.

finally take the dot product of the normalized vector between listener and source and the normalized vector that points left to right.

the dot product between two vectors gives the scalar projection of one vector onto another, when both vectors are normalized, this projection is a number between -1 and 1. If the value comes out backwards ( negative when it should be positive ) reverse the order of operands to the cross product, or of course, just multiply by -1. Test with something visual first, to see the magnitude of difference between different positions, then scale/offset the result according.

S = source position
L = listeners positon
A = look at direction
B = up direction

dot( normalize( cross( A, B ) ), normalize( S - L ) )
MattEvans 473 Veteran Poster Team Colleague Featured Poster

You can't disable the close button in a popup. It's part of the browser; a webpage rightfully can't assume control over all aspects of the browser.

Reorganize your logic so that it isn't an issue, or use a "popup div" instead ( i.e. http://javascript.internet.com/miscellaneous/popup-div.html ).

peter_budo commented: Nice link, didn't know this can be done so easily +9
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Again fails if you end up explicitly constructing Boolean, String and Number objects since they suffer with the same drawbacks as their primitive counterparts.

That's something I never considered.

I don't consider coercion in and of itself a bad thing ( coercion between numeric types is a must ).. but.. implicitly having numbers converted to strings and back really is hellish, and conversion between objects and primitives in a language without pointers ( or some other equivelent layer of [de]referencing ) isn't nice either.

There's quite alot of dark corners, but most can be avoided, as long as you know what to expect.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ouch. I'd rather prefer to know if something is or isn't an object a string, a boolean, a null, etc. Hence typeof. Only testing ( x !== undefined ) and/or ( x !== null ) isn't atall helpful if I still have no idea what I can subsequently do with x.

The test I'd usually use is ( If I have absolutely no idea what x might be, and I'm hoping for an object for example ):

if( ( typeof x == "object " ) && x ) {
  //do whatever ( i.e. poke around in x .looking for the method/property I need ) [ the && x is needed because typeof null is "object" ]
}

But, more often than not, I'd have a good idea what x is going to be, and would normally only ever use null as placeholder for things that I'm sure are only going to otherwise be objects, so, any tests can be more simply put ( assuming of course, that I control ALL of the functions involved ):

var x = get_x_or_null( );
if( ! x ) {
  x = try_something_else_to_get_x_or_null( );
}
//etc, etc.

Otherwise, for the heterogenous collection.. I'd try and setup a convention for each value, or use a "real class" with a constructor/properties/etc.

If I'm expecting an object and I pull out a null ( or an undefined ) its probably, although not always, going to amount to the same recovery, e.g.:

//I'm gonna …
MattEvans 473 Veteran Poster Team Colleague Featured Poster

The site needn't allow HTML, you should be able to hotlink the image ( i.e. ) http://www.daniweb.com/certificates/posts93300.jpg anywhere, and every new HTTP request to the image will get an updated ( the latest ) version.

The reason it may not work here though, is that the forum software may well download and save the image just once when the image is set as an avatar, rather than once for every time that a page with the avatar image is requested. There are certain technical ( and security, and moral ) advantages to doing it this way.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

What your asking is very probably against the terms of the licence of the software.

If you're wanting to 'test' on Vista as in try out the product on a new OS, consider contacting a spokesperson from Borland ( or, easier yet, looking for a trial version ). If you need the software permanently on two PCs, buy another licence, or buy a site licence.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Of course, there are sometimes occasions where the distinction is meaningful, but === undefined or === null aren't always the most useful, consider:

if( x !== undefined ) {
  x.something( );
  //Possible error, if x happens to be null:
  //""null is null or not an object""
  //or something along those lines
}

Can, of course use if ( ( x !== undefined ) & ( x !== null ) ) , but it doesn't really gain very much over if( x ) .

Using a typeof test ( AND a non-null test ) is probably the most effective, in most places.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Well, yeah. ( undefined == null ) only works via type coercion.
IMO, more useful ( and pleasant reading ) than either is to coerce straight to boolean;

if( x ) {
// where x may be null, undefined, or an object
}

But only because I'd rarely make a meaningful working distinction between ( or differently handle ) an object variable being null or being undefined.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

All that code proves is that null is not equal to the empty string. The value of the 'email' field will not be initialized to null, it'll be initialized to "".

However -- and it would be quite annoying otherwise -- null certainly compares to null.

Null also compares to undefined: ( undefined == null ) is always true.

This is a rather old thread aswel ( it's been 10 months ). I imagine that the original poster has fixed the problem, by now.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Java 3D can 'deal with objects' from other packages, but it depends what exactly you mean by 'deal with' : you can export geometry from 3DS/Maya into a form for which someone has written a Java 3D importer; with no theoretical limits whatsoever. Of course, practically, there aren't many importers. When I used J3D, I could just about get OBJ & 3DS files to display.. =D.

You would use code/script generally to 'move objects about', handle interactivity, and maybe for creating best-specified-as-procedural objects and effects, rather than actually writing every command to draw every vertex. It's usually obvious for any given object: if you want a tree, make it in a modelling package and export/import. if you want, for eg, a road for a racetrack, you might be better of generating it in code ( since you have more control/flexibility, and you can write code to make an object 'follow the road' or even true real-time collision detection [depending on level of interaction desired] much more easily if you already have 'the road' in a mathematical form ), but, it really depends.

Macromedia Director/ Shockwave is quite nice for 3D-in-a-browser. VRML has been re-incarnated as 'X3D' which, from some experience, is not the easiest technology to work with. I've never heard of Cult3D, and that's kind of an important factor if you're targetting browsers - in this day-and-age people aren't as happy to download new + unknown plugins as they used to be.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It's not safe to assume that HTTP is used exclusively; a server that publishes this information in a webpage could actually use any underlying protocol to collect the information. Just because HTTP is used when you access the information from a webserver doesn't mean that HTTP is used 'between' the PS3 network servers.

I would imagine it is important enough that Sony make it difficult to access. Depending on the type of per-user information available, it may well be illegal ( or break the provider's side of a service agreement ) for Sony to not provide a reasonable level of protection of said information. At the least, it would provide no financial gain to Sony, and potentially draw customers away from their own sites.

If the information can be accessed in any form from any given webpage, then you can probably scrape it; but scraping isn't nice, is often prevented/made difficullt, and wont let you allow any given user to access their own info without first providing you with their passwords; something that users are unlikely to agree to.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

In my comment about the document being on a server; I'm pointing at the sillyness you also note in the W3C's wording: that of an implied concept of a browser 'removing' a document from some kind of tangible 'window'. Regardless of caching ( which isn't mandated by HTML either and is thus an 'implementation detail' ), the document is never actually 'moved' anywhere, just copied. When a browser actually unloads a document is even more difficult to define, though. It's not effecient to actually 'unload' all pages when going back and forth through them. ( EDIT: or, in terms of video memory, it's effecient to 'unload' the graphical manifestation of a page when ALT+Tabbing.. is this desired?.. This part of the standard hasn't really been updated since tabbed browsing/more interactive sites became popular, but, it's what you/we have to deal with )

I want webpages to stay mostly static, yes. Do what you want within reason at the server, but send HTML + CSS + simple JS to the client.. This model is 'traditional', and works for nearly everything that a person might use the World Wide Web ( i.e. a browser ) for. The 'application' model ( i.e. GUIs, realtime, events, etc ) is nearly always better served by actual applications; be those Internet-enabled or otherwise. There's too many reasons why for me to list here without writing a small essay, but I'm sure you know what I mean..

I wouldn't suggest going backwards; just moving forwards …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

You need to represent a game company with development + release experience, and pay sums for a licence to get your hands on the official Wii SDK.

If you're talking about C# + XNA as being 'the Xbox360 SDK', you're a bit out, XNA is not the complete XBox360 SDK.

You can usually get dev-kits for last-gen consoles easier than you can current-gen i.e., today I can aquire a PS2 dev-kit easily, but not a PS3 dev-kit. ( Even this is probably legally 'shady' though; it's something of a back-of-the-shop affair ).

MattEvans 473 Veteran Poster Team Colleague Featured Poster

A few tips. I follow all of these, and I don't get viruses. I run the knife and don't even use antivirus, because I know given #1, #2, #3, #5 and #8 I'm at low risk, and that given #4 I can recover easily.

#1. Don't use a browser which executes things automatically.
#2. Don't use an OS which executes things automatically.
#3. Don't use mission critical computers to browse the Internet, set up a DMZ i.e. use two computers, or two OS installs, or even two user accounts on the same OS install provided you follow #8.
#4. Backup regularly in case something bad happens ( remember, your data is sacred, but the OS usually isn't [ unless you've bought into a really lame license agreement.. ] )
#5. Highly important Don't download and/or install anything unless your sure of the source. Do you really need that 'cool new screensaver'? Why exactly does this site need PluginXXXCool?
#6. Read warnings when they popup, and look at the address bar carefully. www.mybank.bankingonline.com is not the same as www.mybank.com ( assuming the latter is safe )*.
#7. Don't rely on firewalls or antivirus. Firewalls don't protect against human error, and antivirus is far from perfect ( any n00b could write a program that erases your data, yet is undetectable ).
#8. Highly important Don't browse the Internet as a user with Adminstrator, Root or any other system altering priveledge. …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Really not nonsense, There's nothing in standard HTML + JS that mandates the existance of a _window_ let alone an event when it closes. Each browser handles its idea of a 'window' in a different way. Maybe this is a shortcoming in HTML + JS, but, that's just the way it is.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Heh.. "Hide Extensions for Known file types" is one of the first things I disable in a fresh Windows install.. =)

http://www.irchelp.org/irchelp/security/trojanext.html

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Did you try using a full path to specify the file? i.e:

house->LoadFromX("C:\\Documents and Settings\\<user>\\Desktop\\Projects\\3DGameFramework\\3DGameFramework\\fachwerk33T.x");

Try this temporarily. The initial working directory of your application is not necessarily the folder where source files are located; you can normally set the application's working directory either from the IDE ( if appropriate ) or from a shortcut, etc.

The windows explorer addressbar thing; do View > Toolbars > Address Bar, and then right click the toolbar and uncheck "Lock the Toolbars".. you should then be able to move the address bar into the correct place ( from what you've said, it's showing but is too small/wrong place to see properly ).

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Client is an entire machine not necessarily software. Lets think of a Half-life 2 / Counterstrike cheat ( not a bot, a cheat ) replace opengl32.dll with an opengl32.dll that ignores requests to enable the depth-buffer -- this means you can see through walls. Nothing in a EULA could possibly cover that. ( this is a real cheat ). A bot could simply modify information sent between the game and the server ( a modification at the client end, say I want to get a better latency handicap; this doesn't require changing the software, just changing what the computer says ). You find a EULA that actually has words to categorically prevent me inspecting and/or changing what my computer says on a network... See ( http://en.wikipedia.org/wiki/EULA#Enforceability ) for some of my prior statements w/re. EULAs in another persons words, and no, I very rarely play online games.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ah, you know what I said -- with regard to legality -- I wont repeat again. With a bot specifically, I fail to see how it can even be a violation of the terms of use of a service/connection, since a bot is usually a modified client.

With regard to morals, no way! PKing is a sin, now? It's a game! people who get worked up about being killed in a game have gone way wrong in the head.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

If I'd made a blanket statement like "A EULA never has any legal power", then yeah, you'd be absolutely right.

I didn't really make that statement though; my point is that something they put in a EULA isn't always gonna be upheld, and they ( producers ) do flirt on the line between tenable and untenable when they put restrictions on the way a consumer 'is allowed' to use a product.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

If a EULA gets overturned in a court, or if a little niggle in the wording prevents the EULA being upheld, or equally, prevents it being considered applicable with regard to creating(?) the intented restriction, going against those things in the EULA that would result in actions being 'illegal' ( by breaking a legally binding agreement ) wouldn't actually be illegal. It's not really a logical falacy, it's a consequence of a -- completely possible -- set of events. Rare, perhaps; but since it seems they use this kind of clause in their agreements ( as in, restrictions on means of play not as in restrictions on copyright infringment and illegal distribution ) more as a threat than as a legal tool, it doesn't seem to have come up enough to have been really tested in a court.

I think it is quite different from protecting a copyright or restricting distribution. They push agreements on us as uneducated people, we're not lawyers, we don't really want to have to think about these things. It has the potential to pull consumers into legal problems on the whim of a publisher and criminalizes laughable things. I just don't really think that's the way things should be, and I'm pretty sure that many people ( thinking purely as 'consumers' ) have that view aswell.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I dont think cases of this have ever been put through a court ( I may be wrong, but it's not critical to my argument ). Just because a EULA says something is illegal doesn't actually mean that it is... A publisher can put anything in a EULA, and a EULA is totally worthless if its proved to be overly restrictive or untenable. A EULA is un-inforceable in many countries; lots of these 'cheaters' are offshore in countries/jurisdictions which might not even respect a game's copyright let alone a usage agreement.

As I said previously, I do think of these people as a feature, they're a minority, interesting on a level, and the companies controlling servers + the publishers seem to be able to deal with it, and do put sufficient measures in place from the very beginning ( security is a good thing to consider from the beggining! it's the responsibility of the publisher to make sure that they can keep control, or at least make it difficult to cheat. Relying totally on legislation is .. well, a pretty poor approach considering the worldwide stage ).

I think that the 'real' law should stay well away from computer games. I don't want to be legally liable in this world for my actions in a virtual world. That's the whole point of a virtual world!

That is my personal opinion on the matter, as a player of various games in the past, and as an amateur developer …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

OpenGL no more 'wraps WinAPI functions' than any other program or library that happens to run on Windows. OpenGL is platform agnostic, the need for Windows API with OpenGL apps is to get access to the driver frontend, and ( perhaps ) obtain a window / device context, although OpenGL itself mandates no windowing method specifically. Maybe the software reference implementation that ships with windows wraps WinAPI calls, but that's not the version of OpenGL that most gamerz see ( install graphics card drivers and you get the driver manufacturers accelerated OpenGL driver, which should go as direct-to-the-card as possible. I have no idea what they put in their drivers, but I'll bet they make as little use of the Windows API as they can get away with ).

Same with DirectX, it is supposed to go 'under' the API, as in, provide as close-to-the-metal access to the graphics card as is feasible, card vendors provide the implementation, and if this uses WinAPI in any way, thats secondary to using the features of the hardware.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Psh.. it's not so serious.. a bot isn't necessarily bad. IMNSHO, there's no such thing as 'cheating' in a computer game.. It's like 'cheating' in reading a book by looking at the last page first. It only really hurts yourself. Oh yeah.. w/ regard to online tournaments, ok, ok. Don't cheat in a tournament, you'll get found out and blacklisted anyway, or just lose respect in w/e gamerz community you're a part of. For MMORPGS? Hey, the real world has gangs and murderers and fraudsters, so I guess, if there are people who play that way in an MMO world, they're a feature!

But anyway, on topic: No, no idea where to find a bot maker. It likely depends what game, since there's rarely such a thing as 'generic'.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Based on a quick test in something I've got running ATM, that last bit of code I posted:

velocity2 = ( 2 * surface_normal * surface_normal.dot( velocity1 ) ) - velocity1;

Should probably be:

velocity2 = velocity1 - ( 2 * surface_normal * surface_normal.dot( velocity1 ) );

!

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Hi, sorry I didn't reply sooner, been abit busy.

With movement and collision, you have a couple of pitfalls. One is that the speed/velocity of a moving object can exceed the width of objects being tested against, a symptom of this is moving objects 'tunneling through' other objects. This occurs when you use 'static collision testing', which is testing the current position of objects in each iteration as opposed to testing the positions and trajectories of objects. With static tests, two collision tests ( in two frames/iterations ) can report a non-collision even though the trajectory of an object may have passed right through another object.

You can often get away with static tests by increasing the number of iterations and decreasing the maximum velocities involved, this means you can keep the same 'visual speed', but objects are actually moving much less between frames and being collision-tested much more frequently.

Another specific problem with the bounce method you're using is that the ball can be collision-tested as being below paddle.top( ), your code will flip the velocity of the ball; in the next frame, the ball might not escape the collision between paddle.top( ), meaning the ball trajectory gets flipped again, and again, and so on. The ball would indeed 'spaz about' in that case, the ball never actually escapes the top of the paddle.

Two viable fixes:

if(m_position.y+m_height >= paddle->GetY() && m_position.y <= paddle->GetY() + paddle->GetHeight() && m_position.x+m_width/2 > paddle->GetX() && m_position.x+m_width/2 < paddle->GetX() + …
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Where and what are the issues? Do they occur at the 'corners and sides' of the paddle, or at the flat, upwards pointing, part? What exactly doesn't seem right when you test?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Yes, the second interpretation is correct.

> Velocity is change in position w/ respect to time ( a vector )
> Acceleration is change in velocity w/ respect to time ( a vector )
> Speed is distance travelled w/ respect to time ( a scalar, equal to length of velocity )

Erm, the same exists for rotation, except velocity = angular momentum, and acceleration = torque. But err.. don't worry about rotation, it's evil.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The magnitude/speed of a velocity is just the length of the vector; in components: speed = sqrt( ( velocity[x] * velocity[x] ) + ( velocity[y] * velocity[y] ) ); ( good ol' pythagorus theorem:'square of the hypotenuse = the sum of the squares of the other two sides. )

I wouldn't worry too much about the speed of trig / speed of sqrt on processors in this day and age, not unless you're dealing with 1000s of trigs/sqrts/etc every frame.

Edit: And, to 'rescale a vector' to some new length:

vector2[x] = ( vector1[x] / old_length ) * new_length;
vector2[y] = ( vector1[y] / old_length ) * new_length;

It become alot easier to work with math/vector classes than to work entirely in components after a point..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The position of the paddle when the ball hits it is wholely irrelevant - the paddle is the same all over, flat, and moves in a constrained direction ( in its own plane ), so any moving point on the paddle is 'identical' to any other point in terms of any calculation you perform. The only areas of the paddle that ARE different are the corners, do you model that accurately?

The quick trick you describe ( inverting one of the components of the moving object's velocity on a bounce with a plane ) works irrespective of the initial angle that the ball is travelling at; if you start the ball moving at any angle other than 45 deg, then bounce angles will be a little more 'varied', because only 45 deg will invert as itself. Any other angle will have slightly more possible results.

But.. I get what you're saying. Given any initial starting angle, and assuming that the player is 'perfect', and assuming that you don't handle corners of the paddle in any special way; the movement of the ball will always be exactly the same; the game is deterministic with a perfect player.

I am not sure if that's how breakout always is.. Alot of basic collision detection code assumes that a collision happens instantanously, and I believe ( although I may be completely wrong on this! ) that if a perfect sphere bounces off a perfect plane, that the velocity of the plane …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Stick with 'standard' goal-oriented action planning techniques; the method you're starting to write ( based on your other thread ) won't scale well to finding a general solution to a general problem.

Do you even need to consider locality of objects ( i.e. actually moving between them ) or just provide the action sequence necessary in order to fulfil the top-level goal? By that I mean, a valid response from one goal planner could be:

kill rabbit := pick up rifle -> shoot rabbit

and from another, different planner, it could be:

kill rabbit := move 1,0 -> move 0,1 -> pick up rifle -> move 0,-1 -> rotate 90 -> fire rifle.

in the first case, the planner spits out abstract commands and expects some other layer to solve the task itself; in the second case, the planner does everything including actuate movement itself.

I guess, the question is, how 'useful', or how complete do you want the output to be?

To make it more complete, you need a more complete specification of the pre-requisite/post-requisite/action set, and you need a somewhat complex symbol-based planner. ( See STRIPS for example, papers for the STRIPs solver implementation are easy to find, and it's not that difficult to implement ).

For a less complete solution, you can almost do without a specialized planner atall ( you can represent the problem as a directed/undirected graph, and use a tree-search/graph-search to get the shortest …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Probably not what you want to hear, but the multiplatform SDL library ( simple directmedia layer ) has routines for loading in Wav files. I'm not sure how it holds the data internally, since SDL has its own playback routines aswell, but worth a look maybe.

I never work with platform-specific libs directly, so I can't really help you much more there. Have you looked at the samples in the DX SDK directory though? There's a PlaySound demo, although that might be the technique you're already considering.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Well.. alot of the questions you've asked in this thread have quite complex answers, but those answers are very easy to find/work out yourself.

Can you serve two pages to two different browsers? Yes. Can you put the image in a div popup? Yes.

Personally, I'll give hints on how to do things, and if it's non-intuitive and can be explained with a code snippet, I will give that code snippet. I won't however write out a large amount of code that demonstrates something that's technically very 'simple', especially not when there's a multitude of examples of these very things easily available on the web.

You're evidently able to work this stuff out for yourself if you give it a bit of thought.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Looking at myself, a person who 'enjoys game programming'; I don't have an issue with 20+ hour days, intensive work, stress and/or overwork. I enjoy being constantly occupied with something, and am absolutely bored unless I'm working on something. In a way, I play a game that's more fun than anything I could possibly make or release in development itself.

And, I started off raving mad, so it's not like I'm losing anything.

Don't feel sorry for people who have this mindset, I feel sorry for people who don't ^_-

MattEvans 473 Veteran Poster Team Colleague Featured Poster

You can also transfer the licence with some software ( even Windows XP, provided you transfer the entire package that Windows was purchased with; cd, keys, packaging, manuals, the PC itself if it's an OEM version ).

This isn't the case with Maya though.. Maya licences are indeed non-transferable.