• 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.

StasB

Members
  • Content count

    51
  • Joined

  • Last visited

Community Reputation

144 Neutral

About StasB

  • Rank
    Member
  1. Hi! My question is pretty simple: What are some good ways to generate random N-dimensional gradients for Perlin noise?
  2. OpenGL

    I didn't know texture coordinates had Z and W components. I think I get it now. I guess I should do some more reading about how OpenGL works. Thanks, guys.
  3. OpenGL

    I don't understand. Getting the texture coordinate for a world vertex involves a division by the distance from the projector's near plane. That's a non-linear function. =S
  4. I need to project some textures to simulate sprite shadows but I can't wrap my head around how it's done in OpenGL. From what I understand, for each vertex of the projection surface, I need to calculate the coordinates on the projected texture and let OpenGL interpolate them automatically. This doesn't quite make sense to me because the interpolated function isn't even linear since it's basically a perspective projection. Pic related: [img]http://i.imgur.com/TFQ3F.png[/img] I'll be glad if someone could explain. Thanks. =)
  5. [quote name='Murdocki' timestamp='1331309022' post='4920696'] If you're going for a higher level graphics engine you should not think about how to wrap OpenGL. Instead you should think about how you'd like to make the calls to render something and then fill that in by using OpenGL. You might need a few iterations of adjusting requirements due to api specific limitations but you'll end up with a system that's easy to use, which is one of the most important things for anything high level. To answer your question, my glBindBuffer calls are checked in the implementation of the Renderer class just by comparing ints like suggested by the poster above. I'm not doing this in the state manager because i've defined that to be managing render states like cullmode, blend mode, alpha testing etc etc. I gues you could do that in the state manager aswell, it doesnt really matter. On a side note, maybe managing glBindBuffer calls isn't your biggest problem if you're worried about redundant state changes performance loss. Other state changes like shader and texture binds will probably be a lot more expensive and your buffer count will be very low when you've implemented batching. [/quote] What's wrong with an intermediate layer to ease up the task of writing a higher-level engine? I have no intentions of writing a big general-purpose graphics engine. If I wanted one, there are many available. I write small apps with widely varying requirements that don't usually fit a standard engine architecture and I find myself writing over and over again heaps of OGL code to handle low-level tasks like setting up and rendering FBOs, VBOs etc.
  6. [quote name='Yours3!f' timestamp='1331305753' post='4920683'] well, while wrapping the whole api is possible, in my opinion its rather pointless. You might want to write a state manager as suggested, but I think that you shouldn't wrap everything, but rather certain functionality (mesh loading, texture loading, shader loading etc.) which enables you to use OGL without making a single error, because the wrapper class takes care of it. for ex. you could say that the current buffer stored would be: struct buffer_state { GLuint buffer; GLenum target; } current_buffer_state; and you could implement a function that checks if the current buffer bound is the one you pass to it, and in that case it wouldn't call the OGL function: void my_bind_buffer(GLenum target, GLuint buffer) { if(current_buffer_state.buffer != buffer || current_buffer_state.target != target) //check the current state { if(glIsBuffer(buffer)) //check if it is really a buffer { glBindBuffer(target, buffer); } } } or something like this... you might want to check out pixellight for a whole api wrap example. when your app starts up you could just simply query the current gl state with glGet* to initialize your states [/quote] Basically, here's my problem: I need to write my own versions of the OGL state-setter functions I care for that check for redundant state changes. Some of those functions take a parameter that specifies which state to change, like glBindBuffer. Ideally, if I write a glBindBuffer wrapper, it better act like the original, accept a target parameter and handle it correctly. How do I do that without manually writing special code for every type of target?
  7. [quote name='Murdocki' timestamp='1331302390' post='4920669'] Yes it's possible, it's called object orientation. You create classes with specific responsibilities. This will add a very tiny mini overhead but it's more than worth it. The trick is to pull your classes to an as high as possible level of abstraction without creating overly complex class responsibilities. For example, who sais you're using VBOs, maybe you've just got some vertex data that needs to be rendered however the implementation sees fit. To counter the state changes you might end up with a state manager which only changes state if it is required. [/quote] I thought it was clear from my OP that object orientation is what I'm trying to achieve. I'm just worried about the performance penalties from redundant state changes. I just want a thin and convenient layer on top of plain OpenGL to ease up the task of writing a higher-level graphics engine. I thought about making a state manager, but I'm not sure how to go about it. How would you go about wrapping "void glBindBuffer( GLenum target, GLuint buffer)", for example?
  8. I'm tired of my code being littered with verbose GL calls. I've been wondering if there's any way to wrap things up in small classes without a serious loss of performance and generality. For example, if I want to have a VBO class, every member function that does something with a VBO needs to make sure it is bound first. If I want to render it, I need to make sure all the client states (e.g. glEnableClientState(GL_VERTEX_ARRAY)) and pointers (e.g. glVertexPointer(...)) are set up correctly. The only robust way to do that is to set all relevant global state in every member function call, even when it's unnecessary. Wouldn't all this state-changing cause some serious performance issues?
  9. It doesn't matter what _you_ are naturally inclined to consider. It's not a language-specific detail. It's the basic precedence rules of math, which, naturally, any sane programming language obeys, be it is C-like or not. This has nothing to do with memorizing programming language rules. Your post makes no valid points or any sense. Sometimes, there's some benefit from using brackets merely for clarity. Not in this trivial case. End of story.
  10. @allMadeFromCode: I'm confused... Isn't there a whole bunch of possible angle\velocity combinations to hit a target? @Fenrisulvur: Quote:It's not at all good practice to rely upon the order of operations imposed by a language when implementing these things. It's less readable since people typically end up having to consult some sort of reference to remind themselves, and it's a great way to introduce non-trivial bugs into your code. I see no real problem with relying upon the operator precedence defined by _math_. Last time I had to consult a reference to remind myself about it was in elementary school. By your logic, why stop at turning A / B * C into (A / B) * C? Maybe we should also turn A + B + C into (A + B) + C? =|
  11. Performance-wise, you have nothing to lose by using hierarchies... Unless, of course, your characters are more likely to overlap than not. The question is whether you have anything to gain. Personally, I kind of doubt it. Anyway, you know what they say: premature optimization is the root of all evil. Go get something working. If it's not fast enough, then start thinking about it.
  12. First of all, what exactly are you interested in? Collision detection (checking whether two polygons collide), or collision response (separating two colliding polygons and making them bounce off each other)? In any case, your reference has little to do with polygon collision... You might want to read this: Separating Axis Theorem Explained
  13. Well, your algorithm is definitely faster than what I originally had in mind, but consider what happens when you randomly pick a small star that has some big stars around it that are "illegal"... They will be erased and their space will be wasted, even though you could fit smaller "legal" stars in there. You could run out of space and end up with less stars than you wanted, even though you have clearly visible empty spaces where starts could fit... At least in theory...
  14. Not sure what you mean, but glad I could help. =P
  15. Completely fill the grid with random stars. Randomly pick N of them. This algorithm depends only on the number of cells. The simplest and cheapest solution.