• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

OmarShehata

Members
  • Content count

    60
  • Joined

  • Last visited

Community Reputation

205 Neutral

About OmarShehata

  • Rank
    Member
  1. Thank you for the reply Ashaman! I hadn't thought about dynamic vs kinematic controllers. And I guess it just felt like the path finder had to control everything but yeah, it can just execute a direct action if the object it's chasing is within its vicinity, and otherwise it uses the path finder.         This confirms what I've had doubts about, that I was doing it too "manual" or hardcoded by giving it all these cases, but I guess it's a pretty legit method.       The answer basically says "Look at how Mario AI did it" and my question is, "I want to do it like Mario AI..how?"   I'm currently implementing the first method and it's actually playing well against a human player or against each other with a little tweaking. But I'm still thinking about doing something that searches steps in the future so it can allow for "unlimited interactivity in mid-air"   Maybe if instead of considering every possible step (left, right, up, up right, up left and no key) at each and every node. It just draws out a path from the current grid cell to the next. So it keeps left pressed until it passes 256 pixels, and same for other keys, and that would be the second node. This would VASTLY lower the search space, and of course lower its flexibility but I think by tweaking the grid size we may have something that would work great and be fast enough. Will have to experiment more with it.
  2. I'm trying to make AI for my 4-player party game. It's basically a series of minigames. You can see a preview of the gameplay here.   I've been tackling this problem for weeks, but it seems either there's very little information/technical guidance out there, or there's just generally no general solution. (I'm assuming the latter), I'll try to state my problem and the solutions I'm trying as briefly as I can.    The game uses box2d to simulate its physics, with slightly tweaked physics (for example I re-set the character's velocity every frame to apply my own universal friction independent of everything else)   The Problem   How do I implement efficient path finding in a game like this?        Attempt #1   My first attempt was to build a sort of "connectivity graph", given any walkable tile, what other walkable tiles the character can reach with one "step" (where step is defined as holding a specific set of keys for a certain time)    For example, you can see in the image below, he can either walk right, left or jump to these various tiles, or fall down.      Once that is good enough, it's trivial to run A* and come up with a path.    And it seems to work well in the general case:     However, this has a few problems.   Since all my nodes are "walkable" tiles. It can never jump up to hit a target in the air if it needed.    Since the nodes are all based on merely x and y (not taking into account acceleration and speed), it requires a lot of fudging to get it to work (for example, you can see it slows down between jumps, because it has to position itself correctly before making the jump).   It's pretty manual. I have to specify whether it can make the jump based on the tiles around it and whether there are any tiles that would block its path. The more restricting the checks are the more special cases it misses, and the more liberal it is the higher the risk it can get stuck.   It cannot make jumps like this:     Overall, it feels very restricted.      Attempt #2   So I took a look at the Mario AI  and how it was done, since it seemed very similar to what I was trying to do.   It seems pretty solid, and the way he said it's made is that, instead of taking "steps" between tiles, it takes steps as in, what it should press the next frame, and where it will end up.     from this interview   So I did something like that, predicting the path given the current state and the key input   In this gif, it predicts the path if you keep the buttons pressed held     I thought I could then easily run this through an A*, and it will generate an awesome path.   I can't seem to figure out at all how to design the cost/heuristic for this. My heuristic is a simple euclidean distance of the node to the goal. As for the cost, I just made it a constant 1 for any and every stop, and this is what I'm getting:     This is the path generated by the A*, at every node it knows which key to press to reach the next one. It can jump on that pillar and get to the target. So far so good, works great! However...     It gets stuck for a really really long time. (This is stopped after a fixed time)   It would eventually find a path but the thing is, it's just searching way too many nodes. It keeps trying first to jump directly up, then to jump directly up, but just before hitting the tile, it goes right. That obviously doesn't work, it tries left, that doesn't work. It then tries 2 frames ago to do the same. It keeps doing this, so it never really reaches the goal.          Does anyone know where to go from here? How to fix this? How does Mario AI do it? Any insight there would be extremely helpful!   Thank you for your time and really sorry the post ended up being so long!
  3.   I wanted to ask about this. Even if the moving object is moving inside one cell, how do I know that? How do I know when it needs to be reassigned to a new node/cell if I'm not constantly checking if it's still within its node?
  4. Thanks for all the replies so far!   To confirm, the game I'm working on is a 2D game.   So from what I understand there's really no one perfect solution that is going to fix everything, but combining all these different things to get the performance I need.   So I could implement quad trees, plus this "frustum culling" (which I'm guessing works just as well to 2D games as it does for 3D?)   I could also split my objects into "static" and "dynamic".   I could do as wintertime suggested, and have this sort of "probability" buckets, and not update some objects as much as others depending on how probable it is that they would be in the screen on the next update.   I'm using Lua with Love2D by the way.
  5. I have a small optimization problem in my game. If I have 10,000 objects in-game, but only 10 objects on screen (or no objects on screen), the game will lag, because what I do is I check every single frame, for every object, if the object is inside the screen or not.   So obviously as more objects are added, the slower things get. I thought about using some form of spatial indexing, so that if my camera is at (100,100), then instead of looping through 10k objects to know which are in-screen, I will simply ask my grid if there are any objects at 100,100, and do the same for neighbouring cells to get all objects inside the screen without ever having to loop, no matter if I have a thousand, or a million objects.   The problem, however, was that this doesn't account for moving objects, because if an object moves, I would have to check every frame if it has entered another grid cell or exited its cell.   So how do you detect which objects are inside the screen?
  6. Hmm deferred rendering looks interesting. It seems like it'd make the process of applying the lighting on objects much faster, but I still don't understand how it allows me to use more lights. I'm reading the article here: http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/deferred-rendering-demystified-r2746 [i]Afterwards, the lights in the scene are rendered as geometry (sphere for point light, cone for spotlight and full screen quad for directional light), and they use the G-buffer to calculate the colour contribution of that light to that pixel.[/i] I would still be sending light data somehow right? And that would be limited by how big I can make my array, or am I not understanding it right?
  7. I've got my lighting shader code. And let's say I want to have 10, 20, or 50 lights in my scene. Now the lighting code itself isn't very complex, it should easily be able to handle a lot of lights without too much trouble. However, just by declaring my array to hold 150 vec3's, I just get a black screen, presumably because my graphics card can't handle all that much? I was thinking a way around this would be to create an image at run time where each pixel represents the XYZ and intensity of the light as RGBA and send that instead to the shader. That way I could theoretically have a thousand lights with no problems. I haven't implemented this yet but I wanted to ask how other people handle stuff like this, or whether I should even be trying to send that much data to my shader. And how you normally optimize such things. Any tips would be appreciated! Thanks!
  8. I know there are a lot of topics asking about multiple lights, but I just have one simple question that I can't seem to find the answer to. So in order to support multiple lights, I loop over the lights, and add together the intensities of each light source (and things like color etc..) Now the only thing I'm having trouble with, is how to handle the dot product. I tried adding the dot products, but that just makes the two light sources sort of merge into each other, and when they are far apart the object is completely dark. How do I handle the angle/dot product for multiple lights? (I'm not sure if code is needed to answer the question, if so I'll upload my shader code). Thanks in advance!
  9. [quote name='Ashaman73' timestamp='1349933700' post='4988967'] Here's your modified code, including shifting the texture into [-1..1] and an ambient term without specular (only diffuse yet). [/quote] Thanks for taking the time to write that Ashaman! I still have a few questions though. I'm not sure I understand what's going on in this line: [CODE]vec3 normal = normalize(normalColor.xyz*vec3(2.0)-vec3(1.0));[/CODE] Actually..reading it again, this is the part where you convert it from [0,1] to [-1,-1] right? I'm assuming this affects the angle of the light? Because that seems to be what fixes everything. Also this line: [CODE]img_color *= mix(vec3(1.0) , dotProduct, ambientFactor);[/CODE] What's being mixed and why? And what's the purpose of that (1.0) ? Finally, the reason I was adding to the color instead of multiplying is that, when I multiply, the color of the material or the object seems to turn greyish as it darkens. Like it loses its color. Which makes sense. But if I add the color then, with some tweaks, it looks a lot better because the object's color just gets brighter, more towards white, and darker, towards black, without really seeming to lose its color. Do any lighting models add/subtract to the color instead of multiplying or is that just a bad idea? [quote name='MrOMGWTF' timestamp='1350196241' post='4989987'] Here's little code snippet for SH lighting: [/quote] Thanks for this as well! I'll try to implement that and post again if I have any problems.
  10. [quote name='CryZe' timestamp='1349876346' post='4988713'] The brightness should in the simplest case be proportional to the cosine of the angle between the light source and the normal. Not quite sure what you're doing as the code is unreadable with this forum bug [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] You might want to paste it directly without the code-tag, change the font to Courier New and you might also want to color the syntax a bit, to help the reader [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] [/quote] Yeah that's what I meant. After getting the dot product and normalizing I should have the cosine of the angle. I put up the code on pastebin: http://pastebin.com/W4UMH593
  11. Thanks for the quick reply Ashaman! [quote name='Ashaman73' timestamp='1349863121' post='4988661'] First off, your glsl haa no line breaks making it incredible hard to read. [/quote] Sorry about that, format messed up when I copied it. It should have line breaks now. [quote name='Ashaman73' timestamp='1349863121' post='4988661'] Then your left texture, what is it ? The diffuse map, in this case it would contain pseodo light information which will result in a weird look at the edges. [/quote] Well the texture on the left right now is the actual image of the object that I'm applying lighting too (since it's a 2D game). And the normal map has the RGB values that are the XYZ of the normal at each pixel as I understand. [quote name='Ashaman73' timestamp='1349863121' post='4988661'] [quote name='OmarShehata' timestamp='1349855361' post='4988633'] I'm told the Phong Reflection Model may be better suited in this case. [/quote] Better suited compared to what ? You should choose a diffuse model (ie lambert) and a specular model (ie phong or blinn). [/quote] Well..compared to what I'm doing right now. Speaking of which, everyone who looks at my shader code either says that my shading model is weird or incomplete, but it really makes sense to me. I mean, I'm getting the angle between the light source and the normal, and the brightness is proportional to that, shouldn't that work on its own? I was planning on implementing a well known light model but thought if I tried doing it myself first I'd be able to understand it better.
  12. So I'm trying to make a simple lighting effect. I have my normal map and my object posted below. [img]http://4urentertainment.org/storage/Tile.png[/img][img]http://4urentertainment.org/storage/Normal.png[/img] And my code in GLSL is written below: [CODE] uniform sampler2D normal; uniform vec2 mouse; uniform float Za; vec4 effect(vec4 color,sampler2D tex,vec2 tc,vec2 pc) { vec4 img_color = texture2D( tex, tc ); vec4 normalColor = texture2D( normal, tc ); float X = (mouse.x - pc.x); float Y = (mouse.y - pc.y); float Z = Za; float dotProduct = X * normalColor.r + Y * normalColor.g + Z * normalColor.b; dotProduct /= sqrt(X * X + Y * Y + Z * Z) * sqrt(normalColor.r * normalColor.r + normalColor.g * normalColor.g + normalColor.b * normalColor.b); float factor = dotProduct; img_color.r = img_color.r + factor; img_color.g = img_color.g + factor; img_color.b = img_color.b + factor; return img_color; } [/CODE] So basically I had a few questions: [b]Is my math correct?[/b] What I'm trying to do is get the vector of the mouse (the light source for now) to the pixel, and the normal of that pixel, and then get the dot product between them, normalize that, and that is the brightness factor. However the angle [i]seems [/i]to be a bit off. I just wanted to double check if my questions were all right because debugging on the GPU doesn't seem to be very easy [b]For the usual lighting methods, do you multiply by a distance factor?[/b] Naturally when a light is further away the object should be dimmer. But this doesn't seem to be the case with this approach. Should I just multiply by some arbitrary distance factor? Finally, I'm basically using 3D light for a 2D game. Although it seems pretty simple in the implementation though. I'm told the [b]Phong Reflection Model [/b]may be better suited in this case. Any thoughts on that? Thanks in advance! Any help or tips on anything would be appreciated!
  13. [quote name='Radikalizm' timestamp='1349203266' post='4986144'] [quote name='OmarShehata' timestamp='1349198786' post='4986106'] And it's written by the people that made LBP? [/quote] I'm not sure whether any of the authors actually worked on LBP, I know Naty Hoffman has worked for SCEA for a while but I have no idea which projects. I have a whole bunch of graphics articles lying around, but they're mostly for very specific topics [/quote] You can go ahead and post a few, I'll need them eventually.
  14. [quote name='Radikalizm' timestamp='1349176450' post='4986023'] [quote name='Ashaman73' timestamp='1349161696' post='4985976'] Even if your game is 2d, the math behind this kind of lighting is 3d. I would recommend the book [url="http://www.amazon.com/Real-Time-Rendering-Third-Edition-Akenine-Moller/dp/1568814240/ref=sr_1_1?ie=UTF8&qid=1349161532&sr=8-1&keywords=real+time+rendering"]real-time rendering[/url] for all the basic stuff, it is really good and will explain all you need to know about normal mapping. [/quote] Another vote for real-time rendering here, it's a must-have book for any graphics programmer, beginner or pro [/quote] Wow, that book looks awesome. And it's written by the people that made LBP? (Or is that just a happy coincidence that the character is on the cover? ) I'll definitely check it out. Anymore links/articles would be appreciated! Thanks! e to go through it eventually, but for now, I'll definietly ch
  15. I'm writing my game in Lua but I'm using GLSL for my shaders. So I want to add a little light to my game, but I have little to no knowledge about 2D or 3D lighting. Specular lights, normal maps, ambient occlusions..all that stuff, I have no idea how any of it works. So before diving into anything, I thought I'd ask if anyone had any good articles about delving into the matter, or a set of articles that explain the theory well. My game is in 2D and the end result that I would like to achieve is something like this: http://www.youtube.com/watch?v=s2FNf4h6Utg&feature=channel_video_title or this: http://www.youtube.com/watch?v=k3BwZAazWTo&feature=relmfu Any help, general tips and links would be appreciated. Thanks!