Programming Thread

Started by the-pi-guy, Mar 13, 2016, 10:39 PM

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

Go Down


It's almost like you know what you are doing!

I'm still away but I think I've figured out my map.

Every pixel on the 512x512 grid will be its own renderer in charge of just that tile. All ~260,000 will update individually and only care about their own needs. A tile far from the player will mostly not change and just have a 2x2 or 4x4 texture. As the camera gets closer, the tile re-renders to a higher resolution. This isn't super fast but can look like texture streaming. At max the tile could be 1024x1024 or higher and cover the full screen. As the camera moves away, the texture is scaled down to decrease memory.

This has all the pros of a sparse quadtree while also rendering faster. Rendering speed is dependent on tile count and resolution so this method works with that. Also there is no need for multilevel stuff like a quadtree. In addition, every tile can bake some info instead of recalculating it always.

Labels can be decals rendered on top. The grid of textures could be packed into a single texture to make 3d rendering really fast.


It's almost like you know what you are doing!
I have a pretty good handle of this stuff.  :D

I think I forgot about it when I was writing stuff about compilers, but there are programs to generate the parser from a grammar.  There is still a lot of work that has to be done outside of the parser though.  

Grammars have a few nuances, that sometimes leads to bizarre problems if the grammar isn't set up correctly. Still have to implement a symbol table, implement what everything in the grammar does.  This project will definitely be more work than it's worth, but it'll still be kind of fun I hope...  

The end result will be basically be a command terminal that uses an interpreter to act on the inputs.


In progress:

set_func-> set id( args ) = statements

any_exp -> bool_exp | set_exp | mod_exp
bool_exp -> (bool_exp bool_op bool_exp) | exp op exp | true | false | null
set_exp -> SET id = any_exp
mod_exp -> exp (MOD exp)

exp -> exp + factor | exp - factor
factor -> factor * fact | factor / fact | factor % fact
fact -> fac ^ fact
fac -> term !
term -> (exp) | real | id | id( in_args )

op -> = | != | >= | <= |  < | >
bool_op -> || &

statements -> while bool_exp { statements }
statements -> if bool_exp { statements } (else{ statements })?
statements -> set_exp;
statements -> return exp;
statements -> print exp;


REAL = (0-9)*.?(0-9)*
ID = (A-Z | a-z) (A-Z | a-z | 0-9 | _)*
Found some errors that I am fixing in my program.
And I still have a lot of parsing errors I have to figure out.  


The markov chain like system I set up for words starts producing really really good results once there are hundreds and hundreds of source words.

It made me interested in doing the same thing with pictures. Take a database of a few thousand pictures of the same thing, faces for example, and see how good the system is at generating new ones.

Pixel by pixel a new image could form. Pixels would be added in a random order so that there isn't any bias towards a direction, and later pixels could be less random and focus more on only the best output.

Hardest part would be figuring out a "scoring" system. My word system is fairly basic and just checks the quantity of matching letters. This system would need to go pixel by pixel and search in a circle for similar colors. Find the best match based off similarity and distance. Then add up the scores for all already defined pixels.

Do it in black and white first, and then deal with color later. Would not work to do rgb separately.


I've been studying some of the basics.  
Objected Oriented was 5 years ago now.  I just looked over most of what I was a little unsure of.  I was familiar with the words, but I've forgotten some of the distinctions.  

There are a couple types of polymorphism.  Generically, polymorphism is where one thing can be used in multiple ways.

One type: function overloading.  
You can name multiple functions the same way, but with different parameters.
So like:
add(int, int)
add(double, double)

Another is subtyping.  

Another concept is abstract classes and interfaces.  

An interface is more useful when you want to share behavior, an abstract class is when you want to share code.  
In an abstract class you can basically mix methods that need to be implemented, and methods that are already programmed.  An interface is something that needs to be entirely programmed.  


Might do a post for data structures that I work with less often.  


Starting data structure notes.  

Tree traversal, I usually get these ones mixed up.  


calls the postorder function on each of the children first, then visits the current node.  

Basically causes the lower children to get called first.  


Simply the opposite of the above.  


Only works on binary trees.  

This probably won't be useful for anyone else.  I'm going to write these up for myself.  
I'm basically making a set of notes for myself to review.

Object Oriented

Next ones will be much more detailed.  

Up next for data structures:
-Hash tables
-search trees
-possibly strings (pattern matching and text compression)

After data structures I am not sure what I'll do. A few things on my mind.  

-artificial intelligence

A few things also on my mind, but further down:
-operating systems
-computer organization

Go Up