Elvas Tower: Using AI to generate\Help developers? - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using AI to generate\Help developers? It is possible to use the AI Systems for Help Developers with the code Rate Topic: -----

#1 User is offline   FS.E652 091 

  • Conductor
  • Group: Status: Active Member
  • Posts: 277
  • Joined: 22-April 14
  • Gender:Male
  • Location:Sicily
  • Simulator:ORTS
  • Country:

Posted 30 April 2023 - 02:27 AM

Hi guys, together with another friend, we tested an advanced artificial intelligence to be able to understand if actually these programs can be useful to help developers to be able to better edit the Open Rails codes.
We did a test to interface Arduino systems with keyboard controllers and we succeeded (there are only a few holes to fix).

Having said that, I asked the AI ​​to develop, for example, a C# language code that allows you to edit the water Shaders, and this is what follows:


To change the water shader in Open Rails using the C# programming language, you need to use the DirectX development library.

Here is a C# code example that allows you to change the water shader in Open Rails using DirectX:

csharp

using System;
using System.Windows.Forms;
using Microsoft.DirectX.Direct3D;

OpenRails namespace
{
public partial class Form1 : Form
{
private Device devices;
private Effect waterShader;
private string waterShaderFile = "water.fx"; // Name of the water shader file

public Form1()
{
InitializeComponent();
InitializeGraphics();
}

private void InitializeGraphics()
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);

// Load the water shader
waterShader = Effect.FromFile(device, waterShaderFile, null, ShaderFlags.None, null);
}

private void Render()
{
// Use the water shader for rendering
device.SetVertexShader(waterShader);
device.SetPixelShader(waterShader);

// Render the water
// ...

// Reset shaders to default
device.SetVertexShader(null);
device.SetPixelShader(null);
}
}
}

In this code example, a DirectX Device object is created, which represents the video card and handles graphics rendering. The water.fx file containing the water shader is then loaded.

In the Render function, the water shader is set as the current shader used for rendering water. After rendering the water, the default shaders are restored for rendering the other objects.

This is just a sample of code that you can use as a starting point for changing the water shader in Open Rails. You'll need to customize the code to suit your specific needs and the version of Open Rails you're using.

In your opinion, is it possible\useful to be able to support such a program to have more support\help in the development of the code? Could it be a positive outcome for the team?

#2 User is offline   gpz 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,772
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 30 April 2023 - 12:03 PM

Basicly this is how the shaders are handled in Openrails, so there is nothing new in this code. Different library used, more sophisticated loading than this simplyfied code piece, but the same basic concept.

#3 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,359
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 30 April 2023 - 08:42 PM

View Postgpz, on 30 April 2023 - 12:03 PM, said:

Basicly this is how the shaders are handled in Openrails, so there is nothing new in this code. Different library used, more sophisticated loading than this simplyfied code piece, but the same basic concept.


Yes, but the basenote is simply an example.

Years ago a very bright programmer who professionally wrote code for satellites added some code in the loader that others, for a very long time, found completely incomprehensible. It worked but nobody understood how. If that block of code is still present it might be worthwhile to toss it at ChatGPT with a request to explain how it works. Or re-write it so ordinary humans can follow what it does and maintain it with greater ease. Maybe something of use comes back, maybe not. Either way some exploration of ChatGPT might make clear more feasible opportunities.

#4 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,014
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 01 May 2023 - 12:51 AM

View PostGenma Saotome, on 30 April 2023 - 08:42 PM, said:

...It worked but nobody understood how...

To me the opposite occurs sometimes: it doesn't work but I don't understand why :rtfm:

#5 User is offline   gpz 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,772
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 01 May 2023 - 04:51 AM

The Visual Studio built-in ChatGPT integration is tied to Azure-subscription, which we hobby-programmers don't have, I suppose. So personally I cannot check what specific help it could provide by analising the whole program package. The free functionality is limited to a dozen of program lines only. For example it can help refactoring LINQ functions to foreach loops, which can help e.g. in reducing allocations.

#6 User is offline   FS.E652 091 

  • Conductor
  • Group: Status: Active Member
  • Posts: 277
  • Joined: 22-April 14
  • Gender:Male
  • Location:Sicily
  • Simulator:ORTS
  • Country:

Posted 01 May 2023 - 04:11 PM

In other words, it can help provided that you know the foundations of the C# code and be able to correct any incorrect parameters.
On water shaders I think you should definitely interface the graphic shader to the code, i.e. have a physical structure of the water and associate it to the code, the same goes if you need to implement some visual or dynamic atmospheric phenomenon, anyway..
Typically I would see it quite useful, so I opened a topic about it, if we have to project ourselves into the future, everything at least I think it's legitimate :-D

#7 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,359
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 01 May 2023 - 06:53 PM

View Postgpz, on 01 May 2023 - 04:51 AM, said:

The Visual Studio built-in ChatGPT integration is tied to Azure-subscription, which we hobby-programmers don't have, I suppose. So personally I cannot check what specific help it could provide by analising the whole program package. The free functionality is limited to a dozen of program lines only. For example it can help refactoring LINQ functions to foreach loops, which can help e.g. in reducing allocations.



I see a year subscription to ChatGPT is $240. Is that for a team or per person?

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users