• Content count

  • Joined

  • Last visited

Community Reputation

300 Neutral

About slicksk8te

  • Rank

Personal Information

  • Interests
  1. OpenGL Modern OpenGL Transforms, HOW?

    Thanks for the help. I have tried instancing and it does mostly work for what I'm doing. Don't UBOs have a relatively low limit for max size? I'm guess I'm still unsure how AAA games are able to have so many meshes rendered along with things like particle effects What strategies are employed to reduce the number of draw calls and be able to maintain independent object transformation? I'm sure instancing is used for particle effects but I'm not sure how this is done in practice because there can be many emitters that (i.e. many explosions) die after some time. Would the buffer that contains the transformations have to be scraped and refreshed every time a particle died? I'm pretty good at getting an implementation together once I understand the strategies but I'm having trouble finding best practices on this stuff. There are many beginner tutorials our there but I can't seem to get information on how AAA does these things in practice.
  2. I have been scouring all the documentation, forums, and general internet searches for this question and I have found a bunch of half answers and I hope someone can help.   Now to the question.   Lets say I have 1000 objects that use the same mesh, shader, texture, etc. but they all have separate transforms (locations, rotations, scale). What is the best way to render this without tanking the frame time?   I am weary of instancing because there may be many different meshes in the future with different textures/state.   The slow way that I know of that is trivial to implement is to sort the geometry by state and make a draw call for each one and passing the transform matrix in through a uniform matrix. This does not work because DrawArrays is extremely slow and completely CPU bound. I have implemented this and know that this seriously destroys my frame time even with a couple of hundred draw calls.   I would like to use a single VAO for each object type, but how do you deal with transform data? The solution I have usually seen involves transforming the vertices on the CPU and then updating the VBO before drawing. It seems rather wasteful to do this on the CPU and resubmit the data because the GPU is sooooo much better at doing transforms in the vertex shader. This also may make the program CPU bound yet again.   Most explanations I have seen on how to do this always focus on rendering a few object per frame not hundreds let alone thousands. I absolutely know this is possible because i have seen many games pull off hundreds of objects. I know if there is a static environment then it is pretty easy to render because there should only be one transform for the whole environment if done right. That is pre-calculating the model space of a chunk or environment and then just moving the whole chunk or environment. The problem is dynamic objects. I only need a few hundred to about a thousand. I don't imagine that it can be this difficult.   I feel like I am missing something important and hope that i can get some information on how most games do it.   I have done a large amount of profiling and all roads seem to lead to reducing the number of draw calls, but I am having trouble determining how to do that with so many independent meshes with different transformation matrices.   Thanks in advance.
  3. Python Keyword Arguments for Config files?

    What type of use case are you looking for? There are many ways to handle configuration in python and each offers very different pros and cons but typically are good for specific uses.   Keyword arguments can be useful but I try to avoid **kwargs style syntax because it can make it difficult to understand what types of arguments the function can take.   I like to usually use properties + builders to accomplish configuration like the following: #useful for config files? #If the following variable is false, no camera will exist? camsOn=True class Camera(object): def __init__(self, **settings): self._settings = settings @property def all_settings(self): """Be able to get all settings and present them as a dictionary but is read only.""" return dict(self._settings) @property def mode(self): return self._settings.get('mode') @property def radius(self): return self._settings.get('radius') @property def focus(self): return self._settings.get('focus') @property def angle(self): return self._settings.get('angle') @angle.setter def angle(self, value): """An example of a setter but by default properties will be read only.""" self._settings['angle'] = value @property def frustrum(self): # This is a function so you can add any additional logic here. return self._settings.get('frustrum') def camera(**settings): if camsOn: return Camera(**settings) # Also could raise here if no camera is an error or the user should know about it. return None cam1 = camera(mode='PERS',radius=0,focus=(0,0,0),angle=(0,0,0),frustrum=0) cam2 = camera(mode='ORTHO') # the power of a function is that logic can be added cam1.angle = (23,68,79) print cam1.angle # FUNCTIONS def get_settings(cam): global camsOn if camsOn: for settings in cam.all_settings: print str(settings) + ' = ' + str(cam[settings]) else: print 'Can\'t get settings' return {} get_settings(cam1) print get_settings(cam2) I know classes seem overkill but they allow you to be extremely explicit and have defaults automatically specified as well as easy usage because there is no need to care if a particular setting exists or not. Also, properties allow "read only" values if you do not have a setter. And finally you can change the source of the configuration any time without changing any of the usage code because you have abstracted it out. For instance you could read this information from a file in the builder and pass it into the object and you would use it the same as if you just used a flat dictionary.   It all depends on your use case but in the method above you could have logic specific to the settings either in the property functions or the setter or the builder that creates the settings object.
  4. New to programming!

    Not sure if this is being monitored or not but I believe the op's question  was where to start with programming in general and then how to transition into game development.   You can pick virtually any programming language to start from but with the big caveat that some languages are harder than others to learn and for example C can have a pretty steep learning curve for more complicated programs.   I started in C and I believe it is a valid starting point but it is like starting in the deep end. If I was starting to program for the first time today, I would choose python. Of course this is a personal opinion and I believe that there are a lot of really complicated concepts that need to be learned when starting with lower level languages. Python however is more of a top down approach to programming rather than a bottom up.    I believe that the best way to learn to program and game programming is to just try things out. Higher level languages like Python allow this because it is really easy to get started and there is a lot of details that you do not need to worry about.   You really just need to learn a programming language and write programs to get used to the thought process and how to think about problems. Once you learn one programming language it becomes easier to learn more.   Hope that helps
  5. Text Based game Types

    Ohh totally forgot about dwarf fortress! That actually brings up an interesting thought of what constitutes a text based game. Is it the input method or the presentation layer? Or maybe some other criteria. But some good input so far. I didn't even think of the sim route.
  6. Text Based game Types

    Did you display a map? I can see how a turn based game you could use commands like "invade saturn with 10 armies"
  7. Text Based game Types

    After a bit of searching on the internet, I have found only a few different types/genres of text based games but I am wondering if there is any other possibilities for this medium.   Currently I have found the following: Adventure games (mostly like zork) Roguelikes Card/table top games I feel I must be missing a large amount ( and probably oversimplifying many of these as well  ) because the game industry is really creative about pushing a medium to its limits.   If you have any examples/thoughts of text based game types/genres, I would greatly appreciate it.
  8. Need a little help with text game

    If I'm understanding you correctly, you would like to load a file from a string rather than a digit, that is you would like to load "b.txt" instead of "1" or some variation of that. To do this you can change: [source lang="cpp"]fgets(file, "%d\n", &locsToGo[t]);[/source] to load the a string into locsToGo instead of an int. The declaration of locsToGo would be: [source lang="cpp"]#define FILENAME_LEN 10 char locsToGo[100][FILENAME_LEN];[/source] Hope this helps and good luck with your text game.
  9. While loop trouble

    I'm Unable to see the second part of the code. I had this problem before, try an replace all <= into < because the code tags break when they see <= for some reason. It is also better for help_credits to be compared to zero like this: help_credits <= 0 because this is safer than help_credits == 0. I'm going to have to see the rest of the code before I can tell why it is unresponsive.
  10. Sednihp is right you should not have the unit controlling the particle but the particle system. Once it is spawned the particle should not need the the emitter at all. This is the best way to implement it and how professional particle systems work.
  11. While loop trouble

    Yes you need to follow this format for this to work correctly: [source lang="python"]#Initialize here while True: #Some code can go here while game: # First while loop code here # Transition code here while elect_new: # Second while loop code here # More Transition code here[/source] If you do not have an outer while loop, it will not return back to the first loop.
  12. While loop trouble

    From what I understand now both while loops are not inside an outer loop are they? If they are, ensure that the code loops back around to the beginning and that p is above 15. If not you need a while loop that wraps around both inner while loops. The reason why I suspect this is because you have no indent in front of your while loops in your pasted code. Did you remove the indentation when you pasted the code?
  13. While loop trouble

    It is possible that it is always going to the second while loop because of this: [source lang="python"]if p < 15 and y == 1: game = False elect_new = True[/source] (There is a weird glitch with this code block, if i use "p <= 15" it fails to display so assume it is "p <= 15" instead of "p < 15") Is this code supposed to be evaluated every loop iteration? What is the initial value of p? This code is evaluated every iteration and if p is initialized as <= 15 then this will evaluate true almost immediately because y is determined by: [source lang="python"]y = random.randint(1, 3)[/source] Which is also evaluated every loop and because the loop time is really fast, as in < 10ms (this may be faster because you have no sleep/fps timing), y will be 1 in about 3-4 loops. so it would take about 30-40ms to evaluate true and jump to the second loop.
  14. I would expect that particles are completely self contained. That is once they are spawned they would not need to reference the Unit again in its lifetime. For instance if the unit fired, it would spawn a particle in the particle system with its position and the particle system would manage it completely after it was initially spawned. Why does the particle need a reference to the Unit again? What kind of data do you need from the Unit?
  15. While loop trouble

    What is the scope of this code? That is, is it in a function? Script only? Also,where is game declared because if it is initialized as false then it will skip the first while loop. You are also only rendering in the first loop whenever the user presses enter as seen below: [source lang="python"] for event in pygame.event.get(): #the pplrty determiner if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: year += 1 # Drawing/Reaction code here... pygame.display.update()[/source] Is this intended? Does it catch any of the inputs? That is, have you tried this: [source lang="python"]for event in pygame.event.get(): #the pplrty determiner if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: print "RETURN Key Hit."[/source]