Mirage Source

Free ORPG making software.
It is currently Fri Mar 29, 2024 12:09 am

All times are UTC




Post new topic Reply to topic  [ 1458 posts ]  Go to page 1, 2, 3, 4, 5 ... 59  Next
Author Message
 Post subject: Map over Map?
PostPosted: Fri Apr 10, 2009 3:00 pm 
Offline
Knowledgeable

Joined: Thu Nov 22, 2007 2:59 pm
Posts: 143
Location: London, England
Google Talk: aeronjl+mirage@googlemail.com
I'm not sure how to fully describe this, but I'll try.

I was wondering how it would be possible (and if it would be wise) to do the following:

This is map A.

|AAAAAA|
|AAAAAA| A = Map A Tile
|AAAAAA|

Just a normal field or whatever.

Then this is map B.

|000000|
|000000| B = Map B Tile 0 = Blank
|00BB00|

For purpose of example, Map B is a balcony.

Now, if you were on Map A, you would see this:

|AAAAAA|
|AAAAAA|
|AAAAAA|

But if you were on Map B, you would see this:

|AAAAAA|
|AAAAAA|
|AABBAA|

This would include people. I.e. Map B players would be able to see Map A players, but Map A players wouldn't.

How could this be achieved?


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Fri Apr 10, 2009 9:42 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
So, you'd make a map B when you wanted to have, say, the player being on the balcony of a house, on the first floor. You want them to be able to see the ground floor (map a) and all the people on it?

Basically, it all depends on how many levels you want to be able to store. I'm going to explain it using static variables, because dynamic a bit more complicated.

At the moment, the client on stores one map. This is where you have:
Code:
Public Map as MapRec

(Or something similar, I don't have a copy of Mirage.

What you want to do, for a simple working system, is store a temporary map which will store all the map data for the level below the current map. Something like this:
Code:
Public TempMap as MapRec


Now, you're going to have to set something in the MapRec to store the number of the map which is 'below' it. Just add something simple, like:
Code:
GroundMap as integer

(Use whatever datatype you have MAX_MAPS set to.)

Now, edit all the packets based around the map data to handle this extra piece of data, and add a simple scrollbar/text box in the Map Editor so the GroundMap can be set. Now go into all the editor subroutines and make it save and load to the map data properly.

You should now have a few extra bytes of data per map, but that's fine.

For the actual loading of the data, you're going to have to replicate the subroutines which send the map data. I think it's SendMapTo, or something similar. Unless you know what you're doing, I suggest you simply copy & paste the subroutine and re-name it to SendTempMapTo, or whatever feels right. If you do have a decent knowledge of the source, then you can add an extra optional value to the SendMapTo subroutine, which can be set to send the map data to either the normal Map rec in the client, or our new Temp map rec. It's up to you :]

In this new subroutine (or add a switch statement in the old subroutine), you'll want to send a map rec that's different to the one the player is actually on. If in the subroutine's header you've got a 'mapnum' value or something, just ignore me, but if it's set in the actual subroutine, then change it to:
Code:
Map(GetPlayerMap(index)).GroundMap

Now we're going to be sending the map data of the map we set in the map editor.

Once you've done this, change the name of the packet in the new subroutine (or in the switch statement if you've simply edited the subroutine) and make sure you add it to the Enum of both the client AND the server. If you don't, you're going to get some errors. Now that you have something that can send the map data to the client, you'll need to edit the client to handle this new data.

I haven't checked Mirage recently, but if it's still using the old Case system, add a new case and copy the way the normal map is saved. As we're wanting to save it differently, set it all to TempMap instead of Map.

Okay. If that all worked out, and I didn't miss anything, then we should now have:

  • An amount of allocated memory of a second map to be saved client-side.
  • The recieving/sending of the new map data sorted.
  • A couple of extra bytes in the MapRec to store the 'GroundMap' value.
  • A textbox/scrollbar to edit this value in the MapEditor.
  • A subroutine to call server-side to send the map data to the client.

What we need to get done now, is sort out the sending of the data, which is simple enough. I'm not aware of any changes Dmitry has done to the server in this area, but if something is different you'll need to work it out yourself.

Go to JoinMap (or something similar) and find out where the normal map data is sent. Underneath do a simple check.
Code:
If Map(MapNum).GroundMap > 0 then
SendTempMapTo index
End if


This should now, whenever the player changes map, send the GroundMap's data as well.

Now what you need to do, is handle all this data. I'll point out now, that I'm going to breifly cover how to handle the rendering, then you'll need to sort out the packet handling yourself.

