Category Archives: TUG IDE

Generating Crafting Recipes (HTML)

I have posted a list of crafting recipes for TUG and SteamPower mod over a week ago on twitter.
Then 2 days later I have posted one with search functionality for both TUG and SteamPower.

Here is how I did it and no I didn’t do it one by one, that would take way too long and would just be silly. I have used the IDE to do all of the work for me.

The basic list took only 4 hours to make, if I’m to guess it would take about 2/3 days to get all of them done one by one, no way of knowing if you have made a mistake and each time there is an update it would take additional time (not to mention making those lists for mods).

Crafting Recipes

This part was simple enough, all I had to do it use the txt parser (TUGON parser/TUG parser) to get a list of crafting recipes, then parse the item groups, item names, tools and crafting stations.

HTML Files

Generating the HTML files was a bit more difficult, surprisingly, but that was probably because I wanted it to look nice and use a css file. This part was the most time consuming one, approximately 2 hours of tweaking the code.

Icons

The icons were pretty much there, the main problem was that I needed name to icon map, but since the txt parser (TUGON parser/TUG parser) is capable of reading the files it was just a matter of reading all of the files and getting the objects schematic files. Once I had a full list of objects I could easily get the icon path, convert the image to a smaller png and save it in the generated directory.

Search Functionality

This one was pretty simple, credits for the idea go to Cameron. It required me to change the HTML code and add a JavaScript lib, it didn’t take too long since it was just a matter of tweaking it a bit.

Why did I port the IDE to LWJGL3

Few days ago I have decided to port the IDE from JOGL(Java Binding for the OpenGL API) to LWJGL (Lightweight Java Game Library 3). Surprisingly it went smoother that expected after ~5 hours I had the graphics part ported, for the input I have decided to write my own wrapper which took few hours.

I have used JOGL and LWJGL before I even started working on the IDE, when I started to work on the IDE (well actually a project that the IDE is based on) I have decided to go with JOGL as LWJGL2 didn’t support multiple windows. Now that LWJGL3 is here and support multiple windows there was no need for me to stick with JOGL.

There were few reason why I wanted to port the IDE to it, but I will go into details later on. First I want to say that technically there was no need to port it. Everything was working fine, except for random crashes and by random I mean really random, I was able to replicate the crash ~70% of the time but where and why it was happening was a mystery. The crash was actually my fault, but because it was showing as a native stack error (accessing memory) originating in java executable I was not able to figure out what was causing it.

Porting

When I started to port the IDE to LWJGL I didn’t know if this will fix the crash or at least let me know more less what is causing it. Well that’s not exactly true I knew that this kind of error could only be caused by an external lib and JOGL was the only one and I also knew that LWJGL has proper log when it crashes, so there was a good chance it will work/help.

After porting the IDE and crashing a few times I have checked the log files and the cause of it was in my Model Viewer rendering code and FlexibleRenderer (my wrapper for Vertex Arrays, really flexible for prototyping and ultra fast and easy to use when extended). It was caused by me forgetting to disable few OpenGL states (or removing few lines of code too much when cleaning up).

Should I go back now?

Well at this stage I could easily just go back to JOGL and remove crash, but I had all of the graphics calls ported and to get it to fully work I just needed to fix few minor things and make the input wrapper. I thought I might test it, I have been using LWJGL a lot in the past, modding MC and writing a game, the usual thing I do first is benchmark.

The results really surprised me, almost empty screen rendered with 6000fps, almost double (compared to 3500fps) and more advanced ones like Model Viewer and File Viewer gained ~20-30%, which for a “simple” change is a lot.

More reasons why I decided to go with LWJGL

Static OpenGL calls, in JOGL passing the GL container around to every single functions is really annoying.

OpenGL versioning, with LWJGL I have to know which version of OpenGL the call is coming from, while most people would find this annoying I really like this approach as I know exactly which calls I would need to replace to lower the required version of OpenGL and I can stay away from 4.0+ calls.

BufferUtils, an extremely useful class, it provides a quick way to create buffers that will be compatible with OpenGL, not sure if JOGL has one as well but I haven’t seen it used anywhere.

GLFW is now the window library included with LWJGL, it is low level, single threaded (with input polling) and fast, JOGL can use AWT, SWT and Swing each of those has their own problems and they are really old.

Recording, I’m using Open Broadcaster Software (OBS) to record (yes, it can also record) and with JOGL it just didn’t work, I had to use DxTory to pass in the DirectShow Output and record it like this. I could use just DxTory but I prefer OBS for some reason. With LWJGL OBS has no problems recording using the Game Capture mode, that saves a bit of time while setting up.

