Jump to content

Recoil

Contributors
  • Posts

    184
  • Joined

  • Last visited

Everything posted by Recoil

  1. I'm wanting to get a general idea of what it would take to convert from using full tilesheets to single tiles. I figure something like this would allow for organization of the tiles, instead of several dozen sheets with some having the same tiles on them. This is probably not going to happen, but I am exploring all of my option before moving on.
  2. But it is nice tho... http://i60.tinypic.com/2rg1aol.jpg[/img]
  3. Um, yeah...thinks for bringing that up because I totally failed to check. I am running 18-19 right now Edit: Damian is running fine, but outside I am running 19-20 FPS after a restart. Inside I am running 97 so I will have to look into.
  4. Okay guys and gals...for those of you who have been looking at this post to find out how to do the lighting in VB.NET, the code that is posted only works partially and does not provide a full lighting render like we all want. That being said I finally was able to figure out how to do the lighting. I had done it previously, except the image I was using was not good. I plan on releasing yet another update to our Orion Revamped engine. It will have the updated lighting render subs in it so it will be easier to understand. I'll put links up here and in my sig so hopefully it will show. Stay tuned! http://i62.tinypic.com/311vrbk.jpg[/img]
  5. Sub DrawNight() If Map.Moral = MapMoralIndoors Then Exit Sub Dim tmpSprite As Sprite tmpSprite = New Sprite(NightGfx) '32, 32) ' tmpSprite.TextureRect = New IntRect(0, 0, frmMainGame.GameScreen.Width, frmMainGame.GameScreen.Height) tmpSprite.Color = New SFML.Graphics.Color(255, 255, 255, CurrLevel) tmpSprite.Position = New Vector2f(0, 0) Dim tmpBuffer As New RenderTexture(frmMainGame.GameScreen.Width, frmMainGame.GameScreen.Height) tmpBuffer.Clear() 'SFML.Graphics.Color.Black) tmpSprite.Draw(tmpBuffer, New RenderStates(BlendMode.Alpha)) For X = TileView.left To TileView.right + 1 For Y = TileView.top To TileView.bottom + 1 If IsValidMapPoint(X, Y) Then If Map.Tile(X, Y).Type = TileTypeLight Then Dim tmpLight As Sprite tmpLight = New Sprite(LightGfx) tmpLight.TextureRect = New IntRect(0, 0, tmpLight.Texture.Size.X, tmpLight.Texture.Size.Y) tmpLight.Color = New SFML.Graphics.Color(255, 255, 255, CurrLevel) tmpLight.Origin = New Vector2f(tmpLight.Texture.Size.X / 2 - 32, tmpLight.Texture.Size.Y / 2 - 32) tmpLight.Position = New Vector2f(ConvertMapX(X * 32), ConvertMapY(Y * 32)) tmpLight.Draw(tmpBuffer, New RenderStates(BlendMode.Add)) End If End If Next Next tmpBuffer.Display() 'Dim tmpBuff As Sprite - declared at top tmpBuff = New Sprite(tmpBuffer.Texture) '32, 32) ' tmpBuff.TextureRect = New IntRect(0, 0, frmMainGame.GameScreen.Width, frmMainGame.GameScreen.Height) 'tmpBuff.Color = New SFML.Graphics.Color(255, 255, 255, CurrLevel) tmpBuff.Position = New Vector2f(0, 0) GameWindow.Draw(tmpBuff, New RenderStates(BlendMode.Multiply)) End Sub
  6. That worked perfectly, yet it didn't LOL. It did not have the outcome I was trying to achieve. So I am going to try this another way. Using the above code, how would I offset the image being drawn? Like instead of drawing at point x, y...offset that by an amount of say -64 so it would be 2 squares off? Dim tmpSprite As Sprite tmpSprite = New Sprite(NightGfx) tmpSprite.TextureRect = New IntRect(0, 0, 32, 32) tmpSprite.Color = New SFML.Graphics.Color(255, 255, 255, CurrLevel) tmpSprite.Position = New Vector2f(ConvertMapX(x * 32), ConvertMapY(y * 32)) If IsValidMapPoint(x, y) Then GameWindow.Draw(tmpSprite, New RenderStates(BlendMode.None)) End If Edit to add: I got it: tmpSprite.Origin = New Vector2f(tmpSprite.Texture.Size.X / 2 - 32, tmpSprite.Texture.Size.Y / 2 - 32)
  7. I would like to try and draw just black tiles on the screen to see if that will help with my lighting issue. Currently this draws 1 tile at the top left. When I maximize my window it stretches slightly, but not much. How do I correctly render black tiles all across the game screen? For X = TileView.left To TileView.right + 1 For Y = TileView.top To TileView.bottom + 1 If IsValidMapPoint(X, Y) Then DrawNight(X, Y) End If Next Next Dim tmpSprite As Sprite tmpSprite = New Sprite(NightGfx) tmpSprite.TextureRect = New IntRect(0, 0, 32, 32) tmpSprite.Color = New SFML.Graphics.Color(255, 255, 255, CurrLevel) tmpSprite.Position = New Vector2f(x, y) If IsValidMapPoint(x, y) Then GameWindow.Draw(tmpSprite, New RenderStates(BlendMode.None)) End If
  8. Connect() is being called 3 times. If I use my connect only, and comment out the one in ClientGenral->ConnectToServer and sub Startup, when it obtains a connection where I am calling it, then it allows the button to be clicked. I go and login with my char, and the server says "admin has logged in from xxx.xxx.x.x". When I close this out it still disconnect 2 of the same ip connections. It isn't a problem, I can bypass these exceptions and it work fie. I'm just trying to resolve all these connection errors I am getting when there is no client for the server to close the connection.
  9. When I bring up my client it tries to connect before I allow my Play button to be enabled. I'm checking if the server is up with Connect(): Private Sub tmrConnect_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles tmrConnect.Tick Static i As Long If IsConnected() Then lblServerStatus.ForeColor = Color.Green lblServerStatus.Text = "Online" Else lblServerStatus.ForeColor = Color.Red i = i + 1 If i = 5 Then Connect() lblServerStatus.Text = "Reconnecting" i = 0 Else lblServerStatus.Text = "Offline" End If End If End Sub What happens is I get a connection to the server. When I log in I get another connection to the server. When I log out I lose 2 connections from the server. I know how to ping the ip, but I cannot check the ping through that method. How would I check if the server is actually up, like a peek method, without creating a connection, or at least be able to close the connection?
  10. I totally forgot about the disposal code... For i = 1 To NumItems 'If Not ItemsGfx(i) Is Nothing Then ItemsGfx(i).Dispose() ItemIcons(i).Disposer() Next The commented out part is how it used to do it. I left it in just in case there were any problems with my class drawing the items and spells. My class file cuts down about 200 lines of drawing code I had for all of my panels...it make putting new panels in so much easier. I have 103 images in my items folder...here is the code that pulls them: Public Sub CheckItems() Dim i As Long i = 1 While FileExist(Application.StartupPath & GFX_PATH & "Items\" & i & GFX_EXT) NumItems = NumItems + 1 i = i + 1 End While If NumItems = 0 Then Exit Sub End Sub So yeah, I think because there is never an ItemGfx(0) then it was just going to keep with the error. But a heads up to anyone else running into this issue.
  11. I will check shortly, but because there is no item(0) then it cannot dispose of the item. As soon as I made that a 1 the problem stopped. Of course I have more errors, mostly related to the connect, but that is another thread. I will update this when I can.
  12. I never had all the exceptions on so I don't know if this was a problem on the original code. I have tracked this down to InitGraphics I believe. Here is the way this was previously done: ReDim ItemIcons(0 To NumItems) ReDim ItemsGfx(0 To NumItems) ReDim ItemsGfxInfo(0 To NumItems) For i = 1 To NumItems ItemIcons(i).Init(New Bitmap(Application.StartupPath & GFX_PATH & ITEMS_PATH & i & GFX_EXT)) If FileExist(Application.StartupPath & GFX_PATH & ITEMS_PATH & i & GFX_EXT) Then Dim bmp As New Bitmap(Application.StartupPath & GFX_PATH & ITEMS_PATH & i & GFX_EXT) End If TempBitmap = New Bitmap(Application.StartupPath & GFX_PATH & ITEMS_PATH & i & GFX_EXT) ItemsGfxInfo(i).Width = TempBitmap.Width ItemsGfxInfo(i).Height = TempBitmap.Height _transcolor = TempBitmap.GetPixel(0, 0) _memStream = New MemoryStream() TempBitmap.Save(_memStream, ImageFormat.Png) ItemsGfx(i) = New Texture(_memStream) _memStream.Dispose() Next Here is the way I am doing it now: ReDim ItemIcons(0 To NumItems) For i = 1 To NumItems ItemIcons(i) = New OrionGfxControl(False) ItemIcons(i).Init(New Bitmap(Application.StartupPath & GFX_PATH & ITEMS_PATH & i & GFX_EXT)) Next I am using my control to make the icons. It either has something to do with that, or this: Does the (0 To NumItems) & (For i = 1 To NumItems) supposed to be the same? If so I believe all of the init's are off in graphics.
  13. I have tried LastServerTime = GetTickCount() + (RateAmount(GameTimeRate) / 60) and vice-versa, but this is not working. Before I mess up too much I want to get an idea of what to do. Public Sub AddServerTime() LastServerTime = GetTickCount() + (RateAmount(GameTimeRate)) 'Dim sec As Integer If ServerSecond <= 86400 Then ServerSecond += (MinuteAmount(GameTimeAmount)) End If If ServerSecond >= 86400 Then ServerSecond = 0 End If ServerMinute = ((ServerSecond - (ServerSecond Mod 60)) / 60) Mod 60 ' Minutes ServerHour = ((ServerSecond - ((ServerSecond Mod 60) + (ServerMinute * 60))) / 3600) Mod 60 ' Hours CurrentServerMinute = ServerMinute ' Testing to send to now players who join between updates frmServer.lblServerTime.Text = Format(ServerHour, "00") & ":" & Format(ServerMinute, "00") GetTimeOfDay() CurrentTimeOfDay = GetTimeOfDay() 'Do every hour here... If ServerMinute = 0 Then SendTime(ServerMinute) End If End Sub
  14. In my current server method I am doing: LastServerTime = GetTickCount() + RateAmount(GameTimeRate) Instead I want to update this every server minute, so I am going to do this: LastServerTime = GetTickCount() + RateAmount(GameTimeRate/60) However, I only want to send the time every hour. In between counts I am setting another minute variable to send to players who join in between counts. CurrentServerMinute = ServerMinute So at the end of my sub I am sending: SendTime(ServerMinute) This is shortened version of my original because I am passing everything else through as set globals. What would I check against on the last part, If server minute = 0 then send to all?
  15. Here is the final fix for anyone who is not able to see the shoutbox: LastServerTime = GetTickCount() + (1000 / (ServerTimeAmount / ServerTimeRate)) I could not have gotten this without JC's help...thanks man! The full solution should be posted later on today in a side project. Keep your eyes out for Orion Revamped!
  16. When I launch the server, I set the amount of minutes to 30, the rate in seconds is set to 30. Every 30 seconds I am updating the client's time +30 minutes. The client should add minutes in between the server updates: ' Tick works too instead of tmr1000 If tmr1000 > LastServerTime Then LastServerTime = GetTickCount() + 1000 If ClientMinute <= 60 Then ClientMinute += 1 End If If ClientMinute >= 60 Then ClientMinute = 0 End If End If This will work if I have it set to {send 30 minutes every 30 seconds}. The timer1000 needs to adjust for the rate of time the server is set at though, or I need to add that to the LastServerTime instead of +1000.
  17. Here is how I am getting the time on the server. We want this to calculate at X speed of real time. GameTimeRate is how often this updates, which is set by a nud control on the server. The values for it are 0-3600 (seconds). GameTimeAmount is the amount of minutes to change, which is set by a cbo control on the server. The values for it are 10/20/30/40/50/60. So far this works and I am able to correctly calculate the amount of real time for the day/night to last in modServerLoop: If Tick > LastServerTime Then LastServerTime = GetTickCount() +(GameTimeRate * 1000) Dim sec As Integer If sec <= 86400 Then sec += (MinuteAmount(GameTimeAmount)) End If If sec >= 86400 Then sec = 0 End If ServerSeconds = sec ServerMinute = ((sec - (sec Mod 60)) / 60) Mod 60 ' Minutes ServerHour = ((sec - ((sec Mod 60) + (ServerMinute * 60))) / 3600) Mod 60 ' Hours frmServer.lblServerTime.Text = Format(ServerHour, "00") & ":" & Format(ServerMinute, "00") SendTimeOfDay() End If Private Function MinuteAmount(ByVal amt As Integer) As Integer Select Case amt Case Is = 0 Return 0 Case Is = 10 Return 6 * 100 Case Is = 20 Return 12 * 100 Case Is = 30 Return 18 * 100 Case Is = 40 Return 24 * 100 Case Is = 50 Return 30 * 100 Case Is = 60 Return 36 * 100 End Select End Function I want to find out what exactly I need to pass from the client to the server to have it keep up with time on it's own?
  18. Okay, so I have this partially working. The only problem is the arbitrary value set below. This will work when the server is set to QuickTimeSpeed x10, which is sending 60 minutes every 360 seconds (6min). But if change the x10 value to something else I have to really tweak the arbitrary value to get it to line up. However, when the servers time does loop through and sends the ClientMinute gets corrected and continues to count from there. If Tick > LastServerTime Then LastServerTime = GetTickCount() + (ServerTimeRate * 17) ' - Arbitrary value ClientMinute += 1 End If I wanted to see if I could get some sort of idea to fix this, or what values exactly I have to calculate to get this to line up depending on the rate of the time and the amount of time being passed.
  19. I am passing the value of the server's last server time now: LastServerTime = GetTickCount() + RateAmount(GameTimeRate) GameTimeTickCount = LastServerTime But this is not going to work. Right now I need to just save the values that the server is sending instead of the client taking off where it left off at before it was set. I don't see why it is reverting back to its original count time.
  20. Right now I am sending the time from the server to the client. The server has a rate and amount that the client gets so it can keep track of time in between server updates. For testing I am sending 10 minutes (amount) every 60 seconds (rate). Right now my times are offset so I can verify that the client keeps the new server time. When I send the packet for the time it should be setting the time on the client, which it does, but then the client starts back where it left off at: Private Sub Packet_Time(ByRef data() As Byte) Dim buffer As ByteBuffer buffer = New ByteBuffer buffer.WriteBytes(data) If buffer.ReadLong <> ServerPackets.STime Then Exit Sub ClientHour = buffer.ReadLong ClientMinute = buffer.ReadLong ClientTimeOfDay = buffer.ReadLong CGameTimeRate = buffer.ReadLong CGameTimeAmount = buffer.ReadLong buffer = Nothing End Sub Here's my functions with the offsets: Private Function RateAmount(ByVal amt As Integer) As Integer Return Val(amt) * 100 '0 End Function Private Function MinuteAmount(ByVal amt As Integer) As Integer Select Case amt Case Is = 0 Return 0 Case Is = 10 Return 6 * 10 '0 Case Is = 20 Return 12 * 10 '0 Case Is = 30 Return 18 * 10 '0 Case Is = 40 Return 24 * 10 '0 Case Is = 50 Return 30 * 10 '0 Case Is = 60 Return 36 * 10 '0 End Select End Function This is where I am calculating my client time in the game loop: If Tick > LastServerTime Then LastServerTime = GetTickCount() + RateAmount(CGameTimeRate) Dim sec As Integer If sec <= 86400 Then sec += (MinuteAmount(CGameTimeAmount)) End If If sec >= 86400 Then sec = 0 End If ClientMinute = ((sec - (sec Mod 60)) / 60) Mod 60 ' Minutes ClientHour = ((sec - ((sec Mod 60) + (ClientMinute * 60))) / 3600) Mod 60 ' Hours End If My second question, how do I correctly set the time on the client to calculate once it is getting and keeping the time from the server? I have tried setting 2 additional server time variables for the hour and minutes, but those didn't work.
  21. I figured the second issue out. If the spell has a cast time of 0 then it will boot. If Spell(PlayerSpells(SpellBuffer)).CastTime > 0 Then barWidth = ((GetTickCount() - SpellBufferTimer) / ((GetTickCount() - SpellBufferTimer) + (Spell(PlayerSpells(SpellBuffer)).CastTime * 1000)) * 64) End If
  22. I am running into 2 different problems. Right now I can attack an npc, but if I let it kill me then about 3/4 of the time I get the following null exception in Client Graphics on the following code. The line the error is happening on is right under the ''' Xml comment: {"Object reference not set to an instance of an object."} Public Sub DrawMapTile(ByVal locX As Long, ByVal locY As Long) Dim i As Long Dim srcrect As New Rectangle(0, 0, 0, 0) Dim tmpSprite As Sprite If GettingMap Then Exit Sub With Map.Tile(locX, locY) For i = MapLayer.Ground To MapLayer.Mask2 ' skip tile if tileset isn't set ''' If .Layer(i).Tileset > 0 Then With srcrect .X = Map.Tile(locX, locY).Layer(i).X * 32 .Y = Map.Tile(locX, locY).Layer(i).Y * 32 .Width = 32 .Height = 32 End With tmpSprite = New Sprite(TileSetTexture(.Layer(i).Tileset)) tmpSprite.TextureRect = New IntRect(srcrect.X, srcrect.Y, srcrect.Width, srcrect.Height) tmpSprite.Position = New Vector2f(ConvertMapX(locX * PIC_X), ConvertMapY(locY * PIC_Y)) GameWindow.Draw(tmpSprite) End If Next End With End Sub Or the same error here: Public Sub DrawMapAni(ByVal locX As Long, ByVal locY As Long, ByVal LayerNum As Long) Dim srcrect As New Rectangle(0, 0, 0, 0) Dim tmpSprite As Sprite If GettingMap Or Not ShowAnimLayers Then Exit Sub With Map.Tile(locX, locY) ' skip tile if tileset isn't set ''' If .Layer(LayerNum).Tileset > 0 Then With srcrect .X = Map.Tile(locX, locY).Layer(LayerNum).X * 32 .Y = Map.Tile(locX, locY).Layer(LayerNum).Y * 32 .Width = 32 .Height = 32 End With tmpSprite = New Sprite(TileSetTexture(.Layer(LayerNum).Tileset)) tmpSprite.TextureRect = New IntRect(srcrect.X, srcrect.Y, srcrect.Width, srcrect.Height) tmpSprite.Position = New Vector2f(ConvertMapX(locX * PIC_X), ConvertMapY(locY * PIC_Y)) GameWindow.Draw(tmpSprite) End If End With End Sub My second issue is when I double click inside my spells panel to cast a spell on the npc. 99% of the time I will pull this in only 1 location in code, still in ClientGraphics: {"Arithmetic operation resulted in an overflow."} Public Sub DrawBars() Dim tmpY As Long Dim tmpX As Long Dim barWidth As Long Dim rec(1) As Rectangle ' check for casting time bar If SpellBuffer > 0 Then ' lock to player tmpX = GetPlayerX(MyIndex) * PIC_X + Player(MyIndex).XOffset tmpY = GetPlayerY(MyIndex) * PIC_Y + Player(MyIndex).YOffset + 35 ' calculate the width to fill ''' barWidth = ((GetTickCount() - SpellBufferTimer) / ((GetTickCount() - SpellBufferTimer) + (Spell(PlayerSpells(SpellBuffer)).CastTime * 1000)) * 64) ' draw bars rec(1) = New Rectangle(ConvertMapX(tmpX), ConvertMapY(tmpY), barWidth, 4) Dim rectShape As New RectangleShape(New Vector2f(barWidth, 4)) rectShape.Position = New Vector2f(ConvertMapX(tmpX), ConvertMapY(tmpY)) rectShape.FillColor = SFML.Graphics.Color.Cyan GameWindow.Draw(rectShape) End If End Sub
  23. Server->ServerTypes: Public MapNpcs As New List(Of MapData) MapData class Public Class MapData Public Property Npc() As New List(Of Integer) Public Sub New() For i = 0 To Constants.MaxMapNpcs Npc.Add(0) Next End Sub End Class
  24. This is back in Server, modGeneral, Startup. This is pulling a null value on startup: For i = 0 To MaxPlayers 'Banks.Add(New Bank()) Banks.Item.Add(New PlayerInv()) ' ReDim Bank.Item(0 To MaxBank) ' For x = 0 To Stats.StatCount - 1 ' ReDim Bank.Item(i).AddStat(x) ' Next ' For x = 0 To Stats.StatCount - 1 ' ReDim Bank.Item(i).StatReq(x) ' Next Next Here is my bank class: Imports OrionRevampedGeneral.Core Public Class Bank Public Property Item As New List(Of PlayerInv) Public Sub New() For i = 0 To Constants.MaxPlayers Item.Add(New PlayerInv()) Next End Sub End Class
  25. I have commented out stuff instead of deleting it: For i = 0 To MaxPlayers Players.Add(New Player()) 'For x = 0 To Vitals.VitalCount - 1 ' ReDim players(i).Vital(x) 'Next 'For x = 0 To Stats.StatCount - 1 ' ReDim Player(i).Stat(x) 'Next 'For x = 0 To Equipment.EquipmentCount - 1 ' ReDim Player(i).Equipment(x) 'Next Items.Add(New Item()) ReDim Items(0 To MaxBank) For x = 0 To Stats.StatCount - 1 ReDim Items(i).AddStat(x) Next For x = 0 To Stats.StatCount - 1 ReDim Items(i).StatReq(x) Next Next
×
×
  • Create New...