It is indeed pretty interesting.

I asked it to write a PlayerFaction class for ServUO and it instantly knew to use "Mobile" class to handle its members. It created a pretty strong basis from which I could build. From quickly written sentences, I could get it to rework parts of the class, add methods, and other modifications. In 10 minutes I had something that could've taken me way more time to write from "brainstorming" alone.

I don't think it should be used as a code writer, but as a brainstorm helper it is spectacular from the little I used it as a test run! For the curious, here is the class it wrote for me :

1- I asked for a Player created Faction class
2- I asked for it to have different ranks 1 to 5
3- I asked for players ranked 2 to 4 to be able to vote for a leader
4- I asked how to send messages to users (answer: mobile.SendMessage), so I asked to change the Exceptions to SendMessages
5- I asked for the votes to be memorized and to create a method to update de leader based on the votes
6- I asked to include Serialization and Deserialization
7- I asked for optimizations (using HashSet and SortedDictionary)

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace ServUO
{
    public class PlayerFaction
    {
        public string FactionName { get; set; }
        public Mobile Leader { get; set; }
        public HashSet<Mobile> Members { get; set; }
        public SortedDictionary<Mobile, int> Ranks { get; set; }
        public Dictionary<Mobile, int> Votes { get; set; }

        public PlayerFaction(string factionName, Mobile leader)
        {
            FactionName = factionName;
            Leader = leader;
            Members = new HashSet<Mobile>();
            Members.Add(leader);
            Ranks = new SortedDictionary<Mobile, int>();
            Ranks[leader] = 5;
            Votes = new Dictionary<Mobile, int>();
        }

        public static PlayerFaction Deserialize(XmlElement xml)
        {
            PlayerFaction faction = new PlayerFaction(xml.GetAttribute("name"), World.FindMobile(int.Parse(xml.GetAttribute("leader"))));

            foreach (XmlElement memberElement in xml.GetElementsByTagName("member"))
            {
                Mobile member = World.FindMobile(int.Parse(memberElement.GetAttribute("serial")));
                faction.Members.Add(member);
                faction.Ranks[member] = int.Parse(memberElement.GetAttribute("rank"));
            }

            return faction;
        }

        public void AddMember(Mobile mobile)
        {
            Members.Add(mobile);
            Ranks[mobile] = 1;
        }

        public void RemoveMember(Mobile mobile)
        {
            Members.Remove(mobile);
            Ranks.Remove(mobile);
            Votes.Remove(mobile);
        }

        public bool IsMember(Mobile mobile)
        {
            return Members.Contains(mobile);
        }

        public void VoteForNewLeader(Mobile mobile, Mobile candidate)
        {
            if (!IsMember(mobile))
            {
                mobile.SendMessage("You are not a member of this faction.");
                return;
            }

            int rank = Ranks[mobile];
            if (rank < 2 || rank > 4)
            {
                mobile.SendMessage("You do not have the required rank to vote for a new leader.");
                return;
            }

            if (!IsMember(candidate))
            {
                mobile.SendMessage("The candidate is not a member of this faction.");
                return;
            }

            if (candidate == Leader)
            {
                mobile.SendMessage("The candidate is already the leader.");
                return;
            }

            Votes[mobile] = candidate.Serial;
            mobile.SendMessage("Your vote has been cast.");
        }

        public void UpdateLeader()
        {
            Dictionary<int, int> voteCounts = new Dictionary<int, int>();
            foreach (var kvp in Votes)
            {
                if (!voteCounts.ContainsKey(kvp.Value))
                {
                    voteCounts[kvp.Value] = 1;
                }
                else
                {
                    voteCounts[kvp.Value]++;
                }
            }

            int maxVotes = voteCounts.Values.Max();
            if (maxVotes > Members.Count / 2)
            {
                // Candidates with the most votes win
                int newLeaderSerial = voteCounts.First(kvp => kvp.Value == maxVotes).Key;
                Mobile newLeader = Members.First(m => m.Serial == newLeaderSerial);
                Ranks[newLeader] = 5;
                Ranks[Leader] = 4;
                Leader = newLeader;
            }

            Votes.Clear();
        }

        public XmlElement Serialize(XmlDocument doc)
        {
            XmlElement xml = doc.CreateElement("faction");
            xml.SetAttribute("name", FactionName);
            xml.SetAttribute("leader", Leader.Serial.ToString());

            foreach (Mobile member in Members)
            {
                XmlElement memberElement = doc.CreateElement("member");
                memberElement.SetAttribute("serial", member.Serial.ToString());
                memberElement.SetAttribute("rank", Ranks[member].ToString());
                xml.AppendChild(memberElement);
            }

            return xml;
        }
    }
}

