fun idea

05/15/2013 19:54 Smaehtin#16
The screen shake effect in CO is fucking ridiculously annoying because the client doesn't center the screen after the effect is over >_____>
05/15/2013 21:04 InfamousNoone#17
well i just finished abstracting pcs's weather system (yes, I'm doing minor work with them) got permission from ffc that it's ok to post this code:

Code:
    public class RainSupplier : WeatherSupplier
    {
        public RainSupplier(GameMap map)
            : base(map, 3) // max 3 per quadrant
        {
            WeatherSpeed = 10000;
            BlendFactor = 0.5;
            ModifyColor = Color.Gray;
            WeatherColor = Color.Cyan;
            Direction = 165;
            Intensity = 1000;
            Type = WeatherType.Rain;
        }
        protected override void BeginProcess(GameMapArea q, DateTime time)
        {
            base.BeginProcess(q, time);

            // create our effects
            int amount = r.Next(1, EffectAmount);
            for (int i = 0; i <= amount; i++)
            {
                int x = q.X + r.Next(0, GameMap.QuadrantSize);
                int y = q.Y + r.Next(0, GameMap.QuadrantSize);
                SetEffect(i, 1000, 0, x, y);
            }
        }
        protected override void RenderEffects(IEntity entity, DateTime time, int index)
        {
            base.RenderEffects(entity, time, index);

            var strikePos = GetEffectPosition(index);
            // to-do: did this entity get hit by the lightning?
        }
    }
so as fang said, the over all idea is super easy lol, just combining a few packets at best; and yeah I haven't found a way to recenter the screen after shaking it either.
05/15/2013 21:09 Smaehtin#18
Quote:
Originally Posted by InfamousNoone View Post
well i just finished abstracting pcs's weather system (yes, I'm doing minor work with them) got permission from ffc that it's ok to post this code:
Lol bad coder using var and stuff.
05/15/2013 21:13 InfamousNoone#19
no you're right I don't know whats being returned is a Position, the GetEffectPosition isn't a dead give away... nor is the suffix strikePos, let's not start this bullshit again
05/15/2013 21:22 Spirited#20
I didn't evaluate the problem in the same way. It doesn't seem to be that the weather itself is the problem for the original poster. I'm fairly sure there are examples of weather on the forum, and I know you have a public example in your packet library. The problem the original poster seems to be having is with showing the thunder. I recommended that he used effects to do so. I'm not sure how weather is created in the client, but a solution using string packets would work (it would also synchronize the thunder for characters on the map).
05/15/2013 21:36 _DreadNought_#21
Quote:
Originally Posted by InfamousNoone View Post
well i just finished abstracting pcs's weather system (yes, I'm doing minor work with them) got permission from ffc that it's ok to post this code:

Code:
    public class RainSupplier : WeatherSupplier
    {
        public RainSupplier(GameMap map)
            : base(map, 3) // max 3 per quadrant
        {
            WeatherSpeed = 10000;
            BlendFactor = 0.5;
            ModifyColor = Color.Gray;
            WeatherColor = Color.Cyan;
            Direction = 165;
            Intensity = 1000;
            Type = WeatherType.Rain;
        }
        protected override void BeginProcess(GameMapArea q, DateTime time)
        {
            base.BeginProcess(q, time);

            // create our effects
            int amount = r.Next(1, EffectAmount);
            for (int i = 0; i <= amount; i++)
            {
                int x = q.X + r.Next(0, GameMap.QuadrantSize);
                int y = q.Y + r.Next(0, GameMap.QuadrantSize);
                SetEffect(i, 1000, 0, x, y);
            }
        }
        protected override void RenderEffects(IEntity entity, DateTime time, int index)
        {
            base.RenderEffects(entity, time, index);

            var strikePos = GetEffectPosition(index);
            // to-do: did this entity get hit by the lightning?
        }
    }
so as fang said, the over all idea is super easy lol, just combining a few packets at best; and yeah I haven't found a way to recenter the screen after shaking it either.
I thought it was only the 'bounce' effect that messed with the screen? o.O

As for re-centering the screen, any alteration to the clients screen in that manner cannot be controlled server-side afaik.
05/15/2013 21:47 LordGragen.#22
i have made a exmaple here but i am sure its horible,

idk how to make the thunder effect hit random so i made it this for for testing.

Code:
 if (client.Entity.MapID == 1505)
            {

                Weather weather = new Weather(true);
                weather.WeatherType = Weather.Rain;
                weather.Direction = 165;
                weather.Intensity = 1000;
                weather.Send(client);

            }
 if (client.Entity.MapID == 1505)
                            {

                                _String str = new _String(true);
                                str.UID = client.Entity.UID;
                                str.TextsCount = 1;
                                str.Type = _String.Effect;
                                str.Texts.Add("Thunder");
                                client.SendScreen(str, true);
                                System.Threading.Thread.Sleep(5000);
                            }
and its was prty fun but

just need to fix sending the thunder in different place since the code i used it hitting on you only
05/15/2013 22:38 _DreadNought_#23
Quote:
Originally Posted by LordGragen. View Post
i have made a exmaple here but i am sure its horible,

idk how to make the thunder effect hit random so i made it this for for testing.

