Skip to content

Latest commit

 

History

History
1282 lines (1108 loc) · 54 KB

TODO.org

File metadata and controls

1282 lines (1108 loc) · 54 KB

General TODO items

reading

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/

make an 8bit plt logo for start screen

cleanup graphics engine and allow arbitrary sprite color data AND pals

apply graphics engine to pict and 2htdp/image

allow retro-resolution AND full resolution

allow portrait vs landscape display/games

investigate ECS

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

twitter is a pseudo-random number generator

2d shader resources

http://www.reddit.com/r/gamedev/comments/238z3e/any_good_resources_for_glsl_shader_techniques/

heroquest implementation

vassal module has all the images

http://heroquest.no-ip.com/

http://heroquest.no-ip.com/advancedheroquest/index.html

http://www.yeoldeinn.com/na-index.php

look into using option contracts

constraint based physics

http://www.reddit.com/r/gamedev/comments/23c7lx/i_gave_a_lecture_on_constraintbased_physics_and/

kanji roguelike

http://roguelikeeducation.org/9.html

interesting visualization

http://bost.ocks.org/mike/algorithms/

palette selection

http://www.reddit.com/r/gamedev/comments/23l7yx/learn_all_about_color_selection_and_using_color/

palettes

how big are mine?

http://www.effectgames.com/demos/canvascycle/?sound=0

work on dynamic loading of data files

for rapid prototyping

create a new small font for menu

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/

nes palette

http://meatfighter.com/nintendotetrisai/9.png

apse - Make apse purely functional and have better undo system

(where it goes back to earlier system states)

apse - Add height/normal maps & lighting

write more tests

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

good sprite sheet

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://imgur.com/a/uHx4k

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/

implement A* + JPS

http://zerowidth.com/2013/05/05/jump-point-search-explained.html

http://www.redblobgames.com/pathfinding/grids/algorithms.html

Look at Texture Packer’s options for artifacts

http://www.codeandweb.com/texturepacker/documentation#layout

ascii particle effects

http://www.gridsagegames.com/blog/2014/03/particle-effects/

look into google play services

https://developers.google.com/games/services/web/gettingstarted

bitmasking

http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/

sound

https://www.youtube.com/watch?feature=player_embedded&v=la3coK5pq5w

NES audio channel explanation

http://abcnotation.com/

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

reconsider textures

would it be better to just have elementary shapes and no textures ever, except for fonts?

find a way to let the games inform which textures are included in atlas

tennis - make variation where you “drop” paddles based on how many balls there are

And enable slow-down?

SRS - base next generation on past levels

(make the FST bigger, make the tennis list longer, etc)

SRS - have games return how much time was paused (if pausing is allowed)

SRS - have games return custom attempt information

Like what the equipment/etc configuration was in JRPGs, so it can be re-presented if it needs to be modified

Implement pausing and quitting

make pi sequences functional

Using streams

ensure I am using just OpenGL ES

https://mail.google.com/mail/u/0/#inbox/13e67b9634c39a5b

main - have a way of browsing attempts (press select?)

For viewing a replay or other data

generalize score to a hash of different metrics

frames score how many balls in the air how many pellets did you beat the level?

Robby’s maze idea

https://mail.google.com/mail/u/0/#inbox/13dd1b029d348da5

NGL - tennis - it seems like the ball goes too low

Also, if you try to bring the paddle to the top, it doesn’t draw the whole way

NGL - Investigate the interaction of depth testing with transparency

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.

NGL - Figure out the proper way to do texture/color blending

Right now I only support fully color or fully texture. It would be nice to support a tinted texture

opengl optimizations

http://www.reddit.com/r/programming/comments/2102jt/opengl_approaching_zero_driver_overhead/

NGL - See if I need to set up culling specially

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]

libretro - what if I used libretro rather than GLFW?

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

Make a tool for downloading the copyrighted images/music

List the URL, a checksum, and then have the tool download them if they aren’t there and verify if they are.

Use SNES sprites for Ms. Pac-Man in maze

tennis - balls can bounce infinitely off wall and get stuck

OS suppress updates

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?

Make maze harder over time: faster, more ghosts, squares = score multiplier

tennis - shake the screen on bounce, gas pedal on paddle for speed, decreasing increasing rate of ball speed growth, add blocks like arkanoid?

tennis - score based on total number of balls in play

Connect scores to online database

Make games return replays (and allow them to accept replays)

Replay = (random seed, level, controller stream)

