Mirage Source
MS4 - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+----- Thread: MS4 (/showthread.php?tid=3065)

Pages: 1 2


MS4 - Matt - 18-08-2009

This is my version of MS4, with a lot of help from Jacob.

What makes this one different from the current release? Dynamic maps.

You can set the maps from the default max_mapx and max_mapy to 255. 255x255 is the biggest you can go and trust me, there's no need to go higher than that.

With the byte array packets sending maps that large won't be a problem. Even that huge, they will send just as fast as a normal size map.

Anyways, I've bored you enough. Here's the download: MS4 Dynamic Maps, Byte Arrays


Re: MS4 - Kousaten - 18-08-2009

I've got a pretty good feeling there's another step other than setting MAX_MAPX and MAX_MAPY...

[Image: dynamic5050.png]


Re: MS4 - Matt - 18-08-2009

Haha. I didn't fully test it all. I just did the byte array packets over the pass 2 days or so. I'll get it fixed. Thanks.


Re: MS4 - Matt - 18-08-2009

Actually, after showing Jacob this, he told me what you did wrong. You don't change the map size in the code. When you edit a map, you change it in the properties for that map. Wink


Re: MS4 - Kousaten - 18-08-2009

:o Oh-hoh. So that's how to make it work.

Thanks guys. Smile


Re: MS4 - Matt - 18-08-2009

Kousaten Wrote::o Oh-hoh. So that's how to make it work.

Thanks guys. Smile

Lol. After all the debugging we did with the byte arrays, I was going to kill you if you had found another bug. >.>


Re: MS4 - Kousaten - 18-08-2009

Nah. Tongue It works beautifully.

I was going to write in seamless for MS4, but this works a ton better since you don't have to make excess maps for filling in the black spots.


Re: MS4 - Matt - 18-08-2009

Kousaten Wrote:Nah. Tongue It works beautifully.

I was going to write in seamless for MS4, but this works a ton better since you don't have to make excess maps for filling in the black spots.

Yupp.


Re: MS4 - Jacob - 18-08-2009

You will need to think about dynamically changing NPC and Item limits for larger maps.


Re: MS4 - Kousaten - 18-08-2009

Otherwise you're going to end up with a few very sparse maps. :3 I hear ya~


Re: MS4 - Matt - 18-08-2009

In my game source, I have it to where you can set 1 to 50 npcs per map and you choose how many go on each map.


Re: MS4 - Jacob - 18-08-2009

I got all crazy with my setup:
viewtopic.php?f=8&t=5147&start=0&hilit=npc+spawn


Re: MS4 - Kousaten - 18-08-2009

One problem I did notice was that the map name doesn't draw properly--this causes it to just stay where it was on the original sized map.

I fixed it by changing:

Code:
' Draw map name
        Call DrawText(TexthDC, DrawMapNameX, DrawMapNameY, Map.Name, DrawMapNameColor)

To:

Code:
' Draw map name
        Call DrawText(TexthDC, Camera.Right - ((Len(Map.Name) \ 2) * 28), Camera.Top + 1, Map.Name, DrawMapNameColor)

Unfortunately I am horrid at properly centering things. This draws the name starting at the left, as opposed to actually centering said text.


Re: MS4 - Ellesar - 18-08-2009

Quote:One problem I did notice was that the map name doesn't draw properly--this causes it to just stay where it was on the original sized map.

I fixed it by changing:

Code: Select all
' Draw map name
Call DrawText(TexthDC, DrawMapNameX, DrawMapNameY, Map.Name, DrawMapNameColor)



To:

Code: Select all
' Draw map name
Call DrawText(TexthDC, Camera.Right - ((Len(Map.Name) \ 2) * 28), Camera.Top + 1, Map.Name, DrawMapNameColor)



Unfortunately I am horrid at properly centering things. This draws the name starting at the left, as opposed to actually centering said text.

Anyways it's no a byg deal. In Rpg Maker program happens the same thing, at least those who i tried.

But i'm going to ask one thing.
I Just generated the .exe server and client, enter in the game and changed te map size from propietes of map editor, but the max tile that i could re-size the map was 30x30, it's that correct? or i'm forggoting something?


