Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Erik Rufelt

Member Since 17 Apr 2002
Online Last Active Today, 05:15 PM

#5229465 Thoughts and Ideas about optimizing 2D Per Pixel Collisions

Posted by Erik Rufelt on 17 May 2015 - 11:02 AM

Pre-save the collision masks instead of creating them from D3D memory, so they can just be read into an array. Requiring textures to be lockable and readable sounds like a bad idea. Should make loading time pretty close to zero too if you can just read the data from a file already in your internal collision mask format.




#5229333 Marvel/DC Comic Games Copyright / Royalty

Posted by Erik Rufelt on 16 May 2015 - 12:07 PM

There is absolutely no way you can do that, unless you pay them millions. Even so I doubt a company like Marvel would ever agree unless they got absolute say on every single design choice as well as whether or not the game would even be released once done, as protecting the reputation of their multi billion dollar franchise s more important than a single payday.

If you Google a bit you might be able to find info on how strict they are, some big companies will come after you right away to shut you down on principle, whereas some won't really care. In general you can't use any existing IP without express permission.




#5229213 When you realize how dumb a bug is...

Posted by Erik Rufelt on 15 May 2015 - 02:47 PM


Do you see it?

 

I thought it would be that 'y * w * x' should be 'y * w * n', missed the shadowing. :)




#5228185 Particle Distortion Effect

Posted by Erik Rufelt on 09 May 2015 - 05:22 PM


Render distortion areas to a distortion map or something? Use the refract() hlsl function?

 

Sounds reasonable.. probably need to tweak the shader a bit to get the look you want, not sure if refract is really the best fit for heat haze..

 

Google for "heat haze directx shader tutorial" or "post processing directx shader tutorial" and similar search terms, gives a few results, some threads here on Gamedev among others.




#5228134 Particle Distortion Effect

Posted by Erik Rufelt on 09 May 2015 - 11:01 AM

Render your scene to a texture the same size as the screen back-buffer. Then render that texture to the back-buffer as a fullscreen textured quad. This will give exactly the same result as normal rendering.

 

When you have that in place you can modify the shader used to render the fullscreen quad so it distorts the texture instead of just copying it, which can create all kinds of effects.




#5227106 Very strange objects transormation issue

Posted by Erik Rufelt on 04 May 2015 - 05:38 AM

Difficult to say, it's usually solvable on current versions as well... and I doubt it's the same issue every time.

If you tried all the suggestions and still have the problem, I suspect you might have some worsening factors.

 

The problem that can't be completely avoided is when running at 15ms/frame and for some reason or other one frame will require 19ms, which will always happen sooner or later for any number of reasons.

With a couple of extra frames buffered it should be hidden, even at the current version.

 

Do you do any reading back from video memory?

If so, you might break frame-buffering and thereby always get stuttering whenever one frame misses the mark.

 

 

EDIT: The remaining possibility is that frames are buffered but the actual swap is still missed. This would be a driver problem or synchronization problem with something on the system that can't be run in parallel. Perhaps memory allocation/freeing on the GPU blocks the swap or something, if you do a lot of that it might be worth checking out, like recreating or replacing large dynamic buffers. Just a guess... not sure if it can actually happen..




#5226367 CSG Subtract...

Posted by Erik Rufelt on 29 April 2015 - 04:21 PM

This page seems to have a short explanation: http://www.codecreator.net/csg/csg.html

Basically just do CSG for each face in the models, one face at a time. The page linked lists the faces needed for add/sub/etc..




#5226260 Mixing WSASend (Client) with recv (Server)

Posted by Erik Rufelt on 29 April 2015 - 08:55 AM

That doesn't make sense, should work. I would guess your problem lies elsewhere, like TCP delay or something. Is the connection properly detected on both sides, and does WSASend return success?




#5226144 Very strange objects transormation issue

Posted by Erik Rufelt on 28 April 2015 - 02:02 PM

