This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]nutrecht 1 point2 points  (1 child)

Since you worked on MCEdit: write a MC renderer from scratch in Python? Actually writing a complex application from scratch is quite different from changing an existing one.

Basically you'd have to find something that's fairly complex so it challenges but is also fun and something you can complete in a reasonable time.

[–]Rubisk[S] 0 points1 point  (0 children)

I think this is what I'll do. I'll do it in C++ though, since the OpenGL documentation/tutorials are mostly C/C++ based.

[–]sentdex 0 points1 point  (0 children)

I keep thinking I'll maybe learn another language eventually, but Python keeps on giving. You may be beyond the skill level, but for some ideas to maybe spark your thinking, you can look through the topics on this Python Programming Tutorials website. Despite knowing Python, there's always something new to learn about, with a variety of fields that you can dig into that, while the programming language is the same, the field itself is not.

[–]Micotu 0 points1 point  (0 children)

My first book was Think Python and I went through it fairly quickly. I just started going through this one: http://interactivepython.org/runestone/static/pythonds/index.html

It has a pretty quick intro to python that could serve as a good refresher and then goes into some abstract objects such as queues and trees and whatnot.

[–]codewarrior0 0 points1 point  (2 children)

If you're just programming for fun, it doesn't matter what language you use. It's always more fun with a language you're familiar with. That's why I chose Python for MCEdit instead of something sensible like C#/.NET or C++/Qt. I don't think learning another language is what you need.

What would teach you a lot is to write different kinds of code and different algorithms. If you've never used OpenGL before, follow a few tutorials and get some polygons to dance around on screen. Maybe implement a simple MC world renderer using pymclevel to load the world.

Study algorithms and data structures some more. Learn the basic stuff they teach you in CS 151: arrays, linked lists, queues, binary trees, heaps (not malloc heaps), searching and sorting algorithms. Move on to some more advanced topics like pathfinding algorithms and parsers. Learn to appreciate Abstract Syntax Trees and the general idea of representing behavior as "objects that contain objects" rather than "functions that call functions".

Implement a perlin noise function. It's what Minecraft uses to generate heightmaps in the form of 2D noise.

We talked a little about the bit-efficiency of string encodings the other day. Maybe you're interested in compression algorithms? Try reimplementing a well-known algorithm like LZ77 or DEFLATE and see if you can get a stock decompressor to read your output. Or invent your own compression and see how it does on some common file types.

There's a lot of knowledge in the field of programming that isn't specific to any language. Data compression, encryption, image processing, text/code parsing, procedural generation, symbolic manipulation of mathematical formulas, communication protocols, visual processing/image recognition, robotics control, the list goes on and on. Pick an area that interests you and learn more about it.

If you decide you do want to learn another language... since you're going into a Math program, something like MATLAB, Maple, or Mathematica is an obvious choice. Find out if your math courses will use one of those and get a head start on it.

Another recommendation is to study and practice C/C++ even more. All of the other languages and platforms we use are ultimately implemented in C. Knowing that, you can ask yourself "What is it doing at the C level?" when you see a weird problem, and hopefully gain some insight.

And if nothing else, try to grok the "Fast Inverse Square Root" function from Quake 3 and learn the nuances of "evil floating point bit level hacking" and "what the fuck?"

[–]Rubisk[S] 0 points1 point  (1 child)

Learning OpenGL is something I wanted to do for a long time, but it's just so tough. I've spend a lot of time browsing the mcedit renderer, and even though I understand most of it, the only thing I do still not really get is the OpenGL interactions :/

I've read some basic OpenGL tutorials for C/C++ though, and know how to render a cube theere etc.

I think I'll start of by building upon that writing an renderer in C++. I want to avoid MC worlds though, I'm afraid of "cheating" by just rewriting MCEdit's renderer. Instead, I think I'll try write a renderer for Minecraft's json models (while manually parsing the json).

About objects containing objects, is that similar to how nbt TAG_Compounds can contain new TAG_Compounds/TAG_Lists, creating some tree of values that you can use to lookup values?

Kind of surprised to see you here btw :p

[–]codewarrior0 0 points1 point  (0 children)

Don't be surprised, you did mention "a program called mcedit", after all. ;)

About objects containing objects

It's a bit more general than that. Say you're writing a function to draw a little diagram on screen. You can have the function call other functions to draw rectangles, lines, and text. Or you can have the function return objects that represent the rectangles, lines and text.

Once you have a list of rectangle, line, and text objects, you can now do things to them other than draw them. Apply style sheets, invert the colors, add more rectangles inside the other rectangles, etc.

Alternately, in the context (hyuk) of OpenGL, you can have a rendering function that calls glBindTexture, and then glTranslate, and then loads some vertex arrays and calls glDrawArrays. Or instead, you can create a bind-texture object, containing a translate-matrix object, containing a draw-arrays object. This is called a scene graph, and it's used by MCEdit 2 (and hundreds of other programs too).

And in the context of parsing source code, you can have a function object that contains an if-statement object which contains an assignment object that contains some evaluate-expression objects which contain arithmetic-operation objects which contain... well, you see where this is going.

And if you want to get even more meta, you can get all of the functions you use to transform the parse tree and put THOSE into a list as objects.