At the moment, packet data is only sent to the player, or the entire map, for events native to that specific map. What you'll need to do, in all the packets which are sent to a player/map concerning the movement of players, the change in status of items and npcs... all of these events, you'll need to do a small check to see if the map has a GroundMap value. If so, you'll need to send all the data for that map as well as the usual data.

Sorry if that's a bit convoluted. It's a hell of a lot simpler than it sounds, but I don't have the source with me, so I can't point out what exactly you'll need to do. I'll say now that you should, for now, sort out the packets concerning player/npc movement. Once you get those to work, the others will be easy to manage.

Now, in the client all that remains to do is sort out the rendering. What you'll need to do, is go into the rendering subroutine which is called each loop. I think it's Render_Graphics, or something similar.

In this subroutine, you'll need to copy and paste all the current rendering code for Players, Npcs and the map itself. Paste these below the existing calls, so you should have something like this:

Code:
The lower-map rendering.
Items rendering.
Players/Npcs rendering.
The upper-map rendering.
The lower-map rendering.
Items rendering.
Players/Npcs rendering.
The upper-map rendering.


So you should have all the rendering code out twice, directly below each other.

Now, for the code at the top, eg. the first lower-map rendering, items rendering, players/npcs rendering and upper-map rendering.

Now, you know all the For...Nexts around those calls? You'll want to edit them. Instead of checking the current map, you'll want them to check the TempMap. So, you should have it rendering the Lower-map of the TempMap, then all the objects, then the Upper-map. Then, above all that, you'll have the normal items rendering.

After all this, there's still some more to do. If you've got a decent understanding of Mirage and VB6, it should only take a day or so to get it all done, maybe a bit more if you get some annoying bugs.

To be honest, I'll probably download a copy of MS4 later this month and give it a try myself. It's easy enough to do, just a bit daunting.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Fri Apr 10, 2009 9:49 pm 
Offline
Knowledgeable

Joined: Thu Nov 22, 2007 2:59 pm
Posts: 143
Location: London, England
Google Talk: aeronjl+mirage@googlemail.com
I read through that. I understand which is a plus. I'll probably attempt this sometime next week. I've always wanted to implement something along these lines but never really had the motivation or need to. Like I said, I'll give it a go. I'll probably post back with errors during the week :D


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Fri Apr 10, 2009 9:57 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Acruno wrote:
I read through that. I understand which is a plus. I'll probably attempt this sometime next week. I've always wanted to implement something along these lines but never really had the motivation or need to. Like I said, I'll give it a go. I'll probably post back with errors during the week :D


Good stuff. I'll probably be at a machine with Mirage & VB6 sometime next week, so just post any errors and I'll be able to sort them out, no doubt.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Fri Apr 10, 2009 10:02 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
Tutorial it :D

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Sat Apr 11, 2009 11:11 am 
Offline
Knowledgeable

Joined: Thu Nov 22, 2007 2:59 pm
Posts: 143
Location: London, England
Google Talk: aeronjl+mirage@googlemail.com
I had a quick go, just to see if I came up against anything odd.
SendMapTo has gone AWOL. I remember it vaguely from older versions though, what would be in it? I'll have a look and see what I can find.


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Sat Apr 11, 2009 11:18 am 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Acruno wrote:
I had a quick go, just to see if I came up against anything odd.
SendMapTo has gone AWOL. I remember it vaguely from older versions though, what would be in it? I'll have a look and see what I can find.


Mh, I check the latest source.

It's this code you need to duplicate:
Code:
Public Sub SendMap(ByVal Index As Long, ByVal MapNum As Long)
    Call SendDataTo(Index, MapCache(MapNum))
End Sub


Have it run something like:
Code:
Public Sub SendTempMap(ByVal Index As Long, ByVal MapNum As Long)
    Call SendDataTo(Index, MapCache(Map(MapNum).GroundMap))
End Sub

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Sat Apr 11, 2009 11:26 am 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
You need to find "MapCache_Create" for the actual data for that packet.

It seems that Robin got all the basics you'll need in order to do this. Good job.


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Wed Dec 01, 2021 10:42 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоsemiasphalticflux.ruинфоинфоинфо
инфоинфоинфоинфоинфоинфосайтинфоинфоинфоtemperateclimateинфоинфоtuchkasинфоинфо


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:37 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Econ


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:38 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
131.1


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:40 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:41 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:42 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Dani


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:43 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Guru


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:44 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Omsa


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:45 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Just


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:46 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Robe


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:47 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Alex


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:48 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Xbox


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:50 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Tesc


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:51 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Dorm


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:52 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Wind


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:53 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
XVII


Top
 Profile  
 
 Post subject: Re: Map over Map?
PostPosted: Tue Jan 11, 2022 7:54 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
ToCA


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1458 posts ]  Go to page 1, 2, 3, 4, 5 ... 59  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group