Reply: Can't apply the PQ codes for the Speedometer in Marble Blast Gold

NOTE: You are posting the message as a 'Guest', you can not edit the message or delete it
Please Log in or Register to skip this step.
X

Topic History of: Can't apply the PQ codes for the Speedometer in Marble Blast Gold

Max. showing the last 20 posts - (Last post first)

  • RandomityGuy
  • RandomityGuy's Avatar
22 Apr 2025 14:30

This would be an easy thing to do at least, you can copy an existing GuiBitmapCtrl in PlayGui.gui (preferably just copy one of the elements defining the speedometer numbers, make sure to match the braces and the semicolon), and then you can move it around using the "position" parameter and size it accordingly through "extent" (have the ratio match with the size ratio of your image). The parameter 'bitmap' should be self explanatory.

  • BRD
  • BRD's Avatar
22 Apr 2025 14:24

One last thing. The "Speed:" text in, Marble/client/ui/speedometer/speed.png and that's it.

  • RandomityGuy
  • RandomityGuy's Avatar
22 Apr 2025 08:26

Hello, I would advise against directly using code from PlatinumQuest as is without having sufficient experience, since they are usually coupled with the systems programmed in the game by the developers (they are just usual abstractions and design patterns you'd find everywhere in software engineering side). It's a mature mod that has undergone over a decade of changes during development and as a result, the codebase is significantly different from that of MBG; Things that were handled in MBG are now done differently to take into account the complexity of features and the flexibility of the codebase required to ease future development, as a result one cannot simply just copy code over from PQ and expect it to work as it is. Moreover, there are a few pitfalls that are usually discovered when modding the game. One such pitfall is basically lack of access to the marble velocity which prevents one from directly just using it to implement the speedometer. PlatinumQuest has access to this since it runs on a modified version of the game that exposes that variable to Torquescript. This privilege is not available in Marble Blast Gold so what modifications predating PQ did was to manually calculate the marble velocity based on basic physics/science (the formula: distance travelled divided by time taken results in speed, and ideally it should be taught at some point in school), and then display that value on the user interface. In future, I suggest looking into scripts of other mods apart from PQ whose source is available. (such as MBPU and MBRewind off the top of the head) 
​​

I have attached below the modified scripts with the speedometer interface as well as the necessary code for it. The interface won't exactly match with the one in PQ (since thats a bit more troublesome to implement), but it does its job well.
My additions are at the end of the file, with comments explaining the math.

File Attachment:

File Name: PlayGUI.gui
File Size:14 KB
 

File Attachment:

File Name: playgui.cs
File Size:11 KB

  • BRD
  • BRD's Avatar
21 Apr 2025 20:52

I tried to setup the Speedometer in MBG by using PQ's codes but it failed. Can you help me please?

Attachments:
Time to create page: 0.671 seconds