jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

ENH: news feed and/or global command and/or welcome to trade zone X message #70

Open jpcsupplies opened 8 years ago

jpcsupplies commented 8 years ago

Was just pondering what I liked about other 4x games trade, and one thing that stuck in my mind was "News reports"

In other single player games, events that occur in game that the player was involved in; get written to a game "news paper" where it often lists the players name and participation.

The usefulness of this is probably restricted by what we can and cannot detect in game from modAPI.

In a simple sense this could just be an admin triggered message, that pops up in game; and is written by an admin (for notifying players about events etc) It should probably check if a player is in a ship or not; and piloting or passenger, so pop up boxes dont open when a player is probably trying not to crash into something. Just message the screen in that case or wait until they get out next.

It would work similarly to a MOTD, but can be triggered at any time the admin wants, not just on connect.

The news could also be semi-automated, for example when Economy detects certain events occuring, it logs them into a "news" log which players can view any time (or subscribe to for a fee) with /news

This could also be a useful application of player contracts for example - "Newsflash: The infamous criminal Bob the Griefer was caught and killed in a recent skirmish with Screaming Angel. For their valor; they were awarded a 5000 {credits} bounty"

\ {credits would be whatever name the currency was given in the config file} *\ {probably need to use range check to see who was nearest when player was killed}

This could also use range checks for hostile activity reports - Another example: "Pirates attack!" Pirate activity has been detected in the area of {trade region name} {reportedly Screaming Angel fought them off; neutralizing {2} ships..}

Another example: Declare war event: Galactic war!: Faction {x} just declared war on {y}; {Player}, the leader of {x} was quoted as saying - we cannot tolerate {y} any more!

Alliance request event: Peace talks! Faction {x} has made overtures to faction {y} to form an alliance.. time will tell where these negotiations lead.

Alliance accept event: Trade alliance! Faction {x} just formed an alliance with {y}. Both leaders were quoted as hoping this new alliance will be mutually beneficial to our trade.

Alliance removes at war flag Galactic Peace! Faction {x} is no longer at war with {y}!

Player with most kills? Top Gun! Screaming Angels has clocked up {4} kills!

When a cockpit is hacked and a ship stolen Theft! {faction/player} {cruiser/ship} (large/small) has been reported stolen!

Etc..

These might not all be practical, but it should be a good enhancement for role play heavy servers.


Ok so -

jpcsupplies commented 8 years ago

Probably should have time stamps too

jpcsupplies commented 8 years ago

I just thought of a feature of this that is so obvious I am kicking myself..

When a player enters a new trade zone - i was thinking have the game generate the player a GPS point for it.. (easy done just like your scanore command) but also pop up a greeting message like the trade station just hailed your etc... This message could pop up on first encountering the trade zone when it sets the GPS point and display a brief greeting the owner of the zone can configure. On subsequent visits, just display the message in chat. This is entirely client side..

This also means we probably should do something similar on the NPC trade zone, although that would be obviously set by the server owner. Thoughts? @midspace ?

midspace commented 8 years ago

Yes, I was thinking of a "Welcome to the xxxx trade zone" message.

That's why the MarketStruct has a DisplayName. It must be defined when the Market is created. https://github.com/jpcsupplies/Economy_mod/blob/master/Economy/Data/Scripts/Economy.scripts/EconStructures/MarketStruct.cs

My only concern was how often we do a check to determine when a player has entered a zone. It can't be too often, as it'll be cycling each player for each zone. Unless, we palm this processing off to the client side, but then we'll have to start passing zone location data to the client when a zone is created or deleted, or moved. When you are talking about a moving trade zone, it starts to get costly to transfer that detail to clients every time it moves.

And then, you might have a player that doesn't want to send a notification message, because they operate like a black market.

And you could have a "You are now leaving the xxxx trade zone. Have a nice day!" message.

As for GPS. I hadn't considered it. It works better with the message. But then, it should be tied to a beacon at that point.