Build music libraries based on emotion (fast, race, scary, triump, etc)

SRS - Automatically go to the next card

SRS - Deal with games that have a win condition

(so that you don’t get too much credit if you don’t actually win, even if you did better than before?)

SRS - Don’t play a level/game more than X times in a row

SRS - Don’t play a level/game for longer than X minutes in a row

Include workrave like system in dashboard

Make icons for dashboards vs text

Or mimic the Wii interface

Make games in dashboard have capabilities

1P, 2P Round-robin, 2P VS, 2P Co-op, etc

Make play modes in dashboard

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

Death scream like Ziggurat (in dashboard?)

Or other stingers, but worry about being too annoying and not instant restarting

Find a unified common score display

Should I display all points: this session / this game / all games?

Return achievements (to dashboard)

Make the ‘Home’ button in games bring up a dashboard menu (to quit the game, give a ranking, etc)

Read about and implement juiciness

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

http://tnns.rabbx.com/

Tennis - ugly score display

Tennis - revisit use of paddle bounce

Figure out a way to do localization well

gettext

Make more games

The Get Bonus rendering system should have built-in support for TATE games

Virtual, Rotate Left, and Rotate Right

NGL - Add absolute and relative layers

For example, the score display is absolute, but the game is relative (my games don’t use this concept yet)

See if I can record a video directly

http://revel.sourceforge.net/docs/html/revel_8h.html#a30

Allow multi-pass shaders (such as CRT halation)

See libretro or retroarch

And maybe use Cg rather than GLSL

Experiment with located events (in a 2D mesh) rather than flat events

Try to get OpenGL to do collision detection for me

http://kometbomb.net/2008/07/23/collision-detection-with-occlusion-queries-redux/

2D Lighting

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/

Winners Don’t Do Drugs and other intro screens

Let’s play money making game

rpswar - render fst graphically

Figure out a way to allow and use palettes effectively

tetris notes

http://meatfighter.com/nintendotetrisai/

menu - check for more overlaps

damage roll distributions

http://www.redblobgames.com/articles/probability/damage-rolls.html

look at #IDARB for inspiration

map generation & noise

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

zelda-style map generation

http://www.reddit.com/r/proceduralgeneration/comments/1ztgcc/zelda_or_secret_of_manastyle_world_generation/

http://bytten.net/devlog/lennas-inception/

https://github.com/tcoxon/metazelda

https://github.com/mizipzor/roguelike-dungeon-generator

wall jump

http://www.reddit.com/r/gamedev/comments/283bs5/an_examination_of_walljump_systems_across_blood/

Tool and related-app ideas

look at textual music markup

http://www.reddit.com/r/gamedev/comments/1f9l62/visual_mml_a_text_music_editor/

Add challenges/achievements/training to NES/SNES games

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/

Implement a gamepad interface to Nethack (preferably with access to alt.org)

Implement Boxing iPhone game

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

Make something for Racket/emacs to find out what deps aren’t needed

Make Optimization Coach + Macro Stepper available via Emacs

Adapt Tom7’s NES playing ideas

http://www.cs.cmu.edu/~tom7/mario/

Use A* or BB to discover optimal playthroughs

Write a NES AI language like Tom7

Implement Mega Man All-Stars and Castlevania All-Stars

There are very few NES games that are awesome and the SNES is so great.

Write a Wayland interface for Racket

Plus a tiling manager Plus a “video game console” shell

Optimization ideas

Make OS use futures for parallelism

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.

Convert things to typed racket

NGL - geometry shader - can I optimize the matrix calculations because I’m 2D?

Will the GLSL compiler do it anyways?

NGL - cache shader vector modifications to skip some parts of object tree

premature optimization

NGL - cache shader vector uploads to skip some segments

premature optimization

(Probably not useful, because I hit very high frame rates even when updating vectors thousands of elements long)

Theory Ideas

pseudo-random number generation based on naturals (rather than MAXINT)

This could be based on a block cipher with unbounded key length and bounded block size

Done

Master Grafx2 or aseprite or make my own keyboard based system

https://code.google.com/p/grafx2/

Make a better (visual) sprite specifying tool, based on the component/sheet algorithm

GLFW - Wait for consistent joystick state intra-frame

2013/03/08 - I submitted this patch

jake - parallel

unify different NGL implementations

use pi for maze

use pi for tennis

base infinite sequences off of digits of pi/e/etc

2013/03/08 - I did this and need to integrate it with tennis and maze