Conclusion

Don’t get me wrong I’m not saying you should use LWJGL, it really comes to what you need and which one you like more. JOGL is a great library, it has advantages especially for beginners and in some cases it is easier to use, but for me LWJGL has everything I need and the way the code is written using it appeals more to me. Again this is my personal opinion and not something you should take as a fact, if you are trying to decide which one to go with, get both and compare, that’s the only way.

Generating Icons Development Notes

GeneratedIconsAs some of you may have seen I have post an image on Twitter yesterday. With icons from our mod, all of those where done in 3 seconds, well that is if we don’t count the time spent developing and configuring the Icon Generator part of the IDE, which took about 3 hours as most of it was already done. Still making those icons would take about as much time as it took to make the software to generate those. It still isn’t perfect but for now it works fines and will definitely be useful now to see the object icon in game and later on to generate proper icons.

How does it work?

First thing that was needed to get those done was the Model Viewer, I have shown few version on Twitter of it over the past 2 months. The Model Viewer required shaders that will look similar to the TUG ones, loading OBJ files, loading TGA textures, calculating tangents(that was one of the most time consuming tasks in the IDE) and exporting the view to an image(this one was the most annoying, it isn’t as simple as it should be…).

Once I had the Model Viewer done, I had a way to render the OBJ files, but no way to load them from the TUG’s TXT files (aka TUGON), luckily I had a parser already so it was just a matter of getting it to find the nodes that where contained the needed info. At first it was just the first object, later on I added support for multiple objects from 1 files.

That was all good and working fine, but getting the model to be visible and centered is a whole different story, the temporary solution I came up with was to use Frustum (3D View Parameters, usually used for culling) and checking if the Bounding Box fits, if it doesn’t move away from the center by 0.1, not the best solution but it works.

Once I had all of those done it was just a matter of putting them together. That was the easiest part.

What now?

The the Icon Generator is nowhere near a release stage. The icons are not centered and it crashed randomly, not sure if it is the graphics driver or my PC or a problem in the code, updating the graphics driver sometimes fixes it.

The Icon Generator part still needs a lot of work, I need to find a better way to center the object, allow for different view angles and work on the lighting.

Please don’t ask me to release it now, it isn’t ready yet, if someone wants to have their icons generated let me know, it just a matter of adding the path and running it.

More?

Hmm… OK so I can get it to generate all icons from TUG, not just modded ones, and it works with all of the folder from mods.txt, in the proper order.

GeneratedIcons2

We (Me and Sigil) have more plans for the models and textures utilities, the icon generating is just a small one, but a useful one, we plan to automate things as much as possible, everything from fixing normals, fixing textures, optimizing textures to generating textures and models.

We have even more plans for the IDE, since it will be able to edit LUA and the TUGON (TUG’s TXT files) we want to get it to connect everything together in a way that allows for easy editing, renaming and auto-complete(or selecting files/object).

Update on TUG IDE

It has been a while since I last posted about the TUG IDE.

I have got good few things working, but I didn’t have much time to write about them or make videos. I have been busy with stuff not related to TUG, mostly working on websites and making a small program.

Since the content I have posted from the IDE is all over the place, I will go through all of it here. Some of features/functions are still WIP or barely working or crashing. I will be fixing all of the bugs once I get most of planned stuff working.

I’m hoping to have an experimental build up are running within 2/3 weeks from now, but as always there is a lot that could go wrong so it could be delayed (or quicker if I get lucky).

Here is the current status as of 2014.12.08, each time I will update I will be making a new post, so if you are looking for the most recent status check the most recent post in TUG IDE.

TUGON (TUG’s txt)

  • Loading (loading and parsing works already)
  • Debugger (it will report all of the syntax errors)
  • Displaying (Text – WIP)
  • Editor (WIP)
  • Connecting with Models and Script files (WIP)

OBJ Models

  • Loading (it works with TUG models, most models exported with Blender, Maya, Maya LT and probably most of the modeling software)
  • Loading from TUGON files (WIP)
  • Displaying (shaders, normal maps, diffuse maps and light works)
  • Exporting (WIP)

Model Viewer

  • Loading (fully working for OBJs and TGA textures)
  • Shaders (diffuse maps + normal maps + 1 light working)
  • Switching texture (WIP)
  • Reload (WIP)

LUA Editor

  • Editor (WIP)
  • Syntax Highlighting (WIP)
  • Error highlighting (WIP)