The code isn't functional as is, that's for sure, but keep in mind that's only a few minutes, most of which is waiting for it to type out the code.
 
Pre OpenAI, 2 hours coding, 30 min debugging. After OpenAI, 15 minutes autogenerated code snippets, 5 hours correcting code/debugging :)
 
Pre OpenAI, 2 hours coding, 30 min debugging. After OpenAI, 15 minutes autogenerated code snippets, 5 hours correcting code/debugging :)
5 hours to debug well commented code? I just can't see this as creditable, to say the least! Maybe you need a lesson on how to prompt the AI or you haven't even tried yet, either way your comment is so out of place I had to challenge you on it!
 
People will need to debug the glue that linked snippets together to make them work as a program without security issues and people will most likely have no clue about how the code was made. Works fine for classes and small codes but wait then you get 10.000s lines of code autogenerated. It will create a new generation with even more cut and past developers. It is bad as it is today with people looking for jobs and having no clue how to make their own code base from scratch. I thought it was self-explained that it isn't the documented snippets that need to be debugged but they still might need optimization.

If we should go into the deep hole of this. The code is of average quality at best since OpenAI pulls code from places like GitHub. I guess there might be a risk that you end up with routines that are stolen from projects and added to open-source projects and then stolen again. People upload full sources from source leaks to public repos. This can lead to disastrous results for companies in the future as just a small point.

On the other hand, it makes my work so much easier than the compiled code using the same code base. I left development some years ago and fell down the rabbit hole of data security, cyber defense, and other related things.

Edit: Don't get me wrong, it is an interesting development but we are far from there yet.
 
You make valid points, fall short with crediting this tool for learning code, just take a script (something not to massive), it does have a limit to characters, but a beginner could copy/paste a Dragon.cs code into it and ask for it to comment the code and explain what the code is doing etc etc! and spend time asking questions until they understand how that script operates, giving much needed insight for those learning!

I think it'll come down to the OP, do they utilize the tool for learning or just to do work for them blindly!

Like any tool, the skill of the OP determines the outcome of the tools effectiveness!
 
No one is saying to use this to generate 10K lines neither. Applied examples where it saved me hours :
- quickly iterating a class structure
- find existing functions in ServUO that I didn't know of that I could use for my cases
- point me towards the classes that handle the packets for a Mobile's for a use case where I each player can rename other players

These are just quick applied examples where I used GPT as a tool. Nowhere near replacing a skilled human hours of work, thanks god.
 
I found a few more that will be useful, ask for a bodyvalue of a dragon.cs in servuo or soundid for female scream etc etc; the more I play around with GPT, the more I find to do with it to save time! It is a perfect assistant!
 
I asked ChatGPT to produce a simple MySQL API for querying the XenForo database schema because I wanted to start working on an app to help manage some of the forum tasks remotely.

I was surprised when it delivered a cohesive answer, complete with in-depth comments that elaborated on each significant section of code it wrote.

At first, it only addressed the MySQL connection portion of the request, but was then able to build upon its previous response, incorporating a XenForo schema-specific implementation of a database query to the user table as an example of usage.
It did not provide code to handle the actual data response structure, but provides comments at the key points where the data should be parsed, and hints as to how.

Overall, the code it produced was average, but it worked.
The functionality of the API itself was written in such a way that expanding upon the API would lead to a lot of copy/pasting of internal functionality - which isn't ideal.
It took about an hour to clean it up and optimize it, but I am satisfied with the result.