Move tests into test submodules

Write a makefile that runs all the tests with raco test

Really implement openal on linux

Really implement joysticks on linux

Remove controller debugging printfs

Reorganize exp directory into other directories

Change gl model to keep track of sizes for centering, etc

Make dashboard

Add scoring back into tennis/OS

Correct tennis angle of reflection

Separate OS out of tennis/OS

Improve tennis/OS structure

Make tennis harder over time: more balls, faster movement, larger opponent

I can still get stuck on the wall and the paddle sometimes in Tennis

Rewrite maze with OS model

Improve maze OS structure

OS - fix connection to 3s

There is a use in tennis that would be fixed

And maze uses it for the background music

Figure out how to use OpenGL depth bit for background/foreground

A lot of people online seem to suggest it is bad to use the Z buffer because of transparency issues. Strange.

Now use it

Maybe change graphics to fixed pixels?

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.

maze - use CRT size directly?

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

maze - sometimes the white ghost disappears… it’s weird

It was a problem with depth. Annoying. I’ll have to revisit depth later.

tennis - use CRT size directly?

Change controller model

SNES style D-pad is booleans Have another right interpretation of dpad

Get a USB snes controller for home

Switch to RacketGL throughout

Make a faster FPS counter

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

Switch to a fully shader based rendering system

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.

NGL - Assemble texture atlas from data files

Use gb/graphics/texture-atlas-lib to produce a static database after munging some image files and calling something functions

NGL - Use texture atlas in demo

This required dropping the index.

NGL - Experiment with pixel coords rather than relative coords in texture atlas

Jake

My own Make system. I’m crazy.

NGL - Allow texture atlas to have sub-file textures

(i.e. my existing sprite sheets)

Or just make the cutting up tool better (probably a better solution)

NGL - Font generation

There’s no reason to have them all the same width, just the same height.

NGL - Find a better mono font

NGL - Generate digests of copyrighted images

NGL - Growable vector management library

Should work for an ffi/vector, including copying from old to new. Doubling when you go over the limit.

gb/lib/evector - make it static (like a unit)

NGL - Improve digest creation

Make it its own program and part of Jake file

NGL - Take the geometry shader version and turn it into an abstraction

NGL - use evector

NGL - don’t use global variables

NGL - undo changes to OpenGL state

texture atlas - remove the giant vector and replace with small ones

NGL - Make a system for specifying sprites granularly

Perhaps use parameters for the current translate/rotate/scale, since the shader has no stack. For now, this should have layering built in.

NGL - Maybe get the object width/height from sprite pixel width/height

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.

NGL - Hard code texture index more

Rather than using define-texture

And optimize given that I won’t be using the indexing system

NGL - Deal with the model view projection in the shader

My games rely on a different resolution than the actual screen

Or, have layers in “absolute” or “relative” coords

NGL - Fix texel specifications

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

NGL - Some random number of sprites aren’t drawn at all

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)

make-font - support non-alphanumeric

By using char->integer

NGL - move r.rkt to gb/r

NGL - String rendering using the pre-rendered fonts

NGL - Make texture atlas creation more efficient

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

NGL - Fonts are still messed up

(See gb/main’s menu)

I think maybe the korf layout is off by one? (But my demo looks fine)

Convert gb/main to use crt-w and crt-h vs 16:9

NGL - change in_TexCoord to float

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

NGL - Consider using only integers so they are always pixel aligned

It is much nicer to use floats everywhere for other reasons.

NGL - add contracts to ngl and ngli and string

Make XML shader reading more robust

In case there is just a fragment, vertex, etc (see bsnes examples)

Make it so gl:Color doesn’t have an alpha arg

Because by using Z buffer for layers, translucent pixels don’t work across layers… so maybe it is better to just disallow it?

Change gl model to be memoized

NGL - tennis demonstrates that floor/ceil is not always correct and I need to round towards the boundary

NGL - tennis - problem with ngl’s scaling?

If I change a call to rectangle to sprite but give a scaling factor, it doesn’t do what I expect. I should make a simple demo to try it.

NGL - convert tennis’s resolution

There is still the rectangle in ball-sprite because I can’t use sacle

NGL - maze - the items are not center and the pellets are too small

NGL - the 0/0/0 color seems to be brown? weird?

I think the reason is that it gets combined with the 0,0 pixel in the sprite sheet which isn’t empty

NGL - after fixing blackness, now some of the sprites aren’t shown

