Canardia Posted June 20, 2011 Share Posted June 20, 2011 I got LE2 to work now with Fortran G95 (independant MinGW Fortran version) and Fortran 2008 (the official MinGW Fortran), and have already some minimum working code: program main use leadwerks integer result,fw,camera,cube,sun result = Initialize(0) result = Graphics(800,600,0,60,10) ! I still need to add default parameters fw = CreateFramework() sun = CreateDirectionalLight(0) cube = CreateCube(0) call MoveEntity(cube,Vec3(0.0,0.0,5.0),1) do call UpdateFramework() call TurnEntity(cube,Vec3(0.1,0.1,0.1),1) call RenderFramework() if (KeyHit(KEY_ESCAPE)==1) exit call Flip(0) enddo result = Terminate(0) end Compared to early Fortran versions like G77, the code in G95 looks quite human readable. In G77 you had to write everything in CAPS G95 is not case sensitive, so you can type how you want. The example uses a leadwerks.mod file, which is called using the "use leadwerks" command, and it contains the header imports for LE2. Fortran G95 is actually very similar to BlitzMax, because of the following features: 1) both are case-insensitive 2) both can use unstrict or superstrict mode (G95: implicit none, BlitzMax: superstrict) 3) both use leadwerks.mod files, with the difference that in G95 it is one binary file, and in BlitzMax it's a folder with 2 files 4) both can compile also C and C++ code directly 5) both have very simple BASIC like syntax 6) both can have multiple commands per line, seperated by ; 7) both can use line feeds as command seperators, and don't need a ; after each command 8) both can continue commands over several lines (G95: &, BlitzMax: _) 9) both are designed to be a game development language (and scientific and business language), and not a language for computer nerds only The big differences between G95 and BlitzMax are: 1) G95 is insane fast, even around 4.3% faster than C++, while BlitzMax is around 250% slower than C++ 2) G95 is free and open source, and works on all platforms, while BlitzMax works only on Windows, Mac, Linux The G95 installation is very simple: You just download the g95-MinGW.exe setup (it's only 5MB), install it, and it's ready to use. It can be installed in the same directory as an existing MinGW, but I would rather install it in a seperate directory, for example c:\g95. The setup file can be found here (choose the "Self extracting Windows x86", if you use Windows): http://www.g95.org/downloads.shtml#CS To compile a leadwerks game with G95 you type the following: g95 engine.o leadwerks.o game.f I'll upload engine.o and leadwerks.o to the member downloads, when I have polished it a bit more. Actually I could also do a complete Leadwerks Engine Developer pack, which is a single zip file with all you need to compile, kinda like Blitz3D, but without the SDK files of course. G95 works also with Code::Blocks, which I will try next, and make some simple tutorial how to set it up. I made also a comparison between G95 and C++: http://siipi.com/public/mika.nsf/blogs/1BB23690E5CDF0CFC22578B50073A786 Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Paul Thomas Posted June 20, 2011 Share Posted June 20, 2011 while BlitzMax is around 250% slower than C++ LMAO, BMX is not 250% slower than C++. You may think so, or want it to be so, but it is not. BMX is virtually as fast as C++. BMX's performance with maths and loops is on par with, and up to equal to C++ performance. Quote Link to comment Share on other sites More sharing options...
Canardia Posted June 20, 2011 Author Share Posted June 20, 2011 Not according to my tests. I've done simple and complex iterations and also disk I/O. I wanted to make some disk tool first with BlitzMax, but when I saw that it was like 3 minutes slower than C++ with a simple 3GB file, I did it with C++. I heard that Fortran's disk I/O is even faster, so I need to test that too. And why would I want that any language is better or worse than another? I was a big fan of C++ because it was the fastest I had seen, and now I can throw it away at once because G95 is faster. So I don't really care about what brand or anything something has, as long it's the best. When something else is better I change immediately to the better. Have you made made some tests too, where you saw that BlitzMax was same speed as C++? Where can I read about it, and copy the source code, so I can verify it on my computers? Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
cassius Posted June 21, 2011 Share Posted June 21, 2011 Whats so important about ultimate speed? Surely fast enough is enough. My graphics card is not the fastest possible , but its fast enough. Incidently the bmax version of my game ran faster than the c++ version. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted June 21, 2011 Share Posted June 21, 2011 These comparisons seem a little subjective. SUMMARY OF FORTRAN ADVANTAGES OVER C/C++ AND OTHER LANGUAGES ====================================================================== a) Scientifically oriented Better optimized code c) A lot of existing code d) Easier to learn e) More efficient mathematics f) Easier to use and more robust g) Better diagnostics h) Supports astronomical numbers, even when the computer does not natively i) Designed for scientists, business people and game developers, as opposed to many other languages which are designed for computer nerds j) The module technology of Fortran allows truly portable and exchangable code, where C++'s object oriented classes have always failed, because everyone makes different inheritance design from ground on and there is no common standard Quote Link to comment Share on other sites More sharing options...
Brent Taylor Posted June 21, 2011 Share Posted June 21, 2011 These comparisons seem a little subjective. Hello Rick, I'd like to introduce you to Lumooja. Quote There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?" Let's make things happen. Link to comment Share on other sites More sharing options...
Paul Thomas Posted June 21, 2011 Share Posted June 21, 2011 Yes, I've tested the two in speed, and it wasn't enough of a speed difference to be worried about. No, I didn't post it up anywhere, I refrain from posting random BS *cough*, but you can easily Google benchmark tests of BMX vs various languages. I wasn't going against your newest decision to use Fortran, I was going against your misinformation about BMX speed, especially when it's used properly. I think instead of worrying yourself over language speeds you should worry about your project(s) and progressing with it/them. Quote Link to comment Share on other sites More sharing options...
carlb Posted June 21, 2011 Share Posted June 21, 2011 paul dont worry, Lumooja is aways making comment like that when he does not like he does every to make it look bad i know it a pain but just dont bit lol Quote Asus ROG STRIX B350-F GAMMING AMD Ryzen 7 1700x 32 gb ddr4 15 TB raid 5 HD Nvidia EVGA 1060GTX Win10 64bit Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 Whats so important about ultimate speed? Surely fast enough is enough. My graphics card is not the fastest possible , but its fast enough. Incidently the bmax version of my game ran faster than the c++ version. For example in F1 races, the fastest car wins, and when it wins with a huge distance the to 2nd car, it's even more fun than just winning the race Of course my graphics card is also not the fastest, but it costs money to buy a faster one, and I don't really need one since it runs Crysis 2 and DNF just fine. With software, especially free software you can choose the fastest anytime and don't need get stuck on some slower software. Funny though that Fortran is the oldest language, since it was invented in 1950, so all newer languages only got worse? What a waste of time to develop new languages since the first is the best! Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Brent Taylor Posted June 21, 2011 Share Posted June 21, 2011 Funny though that Fortran is the oldest language, since it was invented in 1950, so all newer languages only got worse? You're off by seven years there, Lumooja. Fortran showed up in 1957, not 1950. What a waste of time to develop new languages since the first is the best! Different languages have different paradigms and ease of use. Those are pretty good reasons to develop and use different languages. Quote There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?" Let's make things happen. Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 You're off by seven years there, Lumooja. Fortran showed up in 1957, not 1950. Wiki says in the 1950s, so it could be also 1950 or 1951, because FORTRAN II appeared in 1958. In late 1953, John W. Backus submitted a proposal to his superiors at IBM to develop a more practical alternative to assembly language for programming their IBM 704 mainframe computer, so John must have developed FORTRAN I already since 1950 or earlier. I bet the alpha and beta version worked just fine too, long before it was released to the public. FORTRAN I was originally developed by IBM at their campus in south San Jose, California[1], near the Leadwerks Headquarters, in the 1950s for scientific and engineering applications, it then came to dominate this area of programming early on and has been in continual use for over half a century in computationally intensive areas such as numerical weather prediction, finite element analysis, computational fluid dynamics, computational physics and computational chemistry, and of course recently also realtime 3D video game and simulation development using the Leadwerks Engine 2 [3]. It is one of the most popular languages in the area of high-performance computing [2] and is the language used for programs that benchmark and rank the world's fastest supercomputers. Different languages have different paradigms and ease of use. Those are pretty good reasons to develop and use different languages. How come Fortran is the easiest language then also, besides being the fastest? Look, array and matrix math is super easy: "a = c / b", now a, b and c can be arrays or matrices and it just works. Or this: "a = 1", fills up the array or matrix a with values 1. The expression: "Z(1) = Y + W(1) ! PROJ039" can be easily written also on a punchcard if your company hasn't upgraded their mainframes in a while: Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 Wow! I just found out that I don't need to rewrite each LE2 command in Fortran, but I can use the .o file compiled from the C headers directly. This is what I call reusable code! In C/C++ and other languages you would need to write a seperate header file when using a .o file, but in Fortran you don't need that. The engine.o alone is enough to use the commands directly. OMG, and this means also that I can use all existing C/C++ code directly in Fortran, without writing any kind of module files. So the LE2 Fortran headers will be much less work than I originally thought Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Roland Posted June 21, 2011 Share Posted June 21, 2011 Where can we buy the punchcards Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Flexman Posted June 21, 2011 Share Posted June 21, 2011 Don't laugh, I used to USE those punch cards for COBOL. In most languages the first program you write is "Hello World", in COBOL your first program output a list of financial transactions. Plus you had to get your indenting correct, if your program sections were one character out of alignment your program would be garbage...literally. Hence garbage in and garbage out. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
Aily Posted June 21, 2011 Share Posted June 21, 2011 How about types(classes) in Fortran? Can you show example like this: type node field a end type type node_child extends node field b end type local nc:node_child=new node_child nc.a=1 nc.b=2 Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 I'm no expert in Fortran yet, since I only started to learn it 2 days ago, but I got something working which matches your example: There is also a "class" statement in Fortran, but I haven't tried that one yet. module stuff type node integer a endtype type node_child type(node) parent integer b endtype endmodule program main use stuff type(node_child) :: nc nc%parent%a = 1 nc%b = 2 print *,"nc =",nc end Output: nc = 1 2 However, Fortran 2003 implements true inheritance, but it doesn't work in G95 yet, or maybe I can try another Fortran compiler: module stuff type node integer a endtype type,extends(node) :: node_child integer b endtype endmodule program main use stuff type(node_child) :: nc nc.a = 1 nc.b = 2 print *,"nc =",nc end EDIT: Ah ok, I just tried MinGW gfortran which supports also Fortran 2008, and with it, the true inheritance works like in the 2nd example. The speed is also the same as with G95. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ZioRed Posted June 21, 2011 Share Posted June 21, 2011 I'm ever happy to come here and always find Lumooja's own point of view about whatsoever language he use at that very moment with his own tests and his own conclusions, at least I find here a way to smile... you should be on one of the picture on 9gag.com Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 I'm ever happy to come here and always find Lumooja's own point of view about whatsoever language he use at that very moment with his own tests and his own conclusions, at least I find here a way to smile... you should be on one of the picture on 9gag.com 1) Everyone has his own point of view, including me 2) I examine thoroughly every language. I used BASIC for 10 years, then Pascal for 10 years, then C++ for 20 years, now it's time to use Fortran. Between the main languages I try of course all kind of new languages too, but so far none has established itself as a long-term universal language. 3) Smiling is good Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 An example how modules are used to contain a collection of your own functions. Interestingly it creates automatically also a demolib.mod file, which can be shared with other users. Kinda neat! Also switched to use the latest Fortran 2008 version now (MinGW gfortran): module demolib use leadwerks contains subroutine populateworld(cube) integer sun, ground integer,dimension(3) :: cube sun = CreateDirectionalLight(0) call TurnEntity (sun, Vec3(45.0,0.0,0.0), 1) call EntityColor(sun, Vec4(1.0,1.0,0.0,1.0), 1) cube(1) = CreateCube(0) cube(2) = CreateCube(0) cube(3) = CopyEntity(cube(1),1) call MoveEntity (cube(1), Vec3( 0.0, 0.0, 5.0), 1) call MoveEntity (cube(2), Vec3( 2.0, 0.0, 5.0), 1) call MoveEntity (cube(3), Vec3(-2.0, 0.0, 5.0), 1) call ScaleMesh (cube(2), Vec3( 2.0, 1.0, 1.0), 1) call EntityColor(cube(2), Vec4( 1.0, 0.0, 0.0, 0.5), 1) call EntityColor(cube(3), Vec4( 0.0, 1.0, 0.0, 1.0), 1) ground = CreateCube(0) call MoveEntity (ground, Vec3( 0.0,-2.0, 0.0), 1) call ScaleMesh (ground, Vec3(100.0, 1.0,100.0) ) call EntityColor(ground, Vec4( 0.5, 0.5, 0.0, 1.0), 1) call setupathmosphere() endsubroutine subroutine setupathmosphere call SetSaturation(0.5) call SetAntialias(1) call SetBackgroundColor( Vec4(0.3,0.4,0.7,1.0) ) call SetWater(1) call SetDistanceFogRange(5.0,20.0) call SetDistanceFogColor( Vec4(1.0,1.0,1.0,0.8) ) call SetDistanceFogAngle(15.0,20.0) call SetDistanceFog(1) call SetHDR(1) call SetWaterHeight(-0.2) call SetWaterSoftness(10.1) call SetReflectionElements(ENTITY_MESH) call SetWaterAmplitude(0.16) call SetWaterColor( Vec4(0.1,0.1,0.1,0.7) ) call SetBloom(1) endsubroutine endmodule program main use demolib integer result,fw,layer,camera integer,dimension(3) :: cube result = Initialize(0) call SetAppTitle("FORTRAN STATEMENT"//char(0)) result = Graphics(800,600,0,60,10) fw = CreateFramework() call populateworld(cube) do call UpdateFramework() call TurnEntity(cube(1), Vec3(0.1,0.1,0.1), 1) call RenderFramework() if (KeyHit(KEY_ESCAPE)==1) exit call Flip(0) enddo result = Terminate(0) end Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
cassius Posted June 21, 2011 Share Posted June 21, 2011 Lumooja. Have you been programming for over 40 years then.? I visulize you as being young. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
achrystie Posted June 21, 2011 Share Posted June 21, 2011 Well, I think it's pretty cool. I haven't used Fortran since 1995 or so, in college. That was my second language after Basic, (which I taught myself when I was about 11), but I learned Pascal around that time too as it was a combined course for engineering use. Fortran is a great language. It's actually used a LOT more than people think, it just hasn't been used much for things that the majority of people talk about. Very few people sit around in awe of CFD, FEA and actuarial analysis, so no one really thinks it's useful. In other words, it's not usually used for games, or commercial software development because, up until recently, it's been relatively limited by its non object orientated nature, and once people grab hold of something (C++) or a big company is promoting something (C# and VBA), a lot of other things get overlooked. However, with a lot of object oriented features added in the 2003 and refined in the 2008 spec, and some additional stuff for parallel processing (which is hitting its stride now), it's certainly a viable choice and even optimal in some instances. The one thing I"m unsure of is complete implementation of the 2003 or 2008 standards on these free compilers (or paid ones for that matter form Intel or other companies, which cost a pretty penny btw). As far as I'm aware, none of them FULLY support the newer standards. I'll look forward to seeing your progress with it and finding out if there are any hitches. Good luck with it. Quote Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 Lumooja. Have you been programming for over 40 years then.? I visulize you as being young. Well, I'm still young, only 42! I started programming already before I had a computer, so I made some logic machines with LEGO elements, where you could for example drop a marble in, and the program decided from which hole the marble came out. My first computer at age 9 or so, was a industrial paper machine processing unit which had Nova Advanced BASIC. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
cassius Posted June 21, 2011 Share Posted June 21, 2011 Priceless. And I thought I went a long way back with my Sinclair 48k machine. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Canardia Posted June 21, 2011 Author Share Posted June 21, 2011 Well, I think it's pretty cool. I haven't used Fortran since 1995 or so, in college. That was my second language after Basic, (which I taught myself when I was about 11), but I learned Pascal around that time too as it was a combined course for engineering use. Fortran is a great language. It's actually used a LOT more than people think, it just hasn't been used much for things that the majority of people talk about. Very few people sit around in awe of CFD, FEA and actuarial analysis, so no one really thinks it's useful. In other words, it's not usually used for games, or commercial software development because, up until recently, it's been relatively limited by its non object orientated nature, and once people grab hold of something (C++) or a big company is promoting something (C# and VBA), a lot of other things get overlooked. However, with a lot of object oriented features added in the 2003 and refined in the 2008 spec, and some additional stuff for parallel processing (which is hitting its stride now), it's certainly a viable choice and even optimal in some instances. The one thing I"m unsure of is complete implementation of the 2003 or 2008 standards on these free compilers (or paid ones for that matter form Intel or other companies, which cost a pretty penny btw). As far as I'm aware, none of them FULLY support the newer standards. I'll look forward to seeing your progress with it and finding out if there are any hitches. Good luck with it. Yeah, also in the company I work, business goes before elegance, so I don't usually have time to optimize stuff completely, but just make it working sufficiently fast enough. Then it's understandable that companies also look for simpler languages, since they don't have time to develop with C++, and Fortran was indeed not updated to fit the market needs until recently in the 2003 and 2008 edition. The 2008 spec was only finished in September 2010 by the ISO/IEC committee, so it's probably not completely implemented in GNU Fortran yet, but it won't take long I think. I was glad to find out that GNU Fortran has already OOP inheritance and submodules. The built-in multi-threading support is also very cool, and it might even work with LE2 since it's part of the language. So far everything works fine, but I'm a bit excited when I get to test and implement the callback functions and other advanced functions, but from what I read it basically needs only _stdcall convention, which is what is needed in C++ also, so it should work. Thanks for your wish Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Aily Posted June 22, 2011 Share Posted June 22, 2011 I'm no expert in Fortran yet, since I only started to learn it 2 days ago, but I got something working which matches your example: ........................... Hm... seems that BMax is some clone of Fortran! Very similar languages Thank you Lum. Is there stand alona compiler like TCC? Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.