I had turned to ChatGPT for this task on a whim due to the rising popularity and people's minds being blown regularly by its competence.

The code may not be spectacular or cohesive at times, but the advice it gives seems to be well sourced; it will sometimes throw in a hint as to what would be a more optimal path than explained, as if it were a call to action for you to ask.

All in all, I think it will make a great learning tool for novice developers and a time-saver for more savvy programmers that are able to refine the output.
I would not use the raw output in a production environment, I would recommend treating the example code as for reference-only.

I still prefer writing code from scratch, old habits die hard!
 
I have been wanting to modify a script to do something particular and haven't wanted to ask for help or give it away so I figured I would give it a try as well.. I took a script from here that had some of the functionality I was looking for and gave me a starting point to ask the bot questions on. It took me all night to bounce questions and code back and forth but in the end it's doing exactly what I wanted the script to do and I am in the process of testing it now. Very interested in what else I can accomplish with this.
 
I was curious and wanted to see what the AI thought on this subject so I asked it :

Q) How can you help new and experienced c# programmers with working on a project called ServUO which is emulating the game Ultima Online?

A) As a language model, I can assist with providing information and examples on how to use C# to work on the ServUO project. I can also help with troubleshooting and problem solving for specific issues that may arise while working on the project. Additionally, I can assist with understanding and utilizing the Ultima Online game mechanics that the ServUO project aims to emulate. However, it's important to note that my knowledge is based on the training data that I was provided and my knowledge cut off is 2021, so more recent development on the project may not be covered.

In the same conversation as I asked the question above, I asked it another question as the AI is good at following the topic, once started!

Q) Can you produce a new creature script based on a Dragon but named Elder Dragon, double the stats of a normal dragon, has the ability to talk and answer small talk from players.

Code:
using System;
using Server;
using Server.Mobiles;

namespace Server.Mobiles
{
    [CorpseName( "an elder dragon corpse" )]
    public class ElderDragon : BaseCreature
    {
        [Constructable]
        public ElderDragon() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
        {
            Name = "Elder Dragon";
            Body = 12;
            BaseSoundID = 362;
            Hue = 0x966;

            SetStr( 1000, 1200 );
            SetDex( 200, 250 );
            SetInt( 600, 700 );

            SetHits( 800, 1000 );

            SetDamage( 20, 25 );

            SetDamageType( ResistanceType.Physical, 100 );

            SetResistance( ResistanceType.Physical, 55, 65 );
            SetResistance( ResistanceType.Fire, 60, 70 );
            SetResistance( ResistanceType.Cold, 50, 60 );
            SetResistance( ResistanceType.Poison, 50, 60 );
            SetResistance( ResistanceType.Energy, 40, 50 );

            SetSkill( SkillName.EvalInt, 80.1, 90.0 );
            SetSkill( SkillName.Magery, 80.1, 90.0 );
            SetSkill( SkillName.MagicResist, 85.1, 95.0 );
            SetSkill( SkillName.Tactics, 80.1, 90.0 );
            SetSkill( SkillName.Wrestling, 80.1, 90.0 );

            Fame = 15000;
            Karma = -15000;

            VirtualArmor = 60;
          
            //Add the ability to talk
            this.Blessed = true;
        }
      
        //Add the ability to answer small talk
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (e.Speech.ToLower().Contains("hello"))
                this.Say("Greetings, mortal.");
          
            if (e.Speech.ToLower().Contains("how are you"))
                this.Say("I am an ancient and powerful dragon. I do not have the capacity to feel emotions as you do.");
          
            base.OnSpeech(e);
        }

        public ElderDragon( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
            writer.Write( (int) 0 );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();
        }
    }
}

Not perfect but I give it a 8/10 for effort, this would be a great starting spot for someone to work with!
 