Try using the display-mode refresh rate and set the interpolation timestep to match exactly that, + time and see if you miss more than ~3 frames per second, either disable VSync and switch to timing with averaging instead, or increase the swap-interval to drop to 1/2 the FPS if you feel that is better than tearing.




#5226143 Very strange objects transormation issue

Posted by Erik Rufelt on 28 April 2015 - 01:58 PM

Check this thread: http://www.gamedev.net/topic/649174-why-directx-doesnt-implement-triple-buffering/




#5223438 inline virtual is a nonsense ?

Posted by Erik Rufelt on 15 April 2015 - 09:12 AM


In some sense the "inline" keyword itself is a nonsense.

 

It has a completely different and very sensible purpose. Try putting a simple function or operator in a header used in multiple CPP files without the 'inline'.




#5222257 Storing bits in a container

Posted by Erik Rufelt on 09 April 2015 - 10:42 AM


As per what you explained above, am I to understand that the code variable is a binary integer? In that case, can I declare it as an int type and perform the left shift operation given? Just to clarify, shift operations can be done on int types, right?

 

Yes this should work well.

And ofcourse you need to remember or calculate how many bits are actually used for the code, as the int will always be the same number of bits in total (usually 32). And every time you shift left, one more bit is used.




#5222132 Storing bits in a container

Posted by Erik Rufelt on 08 April 2015 - 04:32 PM

I guess you want to append the bits on +, so '0101' + '1100' = '01011100'.

Your original file consists of bytes, but if you want your fixed-length bytes (8 bits) to correspond to variable-length bit-codes, then your result doesn't necessarily have an integer number of bytes (for example 11 bits, which is 1 byte + 3 bits).

 

So I guess you should go through each byte and find its code and append the codes for every byte in the file to a single vector<bool> in your case, which gives you a compressed file expressed in bits, where one bool in the vector corresponds to one bit.

Then take 8 bools at a time from the vector and combine them to one 8-bit byte and write it to the compressed file. When you're done you have a new file with compressed bytes.

 

When you decompress you take all the bytes in the compressed file and expand them into a new vector<bool>, 8 bools for each byte in the file, and then to the reverse operation to get the original bytes from the variable-length bit-codes.




#5220181 How to map a trapezoid texture area to a rectangle correctly

Posted by Erik Rufelt on 30 March 2015 - 06:43 AM

This requires that you interpolate a third coordinate and divide in the pixel-shader, for example:

float2 TexCoord = float2(InputTexCoord.x, InputTexCoord.y / InputTexCoord.z);

Check this topic, and in particular make sure you know what behavior you want to achieve, a "stretched" texture over a quad (2D in the quad's space) or a perspective-correct texture-mapping.

http://www.gamedev.net/topic/556237-texture-mapping-on-trapezoid/




#5220059 Relationship between Linux and Java/Dalvik, .so vs .jar

Posted by Erik Rufelt on 29 March 2015 - 06:45 PM


The native sdk in android isn't something to dabble in anyhow if you can avoid it.
I've been told by others here that it isn't supported properly any more and is essentially a throwback to before the java/dalvik stuff was in place.
I can imagine that it is far less portable using the native api as you can't really guarantee the processor an app will run on. Android runs on all kinds of hardware from arm, x86, etc. Are you going to build and distribute a native app for each and every processor type and variant (e.g. arm neon etc)?

 

It's not that bad.. and there's not really much of an option if you want to share code between platforms, unless you use a higher level library that will either duplicate everything per platform or use the NDK itself. In general it's just standard C++, has the standard library and new versions of GCC / Clang so everything's there pretty much...

I compile identical GLES code on both Android and iOS without too many problems, and any logic in standard C++ works flawlessly.

 

The interaction with Java and setup code is far from perfect though.. but could be worse, it's OK overall after working out some of the quirks.

 

You can compile your app for each processor type and put several binaries in the same package, or alternatively do multiple packages to reduce download sizes. You can also compile your code for NEON and non-neon and dynamically check CPU-support to run the correct code.






PARTNERS