Re: MS4 - Matt - 18-08-2009

Max is 255x255. I know it works, as I have checked it.

Jacob sent me the fix for the map name a long time ago, I'll look in my email and see if I still have it.


Re: MS4 - Kousaten - 18-08-2009

Thanks again. Big Grin I'd much rather have a proper fix than my slapped-together patch.


Re: MS4 - Matt - 18-08-2009

I don't have it, but I'm sure Jacob wouldn't mind posting a fix for it. Wink


Re: MS4 - Matt - 19-08-2009

Server side find:

Code:
Sub HandleSaveNPC

Replace the whole sub with:

Code:
Private Sub HandleSaveNpc(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim NpcNum As Long
Dim Buffer As clsBuffer
Dim NpcSize As Long
Dim NpcData() As Byte

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Call HackingAttempt(Index, "Admin Cloning")
        Exit Sub
    End If
    
    Set Buffer = New clsBuffer

    Buffer.WriteBytes Data()
    
    NpcNum = Buffer.ReadLong
    
    ' Prevent hacking
    If NpcNum < 0 Or NpcNum > MAX_NpcS Then
        Call HackingAttempt(Index, "Invalid Npc Index")
        Exit Sub
    End If
    
    NpcSize = LenB(Npc(NpcNum))
    ReDim NpcData(NpcSize - 1)
    NpcData = Buffer.ReadBytes(NpcSize)
    CopyMemory ByVal VarPtr(Npc(NpcNum)), ByVal VarPtr(NpcData(0)), NpcSize
    
    ' Save it
    Call SendUpdateNpcToAll(NpcNum)
    Call SaveNpc(NpcNum)
    Call AddLog(GetPlayerName(Index) & " saved Npc #" & NpcNum & ".", ADMIN_LOG)
End Sub

I have also already updated the source download.


Re: MS4 - Matt - 19-08-2009

Found a bug and can't seem to pinpoint it so if anyone wants to help figure it out, please do.

When you put an npc on the map, it will spawn at first, but if you close the client and login again, it won't be there. However, if you edit the map properties, you will see that the npc is in fact saved and if you save the map again, it will spawn. I just don't understand it. >.


Re: MS4 - Matt - 19-08-2009

Fixed a lot of errors. I suggest you just redownload the source and go from there.


Re: MS4 - Xlithan - 03-09-2009

Well, I couldn't decide whether to use MS4 or Elysium 3.30. This is some good source. Basic MS4 with scrolling maps and HUGE map sizes is definately a winner for me.

Thanks a hell of a lot Matt (And Jacob, you never fail to impress me)


Re: MS4 - Xlithan - 07-09-2009

Question: What other features have been added to the source, just the byte arrays and larger maps?

I've also noticed a bug. Not sure if it's because of the larger maps in this source code or if the bug comes from the original MS4. But when you go to place down tiles, it places the tile on the tile to the left of the tile that you click on.
Is there a way to adjust the target tile according to the coordinates of the cursor on the picScreen?


Re: MS4 - Matt - 07-09-2009

Xlithan Wrote:Question: What other features have been added to the source, just the byte arrays and larger maps?

I've also noticed a bug. Not sure if it's because of the larger maps in this source code or if the bug comes from the original MS4. But when you go to place down tiles, it places the tile on the tile to the left of the tile that you click on.
Is there a way to adjust the target tile according to the coordinates of the cursor on the picScreen?

I have been busy with the birth of my son but I should have some time today to open up the source and check. I think I know the problem, but I can't remember off hand what it was. Is this only when you resize the map or is it even on a base size?


Re: MS4 - Xlithan - 07-09-2009

I will double check that for you Matt

Edit: It may well have been caused by increasing the width/height of picScreen


Re: MS4 - Matt - 07-09-2009

Xlithan Wrote:I will double check that for you Matt

Edit: It may well have been caused by increasing the width/height of picScreen

Okay. I'll play with that when I get the chance. I'm sure it's a simple as a variable needing to be changed. Hopefully. Lol.