hmmm... hadn't thought of that. A beacon, which is not only the entity which controls the center of the trade zone, but also the size.

jpcsupplies commented 8 years ago

Beacon idea sounds pretty good actually, palms off the process from our script entirely.. if a player is in a trade region bam there it is. Its how the beacons are /manually/ set up on Ramblers frontier in the trade zone now. Only downside there is some players discussed the possibility of a station or crate being related to their trade zone - a beacon makes it pretty obvious where it is. But if we dont use crates it wont matter.

The gps idea has merit too, as the players can look it up and even set autopilot or jump points with it when they need to travel there. Is there any easy way to add a gps point to a player? I assume so - that is how your metal detector.scanner worked.

Going left field here, if we use an antenna instead of a beacon.. players can make crude "trade networks" which makes the antennas visible to their faction at least from outside the region, although they still cant trade until they are closer, it mitigates the need for a GPS slightly, but then they cant autopilot or jump to it. (but then they will probably add their own gps them self anyway)

midspace commented 8 years ago

http://forums.keenswh.com/threads/modding-api-new-requests.7141893/page-7#post-1286942455

Then you can use something like this to play a sound:

private MyEntity3DSoundEmitter m_soundEmitter;
        public MyEntity3DSoundEmitter SoundEmitter { get { return m_soundEmitter; } }
        m_soundEmitter = new MyEntity3DSoundEmitter(Container.Entity as VRage.Game.Entity.MyEntity);

        public static void PlaySound(this IMyFunctionalBlock ftl, string soundname, bool stopPrevious = false)
        {
            MyEntity3DSoundEmitter emitter = null;

            if( ftl.IsFTL() )
                emitter = ftl.GameLogic.GetAs<FTL>().SoundEmitter;
            if( emitter != null )
            {
                if (string.IsNullOrEmpty(soundname))
                {
                    emitter.StopSound((emitter.Loop ? true : false), true);
                }
                else
                {
                    MySoundPair sound = new MySoundPair(soundname);
                    emitter.CustomMaxDistance = (float)ftl.GetTopMostParent().PositionComp.WorldVolume.Radius * 2.0f;
                    Logger.Instance.LogDebug("Distance: " + emitter.CustomMaxDistance);
                    emitter.CustomVolume = 1.0f;
                    emitter.PlaySound(sound, stopPrevious);
                }
            }
        }
jpcsupplies commented 8 years ago

Ah. so we call playsound ((from a block?), name of sound goes here,) we get 3dsoundemitter create an emitter point, pair it with a sound.. i think it grabs the volume setting.. logs the sound playing then triggers the sound, stopping any that were already playing..

Assuming we can play a sound added to the workshop mod, that should do it with a bit of fiddling..

i gather it makes more sense to you as you are more familiar with these various object references.

This example (appears to be) to be pairing to an FTL block and letting the game do all the 3d positional sound business... so i assume we could adapt it to attach it to one of our [economy] tagged LCDs which would work more or less as I was hoping.. but also means anyone on the ship hears it too ?

jpcsupplies commented 8 years ago

Ok here is where we stand here: Stage 1 news system: /global (admin) and /news (players)

Stage 2 news system /global, /news, /addevent ?, /contracts

Also - We need some common timing loop client side only used for doing things like updating LCDs, checking/updating the GPS location, checking balance, checking if a player has entered a trade zone.. contract counts etc.. The LCDs already catch trade zones so it may be adaptable to also send the zone name to a client, and update the other things. But this may require offloading some elements of the LCD updates to client side only instead of server side - which i think isnt practical?

This may also have the effect or not impacting server side sim much either - but i expect it means lcds are only updating client side under this scenario which may be problematic. Tricky part is how to do it ?

jpcsupplies commented 7 years ago

Probably also need an on-connect and in-game notification along the lines of a message stating: You have X unread news items. You have received a new news item.

Etc