Code:
 if (client.Entity.MapID == 1505)
            {

                Weather weather = new Weather(true);
                weather.WeatherType = Weather.Rain;
                weather.Direction = 165;
                weather.Intensity = 1000;
                weather.Send(client);

            }
 if (client.Entity.MapID == 1505)
                            {

                                _String str = new _String(true);
                                str.UID = client.Entity.UID;
                                str.TextsCount = 1;
                                str.Type = _String.Effect;
                                str.Texts.Add("Thunder");
                                client.SendScreen(str, true);
                                System.Threading.Thread.Sleep(5000);
                            }
and its was prty fun but

just need to fix sending the thunder in different place since the code i used it hitting on you only
Cast it as an actual spell :O (Since you will be adding damage I presume.
05/15/2013 22:51 pro4never#24
Quote:
Originally Posted by LordGragen. View Post
...

I think the issue there is that if you code it as part of the actual weather system there is

A: No way to check where a bolt hits (so nothing dynamic can be done such as hitting specific objects)

B: No way to check WHEN a bolt hits (for sounds)

C: Pretty sure it won't look right (all weather effects blow accross screen rather than a static animation). Could be that you could edit it to work for your needs but it will never look as good or be as useful as casting a spell at random location.



If you don't like the 0 then there are ways to display an effect at X/Y. None of them will look as good but it CAN be done.


Casting spell at X/Y is ideal because it handles the following automatically.

-Proper animation at known location
-Proper sound on activation
-Damage calculations and targeting in small AOE around hit location


You can edit the spell to look/sound however you want (larger spell, ground breaking apart effect, new sounds, etc) but the method they are demonstrating is likely the most effective in the game.

Shaking is likely possible but gets a bit more tricky to do properly is all.
05/15/2013 23:03 InfamousNoone#25
Quote:
Originally Posted by pro4never View Post
I think the issue there is that if you code it as part of the actual weather system there is

A: No way to check where a bolt hits (so nothing dynamic can be done such as hitting specific objects)

B: No way to check WHEN a bolt hits (for sounds)

C: Pretty sure it won't look right (all weather effects blow accross screen rather than a static animation). Could be that you could edit it to work for your needs but it will never look as good or be as useful as casting a spell at random location.



If you don't like the 0 then there are ways to display an effect at X/Y. None of them will look as good but it CAN be done.


Casting spell at X/Y is ideal because it handles the following automatically.

-Proper animation at known location
-Proper sound on activation
-Damage calculations and targeting in small AOE around hit location


You can edit the spell to look/sound however you want (larger spell, ground breaking apart effect, new sounds, etc) but the method they are demonstrating is likely the most effective in the game.

Shaking is likely possible but gets a bit more tricky to do properly is all.
A/B/C are all covered in my posted code... uh?
The 0 can be removed, we're working on it :)
05/15/2013 23:13 pro4never#26
Quote:
Originally Posted by InfamousNoone View Post
A/B/C are all covered in my posted code... uh?
The 0 can be removed, we're working on it :)
I'm referring to him wanting his lightening to be a custom weather effect rather than spell casts....


Your system is how it should be done and what I'm arguing for him to use (well, something similar)


<edit>

Just noticed that I got ninja'd when I posted. I'll make sure I'm quoting him so it's clear. Figured being the direct next response that it would be obvious who i was talking to <3
05/15/2013 23:14 LordGragen.#27
infamouse, i did not understand your code well but is the part you send your thunder diferent places, coz the way i made with the loop it only hits on you.

Code:
   protected override void BeginProcess(GameMapArea q, DateTime time)
        {
            base.BeginProcess(q, time);

            // create our effects
            int amount = r.Next(1, EffectAmount);
            for (int i = 0; i <= amount; i++)
            {
                int x = q.X + r.Next(0, GameMap.QuadrantSize);
                int y = q.Y + r.Next(0, GameMap.QuadrantSize);
                SetEffect(i, 1000, 0, x, y);
            }
        }
is this sending the thunder random place in the screen?

and pro4never, yes i am going to use his way since i love the idea that store hiting the players time to time XD its more epic for dungeons
05/15/2013 23:35 pro4never#28
If the spell is hitting your location then you are using targetUID rather than sending spell with a X/Y value instead.


The code you quoted is taking the entire quadrant of a map and generating a random location within it. It then sends that spell to all clients within visible range of that random location.
05/15/2013 23:47 InfamousNoone#29
BeginProcess is called when weather is being rendered for a specific quadrant, this is to prepare any nessecary effects for that quadrant, so it generates a possibility of 3 thunder effects (on random x,y's within the quadrant)

RedenderEffect is called for each entity in the quadrant, and displays the effect(s) to them, any additional processing can be done in this function as well; refer to comment

EndProcess which is not shown here, since it's not needed to be overidden is used to clean up any additional resources your BeginProcess may have created

SetEffect places a spell effect on a specific x,y coordinate
05/15/2013 23:53 LordGragen.#30
Quote:
Originally Posted by pro4never View Post
If the spell is hitting your location then you are using targetUID rather than sending spell with a X/Y value instead.


The code you quoted is taking the entire quadrant of a map and generating a random location within it. It then sends that spell to all clients within visible range of that random location.
gotcha, yah what i think is better if i make the storm hit the player like you say by using targetUID

i think it will be better hitting the player every 20-30 sec prob like 200 dmg per atk,

i am just having a bit problem how to build the atk system instead of just the effect going on you.

and ty infamous for explaining