alpha is probably 0

NGL - the squares are not all square in maze

I don’t think it’s a problem with CRT, because when I turn off that shaded, it still happens.

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.

have a proper quit handler to close resources, like OpenAL ctxt

Change FPS counter to count frame time instead

Make audio loading lazy (or other things that are slow on boot)

Make fixed-size fonts better

NGL - maze - gets UNBEARABLY slow after a little while… why?

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.

NGL - Use with actual games that I have

NGL / Fullscreen / Big-bang - New architecture

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))

NGL - remove racket/gui from most code

NGL - Read about optimizing the streaming of data to the GPU

http://www.opengl.org/wiki/Vertex_Specification_Best_Practices#Dynamic_VBO

However, note that even with a huge number of sprites, the amount of memory is miniscule.

NGL - Consider using an external GLSL optimizer

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?]

Investigate and potentially using DDS for textures

https://en.wikipedia.org/wiki/DirectDraw_Surface

Maybe not worth it because my texture atlas is small and I don’t want any lossy compression?

Resource manager

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.

NGL - convert rps

NGL - move ngl interaction from os to world (and therefore standardize on crt w/h)

NGL - maze - convert to crt resolution

NGL - maze - the score display isn’t there

NGL - maze - hungry man is pointing the wrong way

Collect more performance data

Use gcstats Make a histogram of frame times (a la DrRacket’s)

Write better install instructions (including os setup)

And mention missing files

Make games return score information to dashboard for it to manage

(Version, Level, Numeric Score) from game

(Game, Date, Version, Level, Numeric Score) from dashboard

Store (cached) locally and online

Store a cached global ranking

Make Anki-like SRS system in dashboard

2012/11/23 - basics are ready, needs contracts and integration.

SRS - Choose a game to play a card from

menu system - rpswar - optional quitting

Because I don’t want them to be able to (I currently have a hack)

menu system - rpswar - auto select option

So that the messages go away after a while… like DQ

controller - build edge/level into controller object

menu system - modal bar

Use the left/right buttons to move between displays and show something at the top about the options

menu system - main - make it so the menu refreshes after you play a card

Because the cards are then in a new order

menu system - rpswar - info screen

Including some info about state (just name it) and current fake actions

SRS - Play a particular card (display them)

SRS - Play a card by name (on the command line)

menu system - main - display more info about cards

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]

menu system - main - display more info about games

What game it is like, when the last time you played was, high score, etc.

menu system - main - compare with....

Make RPS more JRPG-like

SRS - Keep track of “play session” and connect the concept of “in a row” to play session

SRS - add a way to convert from one version of a level to new ones

SRS - double check that a level doesn’t already exist in db

menu - don’t use fixed symbols for state

menu system - display the list better

The font is ugly. It would be nice if it was on the right or in the middle, etc. Like Dragon Quest?

add checks for menu overlaps

Write a generic Godel-encoding library

http://logic.cse.unt.edu/tarau/index.html

http://code.google.com/p/bijective-goedel-numberings/

http://scholar.google.com/citations?view_op=view_citation&hl=en&user=JUMRc-oAAAAJ&sortby=pubdate&citation_for_view=JUMRc-oAAAAJ:tKAzc9rXhukC

RPS - generate FSTs differently (with godel encoding)

tennis - use godel

tennis - change randomness to be based on past actions

Only 90 levels (the initial starting angle)

rpswar - allow the player to lose

maze - use godel

Add “compare with …” to game info and display

GLFW - Wait for getting the string identifiers of joysticks

use r.bin (should work right now)

use r.idx.bin (should be easy?)

wasn’t easy

use a cstruct for sprite-info and cvector for spritedata [all floats]

This cut the frame time down from about 7 or 8 to about 2!

try to use optimization ideas

  • change cstruct to use integers too
  • have the size of the data types be generated/derived from atlases

rearrange structures greatly

sprite = width x height x vector(image) [could be homo-vector] image = integer [don’t bind] palette = integer

enable the ability to specify palettes

delete stuff?

font-lib texture-atlas tool

rescale menu system because fonts are bigger now

apse compile - build a tree to get, for example, all items

apse - palette dir creation broken

maze - palette broken

maze - sometimes the player can be put into a wall and can’t move

better maze sprites

X enemies X walls X player X pellets X power ups X switchers

use palettes, plus animation in maze

find a better set of sprites for tennis

Change sprites/textures to use lower color depth

Particularly if I go with 1-bit textures :)