3D FPS in MMF2 - Should I keep going? (OpenGL)

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • (Sorry in advance for the long post, but this is a genuinely massive topic...)

    Alright, I'm pretty new to the forums so... Sorry if I should be posting this on The Daily Click or something, but...
    I've been working on an online first person shooter using the "OpenGL Base" extension in MMF2 Developer for the past 3 days. It's going relatively well, but I have some concerns. In my experiences with MMF2, I've seen a lot of things that just were NOT possible. MMF2 is one of the few if not the only program I really see this issue with. Also, there are a lot of things (like OpenGL 3D) that you CAN do in MMF2 but it's so pitifully weak that you would need an amazing computer to run the simplest things. I run MMF2 and the games a create an Alienware M18x, so there's not much of a way to tell how my games will play for those with less "hefty" computers, as my friends have good computers too. :(

    I also have some questions about OpenGL and it's extension set, and hope somebody will be knowledgeable on them at least to answer a few questions I have.

    So here are my main questions/problems:
    - What are some ways to reduce CPU/MB usage in MMF2 that I may not know about?
    - If you're knowledgeable with OpenGL Base, is there a way to create a sort of "fog" effect that will reduce the rendering range and still look decent? (I know how to reduce the rendering range but it just cuts off and that hardly looks presentable)
    - Is there a way to prevent MMF2 from crashing when I try and load large Milkshape Models (.ms3d files ) into the internal storage of the "OpenGL MS3D" object? ( This issue is why I haven't added player models for enemies :o )
    - Is there a way to horizontally flip objects with the MS3D object? I can't flip it in actual Milkshape or it screws up the animations :(
    - Is there a way to add a skybox (like clouds or something)? The blue clear color I have now is very bland and wouldn't go over well in a full game. (I am using the "OpenGL clear control object for color and depth buffers by the way)

    - Another big question, even if you don't know much about OpenGL Base, is that the OpenGL Base object always is on top of everything, even list objects. Is there a way to change this? Otherwise I can't add in-game HUD.

    I'm pretty confident that most anybody who reads this will have absolutely no clue what in gods name I'm talking about, but I may as well put this here in the hope that somebody in the community sees this. I would ask on Click Converse but the chat is dead quite often.

    (P.S. - I am making this game all by myself, so that is why I need help.)

    Cheers! :)
    - Me

    That's my main.

    Edited 2 times, last by LavaFlaminG6 (March 18, 2013 at 6:00 AM).

  • Forget it.
    The phrase "ten thousand spoons, when all you need is a knife" springs to mind. MMF2 does a lot of things really well, but 3D is definitely not one of them. There are other tools out there which are much, much better suited to what you are trying to do (they will make development easier, and the end result will be far better because they are based on modern 3D engines). I appreciate that you probably want to use MMF2 because you're already familiar with it, but in the long run you will waste far more time and effort trying to get it to do something it was simply never designed for.
    I know in theory, there are all these exciting 3D extensions (OpenGL, Mode7, Raycaster, etc), but in practice you just have to accept that MMF2 does not do 3D.

  • Forget it.
    The phrase "ten thousand spoons, when all you need is a knife" springs to mind. MMF2 does a lot of things really well, but 3D is definitely not one of them. There are other tools out there which are much, much better suited to what you are trying to do (they will make development easier, and the end result will be far better because they are based on modern 3D engines). I appreciate that you probably want to use MMF2 because you're already familiar with it, but in the long run you will waste far more time and effort trying to get it to do something it was simply never designed for.
    I know in theory, there are all these exciting 3D extensions (OpenGL, Mode7, Raycaster, etc), but in practice you just have to accept that MMF2 does not do 3D.


    There are some new 3D objects in development, though. If he doesn't mind waiting a while for them to get released, (3-9 months at least, I'd say,) then he could use those.

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • Wait, what 3D objects? I heard Stephen say something about 3D a while back (Last year) but I didn't know if that was continued or not.

    Logan Apple

    X Star

    Please login to see this link.

  • I've already developed a somewhat promising example for an online first person shooter. If you want, you can download the example here: Please login to see this link.

    It is functional at the moment with very minimal textures and in-game content but considering that the performance seems proper even while running Lacewing, I have at least genuine hopes for it. Note that If you do download it, the menu controls are the arrow keys and enter. The loading screen is actually Lacewing connecting. In-game, you will simply see your gun, the map, and other online players (who appear as red boxes). W and S to move, mouse to aim, left click is shoot and right click is to aim down the sights on your gun. Hopefully this somewhat changes your opinion on MMF2's ability with 3D.

    That's my main.

  • Obviously the quality is much less, but take into consideration that I made that demo in 3 days with no prior knowledge of OpenGL. There are pretty much no textures, the lighting is minimal, the model is one from Counter-Strike, not from a high-resolution game. The fact that's it's comparable whatsoever is a start at the least. The main issues anyways are the ones I posted previously, mostly pointing to "does MMF2 have the power". I was speaking to Danny recently and he (don't quote him on this) said that pretty much anything is possible if you implement LUA with OpenGL. As long as MMF2 has the processing power, seemingly everything other than shader effects can be done.

    That's my main.

  • LavaFlaminG6 has been getting more progress on his 3D game. He's been posting links to the latest version on ClickConverse for me occasionally. It actually has some pretty decent graphics now when compared to what they were before. I'd say at least N64 quality, possibly better.

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • Hello LavaFlaminG6,

    Loading Large MS3D files into the internal storage is not necessary, load each model at run-time.

    There is no-way to have the MS3D object handler flip you objects i believe. but flipping meshes with bones in Milk-Shape is not so complicated.

    Adding a Sky-box ? in the MS3d system... too easy... and since frog mentioned the N64 here's a skybox in hyrule.
    Please login to see this link.
    Please login to see this attachment.Please login to see this attachment.

    Depending on your operating system; edit boxes may be drawn after OpenGL; but the best HUD achievable would be drawn in OpenGL.


    Now i must say i agree entirely with Retriever2, the combination of Xlua and OpenGL is extremely powerful, easily on par with the very popular C# and XNA system.

    Also unlike with the MS3D object-handler and OpenGL combination, Xlua and OpenGL includes access to all of OpenGL's awesome features including fog.
    ( which you might enable such )
    gl.Enable( gl.FOG )
    gl.Fog( gl.FOG_MODE,gl.LINEAR )
    gl.Fog( gl.FOG_START, 64 )
    gl.Fog( gl.FOG_END, 128 )
    gl.Fog( gl.FOG_COLOR, { 1, 1, 1 } )

    To Reduce memory consumption; memory thrashing must be avoided and garbage collection must be handled.
    Both these tasks are very easy to accomplish with Xlua.

    Memory thrashing in Lua only occurs when tables are declared excessively.

    Certain operations such as
    returning multiple objects as in 'return a1,a2,a3' produces alot of garbage as it is equivalent to 'return {a1,a2,a3}'
    instead tables within functions should be produced as globals and only there pointer should be returned as in 'a={} return a'

    garbage collection in Lua is very straightforward but must not be used excessively.
    'collectgarbage("collect")' calls the garbage collector into action; returning your programs memory usage to it's current actual requirement.
    Beware tho, it can take several milliseconds and could cause visual stutter in your game, i suggest calling it every few-hundred frames right-after switching the visual buffer.

    Thanks for your interesting questions. good luck with your project. and seriously next project you should give Xlua - OpenGL a go.

    Edited 6 times, last by Nerv: Added Images (April 4, 2013 at 5:35 AM).


  • Wow. Sounds like you know more about OpenGL than most of us LOL. Maybe you could consider making a new OpenGL object set... :P

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • Hey Frog, Retriever2's very humble, he knows more than I, and his solution to MMF2 - OpenGL interaction is all most impeccable.

    3D programs are hard to write, until you've picked-up the widely beloved language Lua.

    Edited once, last by Nerv: rewording (April 4, 2013 at 8:47 PM).

  • Hey Frog, Retriever2's very humble, he knows more than I, and his solution to MMF2 - OpenGL interaction is all most impeccable.

    3D programs are hard to write, until you've picked-up the widely beloved language Lua.


    Well, I've looked at C++ OpenGL code before, and, though I don't understand the code itself, programming OpenGL through Lua is almost exactly the same as doing it through C++. I still think that a new extension would be nice, so that people who don't want to have to learn OpenGL programming or Lua programming (or both, which is the case for me) can still make pretty good 3D games in MMF2.

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • Yes, that's a very good point.

    It occurs to me that i (or someone) could write a Lua - OpenGL 3D engine which exposes it's functionality to the MMF2 event editor.
    so long as enough functions are exposed you'll get the full power of OpenGL's commands and there would not be any need to understand or modify the Lua code inside... ( ofcoarse there would be some performance over-head from MMF )

    If you are interested green frog, ill see about putting a basic version up.

  • This is why it's all a waste of time. If you're going to code the whole thing in Lua anyway, that completely defeats the purpose of using MMF2 - it's just going to be far slower and far more work than using a purpose-built, user-friendly 3D game engine (eg. Unity).

  • I hear what you are saying MuddyMole, and if it we're just a matter of performance i would also purport to the efficacy of Unity ( or Assembly )

    but the matter here is a user-base of click-programmers; who have learned alot about programming thru a very effective visual channel ( the event editor ) and who wish to expand there understandings to the very edges of programmings domain; without abandoning this rich environment where learning seems to so freely thrive.

  • Yes, that's a very good point.

    It occurs to me that i (or someone) could write a Lua - OpenGL 3D engine which exposes it's functionality to the MMF2 event editor.
    so long as enough functions are exposed you'll get the full power of OpenGL's commands and there would not be any need to understand or modify the Lua code inside... ( ofcoarse there would be some performance over-head from MMF )

    If you are interested green frog, ill see about putting a basic version up.


    I would be interested. I think some simple support for OBJ loading would be more than enough for just about anything, especially if you could still use the other objects (the other OpenGL collection objects) with it. You'd run a Lua function with the file name (and complete path), X Y and Z coordinates, etc., as parameters. Would that be easy enough, or is it too complicated?

    You know, I'd actually settle for basic shape rendering (with textures, setting their X,Y,Z coordinates, and rotations, of course) if it would be a lot easier, since that would be enough for most games. I think that it would need: Cube, Pyramid, Sphere (with a not-too-high polygon count), and, of course, a lone triangle (for those who want to make an OBJ loader themselves). And, of course, it would need compatibility with the other OpenGL objects, such as the camera, lighting, etc. Ya know, now that I think about it, this second option sounds much better...

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • Some macro functions could work(like renderskybox/loadOBJ functions and such), but it would be impossible to do properly imo. The entire point of event editor is to provide easy to read code.
    XLua: Push string param ("c:\3dmodel.obj")
    XLua: Push floating param (5)
    XLua: Push floating param (10)
    XLua: Push floating param (15)
    XLua: Call function ("LoadOBJ")

    does not look that easy to read and only add more overhead.
    It would be simplier to just call the "LoadOBJ" function directly from XLua. But it would be really nice having those macro functions.
    And I think Looki made OpenGL Primitives extension that works with OpenGL base, not sure how well does it work tho.

  • @Frog, your idea of exposing the low-level drawing commands for geometry definition, for putting the defining of models within MMF, is really a brilliant one, the core pathway of rendering objects once assigned models can remain abstracted and optimized

    I've started on the Engine
    Please login to see this link.

    It's got the groundwork down, but it has not yet got object handing / rendering

    I'll see about adding those somewhat necessary features tomorrow, in the mean-time... perhaps you could re-load or explain this game you have been working on - as we will soon need a test game to implement.


    BigHatLogan, some VERY good points, i shall have to take them especially into account tomorrow when i implement a first attempt at the interface.

    The trick i suppose, is getting it into the events as much as possible.

    To that end I've been considering a getter and primarily setter, oriented approach; where the overhead for storing lots of variables within locations accessible to the MMF expression editor is internally kept to a minimal.

    Handled objects could be created, modified and destroyed based on string identifiers ( in Lua strings are stored as hashes so string lookup is optimized ) these objects would have a spacial location and 3D Model associated with them.

    Models would be defined with MMF control, going down to triangles quads lines and so forth, models then-after would be stored in video memory as optimized display-lists. ( so performance SHOULD be okay )

    I know it's messy, but as someone who learned Clickteams unique programming methodology long before ever having to type a written program, well, i can fully understand why its worth it to some.


  • If you need a test game, I'll make one. Also, can you upload it to a different site next time? Last thing, it seems that you are getting good progress, even if it can't display any 3D shapes or anything like that yet.

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

    Edited once, last by happygreenfrog (April 5, 2013 at 6:51 PM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!