Forum Replies Created
-
AuthorPosts
-
Very cool project, I really like that one. This can become a “banana”
since it’s very useful.
I see, in this case a creation of a wiki will be helpfull.
For example some users of Unity have created this wiki to post cool recipees. http://wiki.unity3d.com/index.php/Scripts.
(e.g. http://wiki.unity3d.com/index.php/SQLite)Similarly, this is no different approach from what Blitz users used 10 years now.
http://www.blitzmax.com/codearcs/codearcs.php?cat=6In some sense, the idea is the same. Only the underlying website mechanism changes. Either you call it a Wiki/Forum/LAMP Stack.
Here is how the system work:
- Any #Rem comments with special notation, exist within the Monkey2 source code and modules.
- They are automatically converted to HTML documentation with the mx2cc tool.
- After that, they are placed into a database. Each entry will have a unique ID, for example the well known command to add something to a list will be: “std:std.collections.List.Add”
- When you watch information about a command, you can see also posts of other users. (I really like that one on the PHP website were users post clever snippets for every command).
Generally, this is how the current system for the Docs work.
http://monkey2.monkey-x.com/monkey2-docsThe point of question, if the new system will be better than the current one. One argument is that the current system works like this:
- Monkey source -> Generate Documentation
With this approach any modification to the comments must be done within the source code, by creating new commits. In order to keep commit logs clean without overhead, ALL of the projects in the world, avoid modification of comments. Either the programmers do not comment the code at all, either they write it once and for good. - Monkey Source + Monkey Documentation
With this approach the documentation can be maintained externally, in a separate repository. It might be a completely new Git project, or a real XML snapshot of an online Wiki, or for more advanced IDE features, they can be called directly with an HTTP request.The bottom line is that the community will be able to make modifications and enrich the documentation, independently.
http://softwareengineering.stackexchange.com/questions/211938/hyperlinked-externalized-source-code-documentationOnly one downside exists with this approach, is that all of the documentation is stripped out of the source code so it won’t be easily accessible at once. That’s the worst case scenario if you are working from a terminal or with the Microsoft Notepad, but otherwise with the help of a capable IDE the comments can be presented at will more dynamically.
I just throw some ideas, I don’t know which you prefer better.
nerobot: If Mark doesn’t want to mess the parser further with other additions, this approach ‘#region would work. Let’s see about it in a few months from now.
Not that a file should be humongous, but it leads to a good habit of making clear cuts among the code from the start.
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748Class Level#region MediaField SpriteSheet:ImageMethod LoadSpriteSheet()EndMethod DrawSpriteSheet()End#end#region TilesetField Tiles:Tile[]Method LoadTiles()End#end#region CoordinatesField AnchorPoint:Vector2Field Size:Vector2#end#region CheckpointsField CheckPoints:Vector2[]Method LoadCheckPoints()End#endEnd' VS 'Class LevelField SpriteSheet:ImageField AnchorPoint:Vector2Field CheckPoints:Vector2[]Field Size:Vector2Field Tiles:Tile[]Method LoadSpriteSheet()EndMethod DrawSpriteSheet()EndMethod LoadTiles()EndMethod LoadCheckPoints()EndEndPerhaps you might do a counter offer to split the code into sections with standard comments.
Monkey123456789101112Class Level' Tileset _______________Field Tiles:Tile[]Method LoadTiles()End' _______________________' Coordinates ___________Field AnchorPoint:Vector2Field Size:Vector2' _______________________EndWell, it does the trick in some sort of old-school approach, however the real difference with regions is that you will standardize this principle (of separating the code into sections) by design, rather than doing ASCII art.
Yes unfortunately they are outdated, here is another one based on Horde, https://urho3d.github.io/. It might be the last chance.
However if the terrain plugin gives you trouble exclude it. You can still make cool games with modular pieces.
I have also some favorites in my list you could check: COrange (which is pure C), SoftPixelEngine (which exposes a real C API – made by a huge fan of Blitz3D), also I have a dozen others to mention but more or less they fall close.
The codebase looks very straight forward and clean.
Looks like there is something interesting going there.
I actually quite like this, the only question being does it change the ‘default’ access to private too?
I did some code uses cases, but it won’t make a point posting them. For example in C++ you declare visibility regions and place the members there accordingly. In C# you get by default an X class scope for members, any other type of visibility must be declared explicitly at any time.
Monkey currently uses the concept of C++, the bottom line is that this change must come as a “line-saver” and not as a “concept-changer”.
I have created a matrix of possibilities in Spreadsheets and here is what I found. It looks like #1 is the winner:
12345Inline Scope Changes Default Scope The default behaviour with the only benefit of saving lines. The default behaviour with the additional inline benefit.Inline Scope Does Not Change Default Scope The default behaviour with the benefit of not affecting the global scope at all. This will introduce two visibility scopes, the inline one and the default one, might cause ambiguity.Inline Scope Resets Default Scope This will reset the default behaviour back to the default public. Same as 2, but with three scopes at the same time: The default, the one user set, the inline one.Hi EdzUp, you could jump straight into action and try to do some tutorials. You could use Blitzmax or C++ according to what you feel more comfortable with.
In the exact example, to draw 2 triangles ala GL1 I would simply use these statements: glBegin, glVertex, glEnd. This is the core of all the rendering pipeline (the fixed function pipeline). If you can draw let’s say a triangle, or a colored cube, you can draw and navigate inside a humongous level created with Blender. On the other hand the modern shader based pipeline is much more tricky to get started and understand. There is a need for the perfect combination of these elements before you draw anything: shader, vertex buffer, vertex attributes.
After a long time, since I found a chance today I created this little fancy OpenGL example.
Video:
https://1drv.ms/v/s!AquVr9J7xRcsgXYmcIlKcvFD94LwIt was some code I made a few years ago for OpenTK, now I ported it to Monkey2, I don’t remember where exactly I got the shader from, if you know who made it you can inform me so I can add credits (lots of thanks to the developer if he/she is reading).
Apart from that shader, if you replace the fragment part with any shader from here http://glslsandbox.com/ you could have virtually any GLSL sample available. Keep in mind to the Uniform variables only and some GLSL specifications (there are some differences between GLES and GLSL and you might get errors).
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111#Import "<mojo>"Using std..Using mojo..Using gles20..Function glLoadProgram:GLuint(vertexSource:String, fragmentSource:String)Local vs := mojo.graphics.glutil.glCompile(GL_VERTEX_SHADER, vertexSource)Local fs := mojo.graphics.glutil. glCompile(GL_FRAGMENT_SHADER, fragmentSource)Local program := glCreateProgram()glAttachShader(program, vs)glAttachShader(program, fs)mojo.graphics.glutil.glLink(program)glDeleteShader(vs)glDeleteShader(fs)Return programEndFunction LoadShader:GLuint()Local vertex:String = "attribute vec3 Position;void main() {gl_Position = vec4(Position, 1);}"Local fragment:String = "uniform float time;uniform vec2 mouse;uniform vec2 resolution;#define PI 3.14159void main( void ){vec2 p = (gl_FragCoord.xy / resolution.xy ) - 0.5;float sx = 0.2 * (p.x + 0.5) * sin(100.0 * p.x * (mouse.x) - 10.0 * time);float dy = 1.0 / (50. * abs(p.y - sx));dy += 1./ (50.0 * length(p - vec2(p.x, 0.)));gl_FragColor = vec4((p.x + 0.5) * dy, 0.5 * dy, dy, 1.0);}"Local program := glLoadProgram(vertex, fragment)glBindAttribLocation(program, 0, "Position")Return programEndClass MyWindow Extends GLWindowField vbo:GLuintField shader:GLuintField canvas:CanvasMethod New()glClearColor(0.1, 0.1, 0.5, 1.0)' load the shadershader = LoadShader()Print("Program ID: " + shader)Print("Attribute Location ~qPosition~q: " + glGetAttribLocation(shader, "Position"))Print("Uniform Location ~qtime~q: " + glGetUniformLocation(shader, "time"))Print("Uniform Location ~qmouse~q: " + glGetUniformLocation(shader, "mouse"))Print("Uniform Location ~qresolution~q: " + glGetUniformLocation(shader, "resolution"))' define a quad shape consisted out of two triangles: 0 1 2 , 2 3 0' 3-------2' | . |' | . |' | . |' 0-------1Local vertices:Float[] = New Float[](-1,-1,0, 1,-1,0, 1,1,0, -1,-1,0, 1,1,0, -1,1,0)' create the vertex bufferglGenBuffers(1, Varptr vbo)glBindBuffer(GL_ARRAY_BUFFER, vbo)glBufferData(GL_ARRAY_BUFFER, vertices.Length * 4, vertices.Data, GL_DYNAMIC_DRAW)EndMethod OnRender(canvas:mojo.graphics.Canvas) OverrideApp.RequestRender()Super.OnRender(canvas)canvas.DrawText("Monkey2 OpenGL Test", 10, 1 * 20)canvas.DrawText("Mouse Location: " + MouseLocation.X, 10, 2 * 20, 0, 0)EndMethod OnRenderGL() Override' clear the screenglClear(GL_COLOR_BUFFER_BIT)' load the shader and update uniformsglUseProgram(shader)glUniform1f(0, Millisecs() * 0.001)glUniform2f(1, Cast<Float>(MouseLocation.X / 500.0), Cast<Float>(MouseLocation.Y))glUniform2f(2, Cast<Float>(Width), Cast<Float>(Height))' bind the buffer, enable vertex attributesglBindBuffer(GL_ARRAY_BUFFER, vbo)glEnableVertexAttribArray(0)glVertexAttribPointer(0, 3, GL_FLOAT, False, 0, Cast<Void Ptr>(0))' draw the vertex dataglDrawArrays(GL_TRIANGLES, 0, 6)EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndOpenGL 1.x can be used in C and in other languages (I have used C# OpenTK a lot). In Monkey2 theoretically a wrapper could be written to access the OpenGL 1.x library functions. However doing so, would mean that a tremendous good strategy would exist, it’s a huge investment writing for legacy hardware.
Nice example, I would try to extract as many useful elements as possible.
Another user in the forums created a cool 3D example with Monkey2, it would be a nice idea to hotlink for easy access.
http://monkey2.monkey-x.com/forums/topic/monkey2-opengl-experiments/#post-5310Perhaps I will start doing texture loading as well to create a nice snippet and proceed also adding some further abstractions. Like a Mesh class or a Texture class, without going into heavy implementations.
Nice one, thanks.
-
AuthorPosts