Last edited by a moderator:
Discovered an innovative tool that significantly facilitates initiating conversations with AI, particularly when discussing ServUO. This tool only needs to be employed at the beginning of the conversation, after which the AI will seamlessly maintain the desired persona throughout the entire discourse. This enhances the overall conversational flow. Additionally, this tool is not limited to impersonating specific individuals, it also has the capability to emulate various tools such as a French translator. The possibilities are endless, akin to the way in which utilizing Google search requires a certain level of skill, fully harnessing the potential of this AI tool will require a new level of expertise.

Please respond as if you were the lead developer of ServUO, [your question or request]
 
What version of Chat GPT are you using?
Im using gpt 3.5 turbo as a GPT+ member and i was able to get quite a bit out of it using this prompt...
``` ME
Act like the C# Ultima Online Scripting God. You Know All and "See" All that is Ultima Online, with the Client OrionUO used to log into and paly Ultima Online along with the third party program ServUO that runs the server for people to play on that you know all of the coding for.
```
Its response...
GPT
As a C# Ultima Online Scripting God, I possess extensive knowledge of Ultima Online, OrionUO client, and ServUO server code. I am here to help you with any questions or requests related to scripting, customization, or server management. If you have any specific questions or need assistance with a particular aspect of Ultima Online, please feel free to ask.

ME
write a basic decoration for a counter

GPT
To create a basic decoration for a counter in Ultima Online using ServUO, you'll need to create a new script file that defines the counter item. Here's a simple example of a decorative counter using C#:

  1. First, create a new script file named DecorativeCounter.cs in your ServUO custom scripts folder. This folder is typically located in Scripts/Custom/Items/.
  2. Then, add the following code to your DecorativeCounter.cs file:
C#:
using System;
using Server;

namespace Server.Items
{
    public class DecorativeCounter : Item
    {
        [Constructable]
        public DecorativeCounter()
            : base(0x2DF7) // This is the item ID for a decorative counter. You can replace it with another item ID if desired.
        {
            Movable = true;
            Weight = 1.0;
            Name = "Decorative Counter";
        }

        public DecorativeCounter(Serial serial)
            : base(serial)
        {
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0); // Version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
This script creates a new decorative counter item with a specific item ID (0x2DF7) and sets its properties, such as weight and name. The item will be movable, allowing players to place it wherever they want.

