Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Improving engine speed


iHero
 Share

Recommended Posts

> Alright then, i stand corrected. that still doesn't mean you need to yell at someone. and like i said, it's your fault that you followed the tutorial. not ours, yours.
>
> Growlith1223

Then please go back to your earlier posts and edit them, and I shall go through and edit mine, so that people are not confused. The tutorial will bug people's game and they need to know that.

I know you're 16, but maybe next time you will try to research something before you come in to a thread and act like you know what you're talking about. It's a good lesson to learn. Only respond to people who are talking about something if you know what you're talking about.
Link to comment
Share on other sites

> so, who is right ? Growlith or Larias ? because i wanted to add this code to my project.. but not sure to add it or not..

Growlith admitted I was right in the above post. This is why I want him to edit his posts.

The first part of the code - the client side - will work just fine.

Everything after that will mess up your game. Don't do it until it's fixed.
Link to comment
Share on other sites

Sorry, did not need this scandal, but here's the code to fix: (I tested)

Find in Sub ServerLoop

```

' Checks to update player vitals every 5 seconds - Can be tweaked

If Tick > LastUpdatePlayerVitals Then

UpdatePlayerVitals

LastUpdatePlayerVitals = GetTickCount + 5000

End If

' Checks to spawn map items every 5 minutes - Can be tweaked

If Tick > LastUpdateMapSpawnItems Then

UpdateMapSpawnItems

LastUpdateMapSpawnItems = GetTickCount + 300000

End If

' Checks to save players every 5 minutes - Can be tweaked

If Tick > LastUpdateSavePlayers Then

UpdateSavePlayers

LastUpdateSavePlayers = GetTickCount + 300000

End If
```

And delete

Replace _Sub UpdateSavePlayers_ for:

```

Private Sub UpdatePlayerVitals(ByVal index As Integer)

If Not TempPlayer(index).stopRegen Then

If GetPlayerVital(index, Vitals.HP) <> GetPlayerMaxVital(index, Vitals.HP) Then

Call SetPlayerVital(index, Vitals.HP, GetPlayerVital(index, Vitals.HP) + GetPlayerVitalRegen(index, Vitals.HP))

Call SendVital(index, Vitals.HP)

' send vitals to party if in one

If TempPlayer(index).inParty > 0 Then SendPartyVitals TempPlayer(index).inParty, index

End If

If GetPlayerVital(index, Vitals.MP) <> GetPlayerMaxVital(index, Vitals.MP) Then

Call SetPlayerVital(index, Vitals.MP, GetPlayerVital(index, Vitals.MP) + GetPlayerVitalRegen(index, Vitals.MP))

Call SendVital(index, Vitals.MP)

' send vitals to party if in one

If TempPlayer(index).inParty > 0 Then SendPartyVitals TempPlayer(index).inParty, index

End If

End If

End Sub
```

Replace _Sub UpdateSavePlayers_ for:

```

Private Sub UpdateSavePlayers(ByVal index As Integer)

Dim i As Long

' Prevent subscript out range

If Not IsPlaying(index) Then Exit Sub

' Save player

Call TextAdd("Saving all online players...")

Call SavePlayer(index)

Call SaveBank(index)

End Sub
```
Link to comment
Share on other sites

> Sorry, did not need this scandal, but here's the code to fix: (I tested)

The scandal had nothing to do with you ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) <3

Are you sure that

```
' Player loop

For i = 1 To Player_HighIndex

If IsPlaying(i) Then

If Tick > tmr25 Then

' check if they've completed casting, and if so set the actual Spell going
```
Is okay? that was where my program was having problems.
Link to comment
Share on other sites

> Please refrain from using Integers…use a Long instead for the UpdateSavePlayers(ByVal Index As Integer)
>
> Sincerely,
>
> Growlith1223

No. It is recommended to use Bytes, since the maximum number of player hardly will pass of 255 (Maximum byte value). And it is impossible to pass of 32767 (Maximum integer value)
Link to comment
Share on other sites

> No. It is recommended to use Bytes, since the maximum number of player hardly will pass of 255 (Maximum byte value). And it is impossible to pass of 32767 (Maximum integer value)

Yeah but the actual variable (index) is sent around as a long so you should be using it.
Link to comment
Share on other sites

  • 2 weeks later...
This is my first negavite post since unban, but i must post this.

DO NOT USE THIS TUTORIAL

Reasons:

* Massive server CPS drop (as [Kyle](http://www.touchofdeathforums.com/community/index.php?/user/49159-kyle9217/) stated above)
* This will broke a lot of timers (i mean GetTickCount timers, not VB6 ones) becouse of placing timers into loops
* Becouse of above reason, for example only Map# UpdateMapLogic is processed, and for other maps it isn´t

Idk why no1 noticed this, but i think reason is that nobody tested it (except [Kyle](http://www.touchofdeathforums.com/community/index.php?/user/49159-kyle9217/))
Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...