Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. How I accidentally slowed gr1d's server to a crawl... [modified]

How I accidentally slowed gr1d's server to a crawl... [modified]

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasegame-devsysadminagentic-aixml
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dawmail333
    wrote on last edited by
    #1

    Before I get started, some background: gr1d[^] is a (very new) persistent multiplayer programming AI game: the idea is you code your agents and upload them, and let them do their thing. (Check it out, if you haven't!) Now, with these agents, they have to inherit an interface. For brevity, I'll reduce it to the relevant details:

    Public Class πRateSapient
    Implements gr1d.API.Agent.IPirate1

    ...

    Public Sub Tick(ByVal agentUpdate As Gr1d.Api.Agent.IAgentUpdateInfo) Implements ...
    ' Logic here
    End Sub

    (VB is NOT the code horror, thank you very much! :P ) Now, in my infinite wisdom, I started some abstractions. This included building it so all AIs under that schema (my search/claim/don't go picking fights) operated under the same logic. How'd I do this? Well:

    Public Module Logic

    Public Sub Tick(ByVal agent As πRateSapient, ByVal update As Agent.IAgentUpdateInfo)
    ' Logic here
    End Sub

    ... Can you see where this is going? I didn't.

    Public Class πRateSapient
    Implements gr1d.API.Agent.IPirate1

    ...

    Public Sub Tick(ByVal agentUpdate As Gr1d.Api.Agent.IAgentUpdateInfo) Implements ...
    Me.Tick(agentUpdate)
    End Sub

    ... No debugging, no thought put into it, I just thought it'd call the extension method. Whoops. And yeah, it was sloooow. Moral of the story folks: think about your damn naming conventions, especially if you're using extension methods!!! :doh: (And I was wondering why my agents did nothing!) (Also, may I mention that running the game logic, and the site, on the same instance is also a bit of a horror?) Hope you laughed. :laugh: [edit] To be fair, I wasn't the only one with a recursive loop. But I sure as hell didn't help. xD [/edit]

    Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

    modified on Wednesday, December 22, 2010 6:05 AM

    D W 2 Replies Last reply
    0
    • D dawmail333

      Before I get started, some background: gr1d[^] is a (very new) persistent multiplayer programming AI game: the idea is you code your agents and upload them, and let them do their thing. (Check it out, if you haven't!) Now, with these agents, they have to inherit an interface. For brevity, I'll reduce it to the relevant details:

      Public Class πRateSapient
      Implements gr1d.API.Agent.IPirate1

      ...

      Public Sub Tick(ByVal agentUpdate As Gr1d.Api.Agent.IAgentUpdateInfo) Implements ...
      ' Logic here
      End Sub

      (VB is NOT the code horror, thank you very much! :P ) Now, in my infinite wisdom, I started some abstractions. This included building it so all AIs under that schema (my search/claim/don't go picking fights) operated under the same logic. How'd I do this? Well:

      Public Module Logic

      Public Sub Tick(ByVal agent As πRateSapient, ByVal update As Agent.IAgentUpdateInfo)
      ' Logic here
      End Sub

      ... Can you see where this is going? I didn't.

      Public Class πRateSapient
      Implements gr1d.API.Agent.IPirate1

      ...

      Public Sub Tick(ByVal agentUpdate As Gr1d.Api.Agent.IAgentUpdateInfo) Implements ...
      Me.Tick(agentUpdate)
      End Sub

      ... No debugging, no thought put into it, I just thought it'd call the extension method. Whoops. And yeah, it was sloooow. Moral of the story folks: think about your damn naming conventions, especially if you're using extension methods!!! :doh: (And I was wondering why my agents did nothing!) (Also, may I mention that running the game logic, and the site, on the same instance is also a bit of a horror?) Hope you laughed. :laugh: [edit] To be fair, I wasn't the only one with a recursive loop. But I sure as hell didn't help. xD [/edit]

      Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

      modified on Wednesday, December 22, 2010 6:05 AM

      D Offline
      D Offline
      Dwayne J Baldwin
      wrote on last edited by
      #2

      Note that extension methods with the same name and signature as an interface or class method will never be called. http://msdn.microsoft.com/en-us/library/bb383977.aspx[^]

      Dwayne J. Baldwin

      D 1 Reply Last reply
      0
      • D dawmail333

        Before I get started, some background: gr1d[^] is a (very new) persistent multiplayer programming AI game: the idea is you code your agents and upload them, and let them do their thing. (Check it out, if you haven't!) Now, with these agents, they have to inherit an interface. For brevity, I'll reduce it to the relevant details:

        Public Class πRateSapient
        Implements gr1d.API.Agent.IPirate1

        ...

        Public Sub Tick(ByVal agentUpdate As Gr1d.Api.Agent.IAgentUpdateInfo) Implements ...
        ' Logic here
        End Sub

        (VB is NOT the code horror, thank you very much! :P ) Now, in my infinite wisdom, I started some abstractions. This included building it so all AIs under that schema (my search/claim/don't go picking fights) operated under the same logic. How'd I do this? Well:

        Public Module Logic

        Public Sub Tick(ByVal agent As πRateSapient, ByVal update As Agent.IAgentUpdateInfo)
        ' Logic here
        End Sub

        ... Can you see where this is going? I didn't.

        Public Class πRateSapient
        Implements gr1d.API.Agent.IPirate1

        ...

        Public Sub Tick(ByVal agentUpdate As Gr1d.Api.Agent.IAgentUpdateInfo) Implements ...
        Me.Tick(agentUpdate)
        End Sub

        ... No debugging, no thought put into it, I just thought it'd call the extension method. Whoops. And yeah, it was sloooow. Moral of the story folks: think about your damn naming conventions, especially if you're using extension methods!!! :doh: (And I was wondering why my agents did nothing!) (Also, may I mention that running the game logic, and the site, on the same instance is also a bit of a horror?) Hope you laughed. :laugh: [edit] To be fair, I wasn't the only one with a recursive loop. But I sure as hell didn't help. xD [/edit]

        Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

        modified on Wednesday, December 22, 2010 6:05 AM

        W Offline
        W Offline
        wizardzz
        wrote on last edited by
        #3

        Last time I tried to even check the site out, it was at a crawl.

        1 Reply Last reply
        0
        • D Dwayne J Baldwin

          Note that extension methods with the same name and signature as an interface or class method will never be called. http://msdn.microsoft.com/en-us/library/bb383977.aspx[^]

          Dwayne J. Baldwin

          D Offline
          D Offline
          dawmail333
          wrote on last edited by
          #4

          Kinda learned that one, didn't I? :P

          Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups