renman29

Members
  • Content count

    169
  • Joined

  • Last visited

Community Reputation

675 Good

About renman29

  • Rank
    Member

Personal Information

Social

  • Twitter
    AlienScribble
  • Github
    AlienScribble
  • Steam
    AlienScribble
  1. I agree that data based determination is often the best route, although... one might caution sometimes direct coding is actually a better(faster) approach where data based can in and of itself complicate code more than it otherwise would need to be for the given scenario. There are often occasions that I have seen where it is actually far simpler to code the desired functionality than to create external entities which need to be loaded and understood by the code. In fact I've seen ppl (and done it myself) put together editors/interpreters where it actually takes longer to edit the entities in the gui (and must save and load and be deciphered) than to simply enter the needed data directly into some cleverly designed Macro/function/method.   I try to avoid superfluous coding -- saves a lot of time, less to look at, and easier on the eyes. Sometimes direct is less work and less code.   I actually ended up scrapping some of these external approaches in favor of direct coding since it was actually much faster productivity and easier to test. Why build script systems, editors, etc -- when direct source code is (sometimes) faster and easier? Sometimes it is [ in which case the source code is the editor (not the best for teams tho) ] For example, I actually made a flash animation type system in which everything is built entirely with source code(methods combos) which actually turned out to provide precise results and fairly fast production. ( I don't recommend this for everyone ) Whatever is faster in the long run.
  2. For pointing the gun such that the arm and gun rotate and gun ends up pointing in the aim direction... Maybe find the vector that represents the shoulder to the back of the gun(distance) and the vector that represents the path from the back of the gun to the nozzle. Then rotate them as an adjoined pair of vectors toward the aim vector. This could get tricky if the aim is suddenly on the opposite side (in which case you'd want to find the shortest angle between gun-barrel-direction vector and aim position (where aim vector in this case is vector between back of gun and target). Then once the gun is rotated at the appropriate distance toward that aim angle (could use a smoothing technique like newAngle = 0.3f * angle_difference; //30% current difference to smoothen(ease) out rotation changes) Then you would rotate the arm so the hand is positioned over the handle (the handle should be the appropriate distance cuz we rotated at a distance that we expect the back of the gun to be at). One thing you can do with this is find the vector from shoulder to new handle position and use the vector's angle to assign the current arm rotation. It works in my head anyway - lol ;) Btw to add the bullets at the nozzle you would use something like this:   Quaternion aimQuat = Quaternion.CreateFromYawPitchRoll(0, 0, rotation); // rotation of gun Vector2 bullet_offset = Vector2.Transform(gun_nozzle_offset, aimQuat);      // (ie: gun_nozzle_offset = Vector2(30, -2)  )  bullets.Add(new Bullet(pos + bullet_offset, vel+aim_direction*bullet_speed)); //add bullet at gun at correct velocity (player velocity + bullet velocity)      Something like that anyway - although it may require some alteration to fit with your code.
  3. Scrolling background logic?

    Another technique for horizontal and vertical background wrapping is to use UV linear wrapping state with the device so you only need to draw the background once and the hardware takes care of the wrapping. First you need to figure out how to create a background that when wrapped - it won't appear to have seams. This can be done by copying the background to 4 layers with each layer moved to a corner with their tips touching in the center to expose the seams that would show when scrolling. Then with a 50% opaque stamp tool, smudge tricks and other art techniques to hide seams. Now this art can scroll without seams appearing.   Then when rendering a texture, you would want the sampler state to use linear wrapping and when you draw it: (using SamplerState.LinearWrap) Draw(background, screenRect, new Rectangle((int)background_pos.X, (int)background_pos.Y, background.Width, background.Height), ColorTint);    Where screenRect is your destination screen rectangle(always the same), and the other rectangle is the source rectangle (x,y, width, height). When the source sampling starts at x, y and exceeds the edges of the texture (cuz trying to go width and height), it will wrap the texture to continue sampling. So then when the player moves you just change background position in that direction. For layers the same technique could be applied. Hypothetically, for huge mapped backgrounds, you may want to seamlessly tile parts together and scroll through sections of the grid -- each tile in the grid can tell it which part of which background art to show. This way you could have extensive changes to background scenery as the foreground scrolls.
  4. (Just want to add) There are occasions when a string matching is (initially) useful - such as external animation editor which may have some unknown # of named animations and behavior definitions which the code knows how to use. You can pre-cache (store ahead of time) a match to a logic(if then conditions) determined animation. If you want to keep the string format, you can use an unordered map or dictionary (hash tables - very fast) to match the name/description with the desired animation. For animations that will switch frequently though you may want to have it store the matches ahead of time (micro-optimization) to the appropriate enums. Good luck on your mission. :)
  5. haegarr: that's brilliant and quite helpful. :)
  6. I'm still kinda in that twisted nest of if-then boat myself. It works but it becomes quite complex with all the conditions that can exist. The tricky thing is getting it to decide what portions of animations to select under a wide variety of conditions that will result in legal smooth motion with so many possible outcomes that don't make sense in some situations -- and still make the character reactions look quick, responsive, and animate fluidly. For example - a tiny sample: case HEROSTATE.blablabla: ...... ... if (((isJumping == false) && (slow_fall)) || (inWater && previous_jump_pressed == false)) //if not already jumping and didn't just press jump in previous loop: {     doubleJumping = false;     if (jump_pressed) // more logic elsewhere     {         int jump_type = 0; // 0 is normal, 1 is duck roll,...         if (duck_initialized)         { //if in duck mode:             if ((!left_down) && (!right_down)) { animationPlayer.PlayAnimation(jumpUpAnimation); animationPlayer.frameIndex = 2; ducking = false; duck_initialized = false; customAnimator.animation = null; isGrounded = false; }             if ((!rolling) || ((Math.Abs(velocity.X) < 2)))             {                 if (left_down)                 {                     if (facing == FACE_LEFT) { animationPlayer.PlayAnimation(rollForwardAnimation); velocity.X = max_speed.X * -2; }                     if (facing == FACE_RIGHT) { animationPlayer.PlayAnimationBackward(rollForwardAnimation); velocity.X = max_speed.X * -2; }                     rolling = true;                     jump_type = 1;                 }                 if (right_down)                 {                     if (facing == FACE_RIGHT) { animationPlayer.PlayAnimation(rollForwardAnimation); velocity.X = max_speed.X * 2; }                     if (facing == FACE_LEFT) { animationPlayer.PlayAnimationBackward(rollForwardAnimation); velocity.X = max_speed.X * 2; }                     rolling = true;                     jump_type = 1;                 }             }             else jump_type = 1;         }         if (jump_type == 0)         {             velocity.Y = -jumpPower;             isJumping = true;             if ((inWater) && ((animationPlayer.animation == jumpForwardAnimation) || (animationPlayer.animation == jumpUpAnimation))) animationPlayer.frameIndex = 0;         }     } } else if (isJumping) {  .... ... etc.. So I map the possible behaviors and conditions on paper first and use that to figure out how to build conditions. ie: flip-roll from ledge -- relying on falling state and playing fall animation would be faulty. Based on suggestions I'm thinking maybe it's possible to set legal animation bridges between frames in other ways which again I'm thinking may still require conditional inputs such as velocity, water-interaction state, grounded-state, jump-state, crouch-state(ie: just starting, far enough into, just ending), knowledge of surrounding objects and Booleans set to qualify legality of certain transitions. Right now I actually have it choose frame transitions differently depending on what's happening as it enters another animation to satisfy what the player wants to do.
  7. Just adding.. I find the logic for animation switching can become quite complex depending on the sophistication of character interactions. I actually rewrote my animation class to be as simple as possible trying to minimize conditional switching as you mentioned. Something like:   Character[Ryu].PlayAnimation(UpperCut, facing, [...optional parameters here...] );      // optionals would be like conditional play-speed(ie: underwater), etc..   (Depending on character - all my logic would be kept in a player or character class for determining animations) Where PlayAnimation uses enumerated animation UpperCut, which is assigned the animation index. The Player plays a strip of animation from the sprite sheet based on predefined speed, position and so on which are also loaded from a file corresponding to the sheet. If you use a sheet packer, you may need to set up an editor to adjust the extraction boxes for each image you would normally use in an animation strip [otherwise you could even simply write the strip info into a text file or into header]. Also you could have it produce test play-back of the selected animation strip you're working on and provide additional information to save to file such as speed (or even frame timing for particular frames if you wanted).   It may be handy to also map out on paper - different conditions in which animations can or can't be triggered. ie: different animation triggered when ducking or jumping or running or idle. And then quickly switching animations to adapt to new user input. This is where it becomes very difficult to avoid complex if-then stuff.
  8. Wow, that's brilliant. I'm gonna try it. :D
  9. I'm trying to figure out how to use 32bit color display mode but still use something like an 8bit 256 color palette (or better 1024 color palette) so I can set very precise color gradients and do palette rotations and other effects with them. [ie: 16 color shade gradients like for example: black to red, black to blue, black to yellow, ...... blue to white, brown to yellow, etc...] My best guess so far is to use a shader to pick the closest colors - and perhaps have them calculate a color to match to based on how the original color gradients would be calculated. I want to do this to avoid white-washing, burn-outs and other color destroying artifacts from some other shader layers -- also I want it to look somewhat retro too (like Sega Genesis retro).  Also I was hoping to do some palette swapping and rotation effects.   Anyway, all ideas - abstract, beginner or otherwise - are totally welcome. (^_^)  
  10. I don't know if it's a bug, but If I understand correctly: I believe the display resolution of the backbuffer must be a valid device screen resolution, so it would use the closest matching resolution to what you set and I think SetViewport determines what portion of that will be rendered. If you need to render into a 4096x4096 space, myself, I would create a separate render-target and move the position of the render-target(as a texture to draw to backbuffer with spritebatch) around based on the scroll values -- so it pans around inside the display window.
  11. My personal experience with it - it has a lot of useful helpful functions that are highly efficient IMO and memory safe if used properly so I really like it. I use MonoGame/XNA but am also expanding a DX11 game engine at the same time, so I would say it has some things that are similar to XNA(which I likes), but you have the source code too so you can see how it works and understand how to make your own functions that do similar things. For example, I found the memory alignment helper(AlignedNew.h) very useful (inherit into your classes/structs) for 16 byte alignments (optimization). So since you can choose what you do or do not want to use and you can see the source code, I think it is useful in helping to learn DX11+ plus it does not bring any limitations and since it is very popularly used, I personally would assume it is here for the long run. You could even use it minimally if you wanted and just use the parts most useful to you.
  12. I would probably refer to them rather as frameworks (altho I don't know much about LibGDX) I know that anything you can do in DX11/OpenGL4.5, you can do with MonoGame (XNA was DX9 - where this is more like DX11+/OpenGL) - like a wrapper -- I've done 3D animated character stuff with it before (and used new shaders). Yeah, it's odd that not very many ppl use them for 3D - although 3D xna tutorials for example, will work exactly the same way (except it's faster now and you can use new shader models). I don't know much about LibGDX so someone else should probably speak for that one. I've heard it is also very good but I don't know if there are any limitations. I would be VERY suspicious of anyone saying there are performance issues with MonoGame - at least I've done my own benchmarking and found it compares extremely close to DX11 in C++ on desktop. FAST. Maybe the old versions had some issues? I don't know - that could be it. The only way I could see that happening is not knowing how to program c# for performance(pools, garbage collection, locals, etc) or how to minimize locks and changes when accessing the video card. It isn't essential to use the provided methods either - as you can make your own primitive rendering stuff. I've heard you can use bullet for 3D physics too if you didn't already make your own. I think I'll go play with libGDX just for fun now too..
  13. I believe MonoGame uses SharpDX to some degree(cross platform) and basically is thereby DX11+ and you may notice that if you obtain the SharpDX toolkit version, you can set it up so that it is initially virtually identical to MonoGame/XNA. With SharpDX though, you'll probably want to use .cso's for compiled shaders where with Mono you'd use the pipeline(although optional). I tried using both SharpDX and MonoGame in multiple projects and noticed no performance differences or restrictions so far. I had to resort to checking DirectX 11 documentation frequently to decipher how to mimic a typical DX11 setting in c# -- and one may need to watch for managed and unmanaged stuff - and make proper dispose methods. Last I checked SharpDX version for DX12 did not yet have a lot of the toolkit stuff I was hoping for and I'm not aware if those are being worked on by anyone yet.
  14. It was a hard decision, but I decided to freely release MeoMotion Animator for 2D distortion skeleton game character animation for games. It includes simple example source code for MonoGame (and XNA), SharpDX, DirectX11, SDL2, and OpenGL and editor allows consolidation of projects in exports.   It has a simple interface and allows vertex distortions, and fade-blend animation overlays(for expressions), supports animated part-swapping, time-lined layer reordering, key-part isolated blending, control-z(although not 100% tested), etc.. It can be found here: http://www.alienscribbleinteractive.com/MeoMotion.html   And editor tutorials are also available as video: https://www.youtube.com/watch?v=S454TSAo_Y8   If people like it enough I will later try to add more features. Possibly IK, parametric interpolations, binary exports, and others...
  15. C# becoming obsolete ?

    I thought c# was still gaining popularity. (plus I find it very easy to develop without bugs, workflow is quick, performance is good) -- also I came from a background of C/C++ and the transition to c# was extremely easy (feels like the same language) - so if you know one you can comprehend the other. I even noticed that I was able to follow a java tutorial and know how to make the same in c#  - a lot of similarity. A lot of game engines and frameworks are built around C# also.   However it does seem java is gaining popularity too. I would want to brush up on C/C++/C# and Java (all similar) - for development ... and also php/css/javascript/sql would be useful in my limited opinion.   I remember in university some of our pompous pretentious professors told us C/C++ was already becoming obsolete(many years ago) and that we should only focus on learning Delphi(which I liked) and Eiffel - luckily I followed my instincts and bought a C++ compiler and focused there instead.