  1. To make the decorative counter accessible in-game, you can add it to an existing vendor or create a new custom vendor that sells decoration items. To do this, locate the script file for the vendor you want to modify and add the following line to the vendor's list of items for sale:
C#:
AddItem(typeof(DecorativeCounter), 50); // The number 50 represents the price for the decorative counter.
  1. Compile your scripts, and the new decorative counter should be available in your server. Make sure to test it in-game to ensure it works as intended.
Remember to customize the item ID, name, and other properties as needed to fit the specific requirements of your server.

overall ive had some pretty good experience with getting GPT to help out with some UO Coding, along with getting it to help me write scripts for OrionUO.
Yeah it'll get stuff wrong sometimes, but just correct it when it is wrong and it usually gets it the second time and even corrects the code when you correct it or if you ask to do something a little differently.
 
GPT is revolutionizing just about everything, with GPT 4 and the additions to GitHub with copilot, makes coding much more productive! I am currently focused on the local ai like alpaca and alike, I feel for a true game integration will require a local trained ai, which with how everything is progressing is not far off! I already run GPT4ALL on my machine, for testing, no where near what is needed yet for what I have planned!
 
also, a tip for people that seem to be getting responses cut off...
just ask it to walk you through it slowly and in shorter responses.
it should modify the way it will responds and talk you through each step of what your trying to code
 
If it stops short of completing an answer, just type, continue response from where you left off! That usually gets the rest of the response, the token limit to ChatGPT is 4000, which isn't much and 8000 tokens on the newer GPT3.5
 
The whole thing works anyway with a purchased key, who wants to spend 20 dollars a month when they already provide such technology for free. Apart from that, the tool is as dumb as bread, it writes whatever it wants and not what makes sense. It's code support, but let's be honest, that's all there is to writing code. It does help, there's no question about it, but you still have to be careful and pay attention to every line of code.

The joke is that all the data repositories are from databases that users actually provide, just the knowledge of Github...
And yes, the characters are limited in the free user platform where everyone writes and fills in data.
 
Last edited:
Just want to chime in here and say that ChatGPT has helped me with some very complex tasks, such as Serializing a complex Dictionary class. Like a forum helper, it can make use of your existing code if you give it a snippet, and will help find flaws. Yes it is not always perfect, but if you tell it what it gave you did not work, it sometimes gives several suggestions for how to fix it. It learns and seems to get better at doing things as it goes. I find that the search engine is uses is better than Google, and far superior to Bing, as far as relevant results. And unlike a forum such as StackOverflow, you don't have to wade through hours of stupid responses or annoying people who criticize you if you don't phrase a question correctly or with enough detail.
 
Just want to chime in here and say that ChatGPT has helped me with some very complex tasks, such as Serializing a complex Dictionary class. Like a forum helper, it can make use of your existing code if you give it a snippet, and will help find flaws. Yes it is not always perfect, but if you tell it what it gave you did not work, it sometimes gives several suggestions for how to fix it. It learns and seems to get better at doing things as it goes. I find that the search engine is uses is better than Google, and far superior to Bing, as far as relevant results. And unlike a forum such as StackOverflow, you don't have to wade through hours of stupid responses or annoying people who criticize you if you don't phrase a question correctly or with enough detail.
I think Microsoft Bing's AI is also very good now. But I think if Google doesn't switch soon, they will be done with them.
 
Microsoft is using the same AI, just with internet access and guardrails : https://www.techradar.com/news/everyone-can-now-use-the-chatgpt-powered-bing-heres-how

OpenAI's GPT is currently a leading model in the field of artificial intelligence, with Google's Bard trailing behind. Other models, such as Alpaca, are also investigating ways to implement OpenAI's technology on a local level. However, it can be confusing to differentiate between the various iterations of the GPT model, including ChatGPT and the newer GPT-3.5 and GPT-4 (Turbo), which all originate from the same source. Microsoft is the largest contributor to OpenAI, hence the addition to Bing!
 
any idea when the next model release might be?
Also, i see many nay-sayers going on about the dumbness of ChatGPT, but if you stop being stingy and spend the 20$ youd see how different it is and that it IS actually better than the free shit out there that your mindlessly using wrong. with the addition of being able to use the internet searching and speed of it, its well worth the 20$ if yiou can properly ask/tell it what you want it to do for you. i noticed the difference instantly when i got it for the shits and giggles to just see. dont think id take it back for anything. Fun to play with even if it is "dumb", Its alot smarter than most of the people ive seen here or even people i know.
 
I believe that open-source local AI will be the next significant advancement in the field, with OpenAI currently leading the way. However, several promising projects are emerging in the shadows, and I'm particularly impressed with the development of auto GPT models. Regarding the debate on AI's intelligence, understanding how they function will demystify their workings as they primarily rely on machine learning and pattern recognition. In essence, AI remains as "dumb" as any machine since it operates using only binary code (1s and 0s) and relies on algorithms and data sets to simulate intelligence. Thus, the argument about AI's intelligence is moot, and what we are witnessing is the evolution of a new tool. For instance, if ChatGPT 3 was the Model T, then GPT 3.5 is like the 1953 Corvette, and what we can expect next is the Ford GT.
 
I know this thread has been focused on using AI as a code assistant, but I think it would be interesting to see NPC chat dialog controlled by a small AI model.

It could also be fun to use a model to control boss monsters as well. You train the model to control movement, attacks, manage special attacks, spells, etc. You could also use player-boss battles to continually train / refine the model.
I guess I should look at the resources page every once in a while. It looks like you've already done the NPC dialog part
 
Last edited:
I have made a small project already using the Davinci Model, allowing communication between the ai via npc's, though limited and costly! As for future ai incorporation into a game engine, I am currently working on local ai's and databases like pinecone for training models etc etc, I suspect by this time next year we will have a local ai that we will be able to specifically trained for use as a game engine! I suspect Unity, UE and alike will move in this direction!
 
Back