http://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-graphics-pipeline-2011-index/ http://mrelusive.com/books/books.html http://fabiensanglard.net/Computer_Graphics_Principles_and_Practices/index.php http://gameprogrammingpatterns.com/ http://nand2tetris.org/ http://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution–gamedev-6331 http://blogs.msdn.com/b/davrous/archive/2013/06/13/tutorial-series-learning-how-to-write-a-3d-soft-engine-from-scratch-in-c-typescript-or-javascript.aspx http://www.reddit.com/r/gamedev/comments/2fkefu/the_software_rendering_club/
http://www.reddit.com/r/gamedev/comments/22djip/juice_or_lose_it_entity_component_system_questions/ https://github.com/rodrigosetti/azteroids https://github.com/alecthomas/entityx
http://www.reddit.com/r/gamedev/comments/238z3e/any_good_resources_for_glsl_shader_techniques/
vassal module has all the images
http://heroquest.no-ip.com/advancedheroquest/index.html
http://www.yeoldeinn.com/na-index.php
http://www.reddit.com/r/gamedev/comments/23c7lx/i_gave_a_lecture_on_constraintbased_physics_and/
http://roguelikeeducation.org/9.html
http://bost.ocks.org/mike/algorithms/
http://www.reddit.com/r/gamedev/comments/23l7yx/learn_all_about_color_selection_and_using_color/
how big are mine?
http://www.effectgames.com/demos/canvascycle/?sound=0
for rapid prototyping
4x8 - http://www.omnimaga.org/index.php?topic=3692.0 8x8
http://legendsoflocalization.com/media/final-fantasy-iv/baron/fonts.png http://www.reddit.com/r/gamedev/comments/1rl412/favorite_free_8bitpixel_font/
http://meatfighter.com/nintendotetrisai/9.png
(where it goes back to earlier system states)
582 ./gb/lib/godel.rkt 60 ./gb/physics/cd-narrow.rkt 45 ./gb/ai/path-finding.rkt 39 ./games/maze/main.rkt 28 ./gb/lib/korf-bin.rkt 17 ./gb/physics/cd-broad.rkt 10 ./exp/bsp-space.rkt 8 ./gb/lib/srs.rkt 7 ./gb/sys/menu.rkt 5 ./gb/lib/meta-q.rkt 3 ./exp/godel-lambda.rkt 2 ./exp/des.rkt 2 ./gb/data/fvector.rkt 0 ./exp/gen-stlc.rkt 0 ./exp/wide.rkt 0 ./exp/fern.rkt 0 ./exp/openglbook-2.1-geom.rkt 0 ./exp/prng.rkt 0 ./exp/ena.rkt 0 ./exp/system-select.rkt 0 ./games/tennis/main.rkt 0 ./games/rpswar/random.rkt 0 ./games/rpswar/fst.rkt 0 ./games/rpswar/main.rkt 0 ./games/rpswar/graph.rkt 0 ./games/maze/map.rkt 0 ./jake/main.rkt 0 ./tools/log-display.rkt 0 ./tools/texture-atlas.rkt 0 ./tools/sprite.rkt 0 ./tools/sprite-digest.rkt 0 ./tools/make-font.rkt 0 ./gb/lib/math.rkt 0 ./gb/lib/performance-log.rkt 0 ./gb/lib/godel-seq.rkt 0 ./gb/lib/tr-cheat.rkt 0 ./gb/lib/ffi.rkt 0 ./gb/lib/component.rkt 0 ./gb/lib/ffi/vector.rkt 0 ./gb/lib/skal.rkt 0 ./gb/lib/pi.rkt 0 ./gb/lib/random.rkt 0 ./gb/lib/lagrange.rkt 0 ./gb/audio/3s.rkt 0 ./gb/audio/openal-path.rkt 0 ./gb/audio/openal.rkt 0 ./gb/gui/os.rkt 0 ./gb/gui/world.rkt 0 ./gb/gui/fullscreen.rkt 0 ./gb/meta-help.rkt 0 ./gb/input/controller.rkt 0 ./gb/input/joystick.rkt 0 ./gb/input/keyboard.rkt 0 ./gb/graphics/gl-util.rkt 0 ./gb/graphics/ngl.rkt 0 ./gb/graphics/r.rkt 0 ./gb/graphics/texture-atlas-lib.rkt 0 ./gb/graphics/ngli.rkt 0 ./gb/graphics/crt.rkt 0 ./gb/graphics/string.rkt 0 ./gb/graphics/font-lib.rkt 0 ./gb/graphics/ngl-main.rkt 0 ./gb/data/mvector.rkt 0 ./gb/data/lifo-heap.rkt 0 ./gb/data/fmatrix.rkt 0 ./gb/data/psn.rkt 0 ./gb/data/ltq.rkt 0 ./gb/meta.rkt 0 ./gb/main.rkt
http://www.reddit.com/r/gamedev/comments/1rucwe/150_platformer_bricks_licensed_cc0_to_use_in_your/ http://www.reddit.com/r/gamedev/comments/1sb5dd/280_tiles_licensed_cc0_that_go_together_with_350/ http://www.reddit.com/r/gamedev/comments/25121d/over_220_tiles_licensed_cc_zero_for_rpgtype_games/ http://www.reddit.com/r/gamedev/comments/267kq4/completely_free_to_use_virtual_boardgame_assets/
(Kenny is amazing)
http://indiestatik.com/2014/06/03/free-indie-game-ui-resources/
http://quale-art.blogspot.com/p/scroll-o-sprites.html
http://oryxdesignlab.com/ultimate
http://forums.tigsource.com/index.php?topic=8970.0
http://www.fileformat.info/info/unicode/block/miscellaneous_symbols_and_pictographs/images.htm
New one: http://opengameart.org/content/platformer-art-deluxe http://www.reddit.com/r/gamedev/comments/1kjnj4/380_platformer_tiles_and_sprites_pixelart/ http://blogoscoped.com/archive/2006-08-08-n51.html http://www.glitchthegame.com/public-domain-game-art/ http://www.reddit.com/r/roguelikedev/comments/1xdlrd/dawnlike_16x16_universal_roguelike_tileset/
Tutorials: http://www.pixeljoint.com/pixels/tutorials.asp http://finalbossblues.com/pixel-tutorials/
http://zerowidth.com/2013/05/05/jump-point-search-explained.html
http://www.redblobgames.com/pathfinding/grids/algorithms.html
http://www.codeandweb.com/texturepacker/documentation#layout
http://www.gridsagegames.com/blog/2014/03/particle-effects/
https://developers.google.com/games/services/web/gettingstarted
http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/
https://www.youtube.com/watch?feature=player_embedded&v=la3coK5pq5w
NES audio channel explanation
https://ccrma.stanford.edu/software/snd/ https://ccrma.stanford.edu/software/cmn/
http://www.reddit.com/r/gamedev/comments/1kurzi/8bitjs_audio_library_write_music_using_8bit/
http://www.shlzero.com/wordpress/?page_id=4
http://www.bfxr.net/ http://www.gridsagegames.com/blog/2014/05/sound-design-cogmind/?utm_source=rss&utm_medium=rss&utm_campaign=sound-design-cogmind
would it be better to just have elementary shapes and no textures ever, except for fonts?
And enable slow-down?
(make the FST bigger, make the tennis list longer, etc)
Like what the equipment/etc configuration was in JRPGs, so it can be re-presented if it needs to be modified
Using streams
https://mail.google.com/mail/u/0/#inbox/13e67b9634c39a5b
For viewing a replay or other data
frames score how many balls in the air how many pellets did you beat the level?
https://mail.google.com/mail/u/0/#inbox/13dd1b029d348da5
Also, if you try to bring the paddle to the top, it doesn’t draw the whole way
At the very least, I should be able to have fully opaque or fully transparent texture colors and get it to work. It is possible that I will have to call discard() in the fragment shader to ignore the effect on the depth buffer of the fully transparent texture
Ideally, I’d be able to draw every sprite from back to front and get perfect transparencies.
It might be more feasible to make layers something NGL knows about and have it draw each layer into a separate screen-sized texture that are all blended together afterward. (The SNES had only one layer that could be transparent over the others.)
Also, here’s another idea that uses front-to-back drawing order: http://my.opera.com/Vorlath/blog/2008/01/15/opengl-drawing-2d-transparent-objects-front-to-back
Investigate this.
Right now I only support fully color or fully texture. It would be nice to support a tinted texture
http://www.reddit.com/r/programming/comments/2102jt/opengl_approaching_zero_driver_overhead/
And perhaps cull slightly wider than that the screen because I believe culling happens before geometry shaders (?) so I need to make sure the point is in the cull
[Not relevant until I have games with relative layers]
It already has a nice shader system, input api
The main problem seems to be that it would make it so I can’t use OpenAL directly, because you need to return audio data per frame
List the URL, a checksum, and then have the tool download them if they aren’t there and verify if they are.
Make a critical region system call that gives a process sole access to the system… leaving the other processes stalled with their last writes persisting from frame to frame
This might be a good way to implement “friction” or “bullet time” as well as other effects, like menus.
Just an idea. Might be a bad idea?
tennis - shake the screen on bounce, gas pedal on paddle for speed, decreasing increasing rate of ball speed growth, add blocks like arkanoid?
Replay = (random seed, level, controller stream)
(so that you don’t get too much credit if you don’t actually win, even if you did better than before?)
Or mimic the Wii interface
1P, 2P Round-robin, 2P VS, 2P Co-op, etc
Single, King-of-the-Hill (play levels that your score has been beaten on), Training (improve your score, SRS style), Round-Robin (play all games)
Have it so you can highlight games to be played that way
Or other stingers, but worry about being too annoying and not instant restarting
Should I display all points: this session / this game / all games?
http://indiegames.com/2012/05/juice_it_or_lose_it_-_a_talk_b.html
https://github.com/grapefrukt/juicy-breakout
http://www.youtube.com/watch?v=tVLb-I5i5ys&feature=youtu.be&a
gettext
Virtual, Rotate Left, and Rotate Right
For example, the score display is absolute, but the game is relative (my games don’t use this concept yet)
http://revel.sourceforge.net/docs/html/revel_8h.html#a30
See libretro or retroarch
And maybe use Cg rather than GLSL
http://kometbomb.net/2008/07/23/collision-detection-with-occlusion-queries-redux/
https://www.youtube.com/watch?v=fsbECSpwtig
http://robotloveskitty.tumblr.com/post/33164532086/legend-of-dungeon-dynamic-lighting-on-sprites
http://www.redblobgames.com/articles/visibility/
http://www.reddit.com/r/gamedev/comments/205r78/sight_light_how_to_create_a_2d_visibilityshadow/
Let’s play money making game
http://meatfighter.com/nintendotetrisai/
http://www.redblobgames.com/articles/probability/damage-rolls.html
http://www.redblobgames.com/articles/noise/introduction.html http://devmag.org.za/2009/04/25/perlin-noise/
https://github.com/jpverkamp/noise
http://www.roguebasin.com/index.php?title=Basic_BSP_Dungeon_generation
http://www.gamasutra.com/blogs/TanyaXShort/20140204/209176/Level_Design_in_Procedural_Generation.php
http://bytten.net/devlog/lennas-inception/
https://github.com/tcoxon/metazelda
https://github.com/mizipzor/roguelike-dungeon-generator
http://www.reddit.com/r/gamedev/comments/283bs5/an_examination_of_walljump_systems_across_blood/
http://www.reddit.com/r/gamedev/comments/1f9l62/visual_mml_a_text_music_editor/
Hook up with an emulator core to drop into a game with save states and then monitor its execution for score, etc
Can you beat this Mega Man stage with one life?
How fast can you do X in this game?
Wrap this in a package that switches from game to game like I want… it may be perfection
Use Zhiqiang Lin’s work on data path recovery analysis: http://www.utdallas.edu/~zxl111930/
Like Punch-Out!!!
Five “buttons”: punch left/right, dodge left/right, block. The upper quadrants for punching, the bottom for dodging, and the middle for blocking.
Randomly generate winning sequences of input, then from them determine what the bad guy does… for example if to win you dodge left, then he should punch right.
After going through this sequence, it just repeats.
Manually design 10 or so cues that indicate an upcoming action (like twitching eye brows, shaking, hand/leg shuffle, etc)
Aim for completing a match in 1 to 2 minutes
Shake the phone to get up
http://www.cs.cmu.edu/~tom7/mario/
Use A* or BB to discover optimal playthroughs
There are very few NES games that are awesome and the SNES is so great.
Plus a tiling manager Plus a “video game console” shell
First experiment, 2012/07/01 failed… got a slower frame rate. I think the key is to make it just a future during the time that GL is rendering.
Will the GLSL compiler do it anyways?
premature optimization
premature optimization
(Probably not useful, because I hit very high frame rates even when updating vectors thousands of elements long)
This could be based on a block cipher with unbounded key length and bounded block size
https://code.google.com/p/grafx2/ 2013/03/08 - I submitted this patch 2013/03/08 - I did this and need to integrate it with tennis and maze There is a use in tennis that would be fixedAnd maze uses it for the background music
A lot of people online seem to suggest it is bad to use the Z buffer because of transparency issues. Strange.Now use it
Render to a buffer and then display the buffer? — Take the SNES w x h and make it wider, see exp/wide.rkt — Maybe use bsnes’s snesshaders to do the scaling?http://filthypants.blogspot.com/2011/05/more-emulator-pixel-shaders-crt-updated.html
http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-2.2:-Shaders.html — Hopefully this will make planning and text better – I’m using exp/buffer.rkt to experiment and it is MESSED up.
In this case, I’m not sure it is a good idea, because we already use a 16:9 frame and it is convenient to imaging that the 1x1 boxes in the maze are the real thing and the 16x9 pixels are just the display It was a problem with depth. Annoying. I’ll have to revisit depth later. SNES style D-pad is booleans Have another right interpretation of dpadGet a USB snes controller for home
Making a texture is slow. Maybe with character-based string textures it would be faster?Maybe just log data and look at it afterward?
I don’t know if I really am measuring this correctly… see OpenGL wiki
Decided to show it in the window label
I have begun experimenting with this a lot.–Why–
This FAQ says that OpenGL doesn’t accelerate the fixed-function pipeline any longer. This StackOverflow question suggests a general structure. (This one also talks about the same stuff.)
–Plan–
My original plan was to have a single vector input to the shader that was something like:
Translation: XY Scale: XY (relative to the sprite, not the scene) Rotation: Theta (relative to the sprite, not the scene) Color: RGBA Rectangle: WH Texture: XYWH
where the vertex shader would move the basis of the vertex, which is 0,0 to the translated point, where it would then be scaled and rotated.
the geometry shader would take this input and output the various vertexes for a rectangle (this site talks about you need 6 for GL_TRIANGLES but only 5 for GL_TRIANGLE_STRIP, but I don’t know if you can do that in a geometry shader)
the fragment shader would take the texture coordinates and grab the pixels, blending in the color. For most sprites, I would set the color to blank-ness and for opaque boxes, I would set the texture coordinates to a blank place.
I hope this will allow me to have a single draw call.
– Populating it –
My plan is to populate this vector by first, sorting the sprites into their layers with the background towards the front of the array. (My assumption is that background layers change less so it will make the vector more stable.) The game would return, basically, a list of rows of this vector and the engine would map through them. However, it would keep track of what the previous lists were and if they were eq? and in the same order, then they would not be set! to decrease memory traffic.
I would assume that most translations, scaling, or rotations are not stacked, so it is safe to compose them on the CPU.
– Texture Atlas —
Additionally, I would have a single texture for all sprites in the game that was always available. This is called a Texture atlas. My idea is to write a library that scans the directory Get Bonus is in for all PNGs and stitches them together in a lossless way, doing something basic for limiting the area, with the opportunity for optimization later. This library would run at the start of every startup and find the list of files and their checksums and see if the cached PNG is still up to date. Similarly, this same program would create PNGs for fonts.
I’m imaging an interface like
texture-coords : path -> coordinates
where the path would be relative to the Get Bonus directory and then the coordinates would be in the atlas that was constructed.
I’d write a tool that would rip sprite sheets apart into their pieces.
– Notes –
I’ve decided to go with Cg rather than GLSL directly, because of its separate compiler, seems to have good optimization technology, etc.
Most of Nvidia’s materials seem to be very good (particularly the manuals and examples that come with the toolkit.) Here’s another source for tutorials.
My current development machine is limited to OpenGL 3.2, which is relevant to developing with Cg. I’ve written a basic FFI for Cg with just what I need. It would be nice if there were spec files like RacketGL uses for OpenGL.
– Problems –
First, my idea for the layout will be complicates because glVertexAttribPointer function can only give vertexes with 1 through 4 elements, not this many. I might able to do it as one big thing anyways, by using strides and multiple attributes. (I could even do a different attribute for each piece.)
Second, I don’t totally understand the capabilities of geometry shaders. Essentially what I’m doing is telling OpenGL that there is only 1 “vertex” but then I’m expanding it into 6 by the geometry shader. (In the call to glDrawArray, will I put in the number of objects, or the number of objects times 6? Probably just the number?) This tutorial might be a good place to start. (Also, there are a few examples in the Nvidia CG toolkit.)
Third, my initial attempts at following this tutorial to get things up in running (exp/pipe.rkt) has failed with my three rectangle example. First, rectangles don’t show up at all. Instead, a triangle does. There’s also a problem that only one triangle does—the front most one. Second, they aren’t appearing in the place that I expect them to. I think this FAQ question is a piece of the answer. I think I should start from scratch and adapt his example directly (to compare the drawings, for example) and go from there. (This is another tutorial that may be useful.)
I’m not totally certain about what the right thing to do with the blending between alpha, the color, and the texture color. Here’s a thread that might have information. I also think I need to use (glShadeModel GL_FLAT) so that the color isn’t interpolated.
This is a very frustrating thing to be doing. I feel like a 142 student.
– Useful paths –
CG documentation — /usr/share/doc/nvidia-cg-toolkit CG examples — /usr/lib/nvidia-cg-toolkit/examples/OpenGL
I had to install nvidia-cg-toolkit from Nvidia directly (Cg-3.1_April2012_x86_64.deb) because the Ubuntu one was broken.
– Further investigation –
I transliterated the code from the tutorial into Racket precisely, including using GLUT and everything. However, it is black. I originally assumed this was because of GLEW, but when I disable GLEW in the C code, it works, but not in my code. Mysterious.
I used ‘apitrace’ to determine that the OpenGL calls the two programs were making were literally IDENTICAL. Still, they display differently. My current guess is that the vertex arrays are being populated differently.
After doing some tracing on the C side, I see that the bytes in my vertex arrays are different than the ones on the C side. Yet, I’m using f32vectors, which are supposed to be _float arrays. Weird.
ARRRRGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHH
I mixed up the sign on a vector coordinate. The byte difference was just an error in printing on the C side.
Alright, now that I have a working program, I have to go back to being in racket/gui or accept my new GLUT overlord. Or maybe GLFW?
— Progress 09/01 —
I’ve switched away from GLUT from the tutorial and switched to using Cg (seems like a good idea in some ways, performance and expressiveness, but a bad in others (less documentation it seems.))
I’ve started to work on my custom shader. I’ve got it generating a quad from a single point (with six vertices).
My next task is to work with textures. Right now I have the information being passed along, but I need to have three things: flat color quads, flat textured quads, and textured quads with a color blended on top. I think I will test with the Pac-Man sprite sheet. I think I need those examples before I can really try to write the code.
— Progress 09/02 —
Today I switched back to GLSL after reading about some problems with Cg and failing to get triangle strips to work. I find it really weird and annoying to write three files though, where the names of identifiers have to be the same. It’s strange. But after I did the transition, then I was able to get the triangle strip working, so now I’m just generating 4 vertices, which is nice. Next up is texturing, which I’ve done a bit of.
— Progress 09/03 —
Basic textures are done. A few more things to do though. Changed the texture coordinate representation. Got indexed textures to work, but there’s the annoying magic number length in the vertex shader. And I don’t like the way I did it, but eh. What can you do? Just did rotation and scaling on the sprite level. Dramatically increased number of sprites to benchmark. 500 @ 60 FPS with just a transfer of the entire transform array. I tried to optimize by caching values and moving things into the vertex shader, but it did nothing. I wonder if geometry shaders are slow? I’m also interested to find out if rendering at the lower resolution would be better. I think I shouldn’t worry about performance until after I apply it to the games.
I tried to remove the Geometry Shader to improve performance. The first idea was to use Instanced drawing and draw 4 instances for each sprite (one for each corner); unfortunately, instancing is for meshes, not for vertices, so I couldn’t use the instance id to identify the corner and assemble them together. So that failed.
Next, I tried to generate 4 vertices per sprite on the CPU, but with all the exact same positions and then a uniform that contained which corner the vertex corresponded to. The first problem with this was that TRIANGLE_STRIP tries to connect every single sprite together, which is wrong. So, I changed to use glMultiDrawArrays with big s32vectors to identify the start of each strip. This was miserably slow.
My next idea (not yet implemented) is to use glDrawElements where the indexes are always 0…LastSprite and the indexes are just the center positions and I still use a uniform to identify the corner. And I would use glPrimitiveRestartIndex to restart the strip up again.
— Progress 09/07 —
I implemented the glDrawElements with glPrimitiveRestartIndex and got 3 FPS with 1024 sprites. After going to a triangle-based rendering (so, six vertices per sprite), I was able to get 15 FPS with 1024 sprites (on my full laptop screen). 512 sprites is only 20 or 30 FPS (slower than the geometry-shader based version.)
When I added rotation, the performance didn’t change. But when I added scaling in the shader it INCREASED! I can reliably do 1024 sprites @ 30 FPS and 512 sprites @ over 60 FPS.
Doing the corner calculation of hw/hh slowed it down to 30 FPS. So I reverted it. Same with a corner calculation of the tex coordinates, which means the index is pointless. I’ve now removed some of the extra stuff that supported all these experiments (the corner vertex array and the texture atlas index uniform. Didn’t seem to have any effect on performance, but memory usage is down.) Now the shader is pretty dirt simple.
After all this, I went back and checked out what the situation was with the geometry shader version that did everything on the card… and it gets the exact same performance. Argh! And it uses less memory to upload the scene!
I think it is time to just implement this for the games and see what happens.
Later that day I turned on depth testing and got super fast performance. Basically before I was drawing every single sprite over previously drawn ones, which cost a lot of time. Now the GPU can ignore “background” sprites that are covered. This will influence what order I sent them to the card and how I do blending/transparency/ etc. But I get insane performance, so it is probably worth it.
NGL - Pre-generate texture files for every letter in the alphabet for a font at a certain pixel height.
Or just make the cutting up tool better (probably a better solution)
There’s no reason to have them all the same width, just the same height. Should work for an ffi/vector, including copying from old to new. Doubling when you go over the limit. Make it its own program and part of Jake file Perhaps use parameters for the current translate/rotate/scale, since the shader has no stack. For now, this should have layering built in. Then only scaling will be interesting, w/h will come from the texture atlas. But at that point the atlas should contain pixels rather than UVs and I’ll have to the adjustment math on the GPU. Investigate this. Rather than using define-textureAnd optimize given that I won’t be using the indexing system
My games rely on a different resolution than the actual screenOr, have layers in “absolute” or “relative” coords
There are blurriness (the next sprite?) on the edges(2 * i + 1) / (2 * n) ?
Maybe change the texture mode to not blur?
Can’t use integers in fragment, because it’s not a flat shade
I tried to switch to POW-of-2 texture atlases… the code is simpler, which is nice and the blurring is not so bad, but it isn’t fixed. I think this is a good change though, because I know I’ll never have floating-point representation weirdness.
I was able to get around this quite a lot, but it is still a bit messed up, because the bottom of the sprites is being chopped off
That’s why my demos have to make tons of sprites for them to show up (try just drawing one, two, three, four, etc, to test) By using char->integer I changed from using the “shelf” algorithm to the power-of-2 tree algorithm. The code in the texture-atlas is much nicer, although the actual pow2-bin-pack is pretty whack. It turns out that this is a worse implementation:- Original “shelf”: 180K
- Pow2 smallest-to-biggest: 192K
- Pow2 biggest-to-smallest: 188K
But I think I will keep it because I prefer it.
What I would like to do in the future is:
- define a better interface to different bin packers, so I can keep the texture atlas code in its current beautiful state.
- use the above (and below) implementations (plus maybe the NP complete one?
- find the best or try each of them and select the smallest.
I made the interface and ended up implementing this:
http://www.codeproject.com/Articles/210979/Fast-optimizing-rectangle-packing-algorithm-for-bu
And I got down to 160K! I think it is probably basically optimal!
I’ll leave these ideas here for the millennium:
http://clb.demon.fi/projects/rectangle-bin-packing
or just use Nvidia’s tools
(See gb/main’s menu)I think maybe the korf layout is off by one? (But my demo looks fine)
NGL - Use a cstruct so there is a single vector to manage (and send the vertex attrib arrays with strides)
Going with a big f32vector instead
It is much nicer to use floats everywhere for other reasons.
In case there is just a fragment, vertex, etc (see bsnes examples) Because by using Z buffer for layers, translucent pixels don’t work across layers… so maybe it is better to just disallow it?NGL - tennis demonstrates that floor/ceil is not always correct and I need to round towards the boundary
Although, when I turned off CRT altogether, it went away. My current assumption is that the scaling from CRT to full-screen is a non-integer amount, so I should fix it to restrict to integer amounts so that pixels are always doubled, tripled, etc.
maybe the evector is getting too big? [nope, i added a printout and nothing happened]maybe I’m not really using the same graphics card memory and I’m doing lots of allocations? I tried to use dynamic versus stream. I tried to use buffersubdata. I feel like I don’t have enough information about what’s going on.
maybe I should try the two FBO thing?
http://hacksoflife.blogspot.com/2012/04/beyond-glmapbuffer.html
http://www.gamedev.net/topic/517185-opengl-batch-rendering/
2012/10/24 - When I turned off the CRT emulation, the problem happened much sooner. I think this is because of more stages in my pipeline, so more chance to have asynchrony. Maybe the two FBO thing will work, then?
I don’t understand why this wouldn’t happen with my demos, such as the rotating sprites one, which change things just as much and I’ve run for just as long.
Experiment with getting memory data from bugle
http://www.gremedy.com/screenshots.php https://www.opengl.org/wiki/Debugging_Tools http://www.opengl.org/sdk/tools/BuGLe/
2012/10/29 - I couldn’t get information from bugle because NVPerfSDK only works on Windows. I went with the ranged buffer mapping with invalidation, but this required me to kill evector and do it more manually and ugly—to avoid going over the sprite data multiple times per frame, I expand the buffer the next frame. I still am not doing unsynchronized access, which I think I could, but I’m not totally sure.
fullscreen : (void -> void) (key-event -> void) -> width height (void -> void) (string -> void)
You give a drawing function, you give it a function that gets key events. It gives the max width, the max height, a function that forces a re-draw, and a function that updates the window lable. [Doesn’t need OpenGL, but will call swap-buffers.] [Sets the viewport]
aspect-draw : full-width full-height aspect-width aspect-height max -> actual-width actual-height ((-> void) -> void)
You give it the actual WxH of the screen and the desired aspect ratio (16:9) plus a maximum constant (such as 80 for 720p, which seems to be my laptop’s maximum performance for the CRT shader) and it will return the actual width/height allocated for it, plus a function that receives a drawing function that is drawn on to the actual width/height screen and then put in the center of the real screen. In the future, this function could receive the rotation to have TATE built in. [Uses OpenGL natively] [Sets the viewport]
draw-in-texture : texture-width texture-height -> texture-id ((-> void) -> void)
(Used by aspect-draw) Using OpenGL, it calls a drawing function you give it later and draws into the texture. It returns the texture id before hand so you can use it. [Sets the viewport]
draw-on-crt : crt-width crt-height screen-width screen-height -> ((-> void) -> void)
(Uses draw-in-texture) Using OpenGL and the CRT shader, calls the drawing function with a small texture [Sets the viewport] and then takes that texture and draws it to the default location (in our case, another texture) but with the CRT effect run out it. [In the future, modify this so that the final screen can be drawn in two passes for halation.]
In the future, this will make it super easy to switch to GLFW, because only fullscreen is changed. Plus I think aspect-draw in OpenGL will be nicer than the margin hack I use now
(define-values (full-w full-h label! redraw!) (fullscreen draw! receive-key!)) (define-values (actual-w actual-h aspect-draw!) (aspect-draw full-w full-h 16 9 80)) (define crt-draw! (draw-on-crt 432 243 actual-w actual-h)) (define (draw!) (aspect-draw! (λ () (crt-draw! (λ () (ngl-draw! last-sprites)))))) (define (receive-key! ke) (update-controller! ke)) (define (frame-time! time) (if debug? (label! “Get Bonus - ~a FPS” …) (label! “Get Bonus”))) (define last-sprites empty)
(let big-bang-loop () (define frame-start (current-inexact-milliseconds)) (set! last-sprites (run-the-game controller-state)) (redraw!) (frame-time! (- (current-inexact-milliseconds) frame-start)) (sleep-until (+ frame-start (/ 1/60 1000))) (big-bang-loop))
http://www.opengl.org/wiki/Vertex_Specification_Best_Practices#Dynamic_VBOHowever, note that even with a huge number of sprites, the amount of memory is miniscule.
https://github.com/aras-p/glsl-optimizer (doesn’t work with modern GLSL though) [removing because it doesn’t work and I’m fast enough?] https://en.wikipedia.org/wiki/DirectDraw_SurfaceMaybe not worth it because my texture atlas is small and I don’t want any lossy compression?
A DSL for defining resources…- All
- Source URL
- Copyright holder
- Title
- Music
- Category
- Conversion to Ogg
- Image
- Sprite layout (w/ names)
- Conversion to texture atlas
- Fonts
- Conversion to texture atlas
This would run beforehand, create some files/directory structure, and then drop and runtime information file so texture coords could be looked up.
Use gcstats Make a histogram of frame times (a la DrRacket’s) And mention missing files (Version, Level, Numeric Score) from game(Game, Date, Version, Level, Numeric Score) from dashboard
Store (cached) locally and online
Store a cached global ranking
2012/11/23 - basics are ready, needs contracts and integration. Because I don’t want them to be able to (I currently have a hack) So that the messages go away after a while… like DQ Use the left/right buttons to move between displays and show something at the top about the options Because the cards are then in a new order Including some info about state (just name it) and current fake actions Present the cards as cards with information about the last time they were played, other history information (scores), the sort, and a representation of the data [display “generate” cards differently] What game it is like, when the last time you played was, high score, etc. The font is ugly. It would be nice if it was on the right or in the middle, etc. Like Dragon Quest? http://logic.cse.unt.edu/tarau/index.htmlhttp://code.google.com/p/bijective-goedel-numberings/
Only 90 levels (the initial starting angle)wasn’t easy
This cut the frame time down from about 7 or 8 to about 2!
- change cstruct to use integers too
- have the size of the data types be generated/derived from atlases
sprite = width x height x vector(image) [could be homo-vector] image = integer [don’t bind] palette = integer
font-lib texture-atlas tool X enemies X walls X player X pellets X power ups X switchers Particularly if I go with 1-bit textures :)