Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Plotting other players on a map

Author
Message
TheMeq
13
Years of Service
User Offline
Joined: 5th Sep 2012
Location: Nottingham
Posted: 21st Sep 2012 20:50
Hi, in my code, I can draw other players but the position is slightly off.

Each player has a world position, but i'm not sure how to plot the other players correctly, i've been going through the maths and I just can't get my head around it.

Say for example:

Player 1 Position = (2000,2000)
Player 2 Position = (-1200,1500)

if I am player 1, I am drawn on the screen at my screen resolution divided by 2 on both axis, so if my screen resolution is 1280x1024 I have to factor that in as well when drawing the other players

Any ideas?

[img=http://redstonetor.ch/sig/12/TheMeq.png]
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Sep 2012 22:22
so Player 1 is u, and Player 2 is other player, right?

lets say u have a map where the players are.

the map is Plain and the size is 1000x1000
you need to get your own position always on center, right?
so do it that way:
draw a dot on your map wich will define your self.
and then make a distance formula wich will check all the player positions.
then according to your X,Z position, set up small dots on the map for Other player X,Z positions

so like:
XP2 = Player 2 X
ZP2 = Player 2 Z

XP1 = Player 1 X
ZP1 = Player 2 Z

MapSize = 40
Sprite OtherPlayerDot,(XP1-XP2) / MapSize ,(ZP1-ZP2) / MapSize,ImgNum

it might look only math and code, but it pretty simple once u will look into it lil bit more.

Advanced Updater for your games!
TheMeq
13
Years of Service
User Offline
Joined: 5th Sep 2012
Location: Nottingham
Posted: 21st Sep 2012 22:57
Well, the map size is -500000,-500000 to 500000,500000, I'll give it a try though I think I need to take screen resolution in to question.

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Sep 2012 23:02
lets convert the map size to number than bigger than zero
1000000x1000000 instead of -50000, -50000, 50000 50000

lets say your map size is 500x500
with means the map size must be devided to 2000.

use my upper reply with those params.

Advanced Updater for your games!
TheMeq
13
Years of Service
User Offline
Joined: 5th Sep 2012
Location: Nottingham
Posted: 21st Sep 2012 23:06
Will give it a try, Thanks for your help,

Also, can I ask a question about your advupdater? I've registered already and it works great.

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Sep 2012 23:08
sure thanks
the current version you downloaded is lil bit buggy, im working now on new versin that will support low connections and keep them alive if the connection is droped. but it works fine though..

go ahead, ask.

Advanced Updater for your games!
TheMeq
13
Years of Service
User Offline
Joined: 5th Sep 2012
Location: Nottingham
Posted: 21st Sep 2012 23:17
Will it be customisable with stuff like

Changing the Title bar
Adding a Banner logo
News section to so people know what has changed.

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Sep 2012 23:18 Edited at: 21st Sep 2012 23:19
i will consider that, but you can write everything on the official thread.

Advanced Updater for your games!
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Sep 2012 23:59
Another method is to use Hidden Named Limbs, that way you can randomise player start positions... as well as not having to calculate anything... [Aside from positioning during coding / level design...]

TheMeq
13
Years of Service
User Offline
Joined: 5th Sep 2012
Location: Nottingham
Posted: 22nd Sep 2012 19:33
Sorry Sergey, your method didn't work, and Mr Valentine, we don't want to randomise players

This is the player drawing script for other players apart from myself


This is the code used for moving the player and drawing the player controlling


MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 22nd Sep 2012 19:43
I think you misunderstood... My method works for static as well as random...

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 22nd Sep 2012 20:18
Quote: "Sorry Sergey, your method didn't work"

its not a method. its the only way to convert 3D player positions into 2D sprite positions. i dont see any other way to do that.

Advanced Updater for your games!
Artuan00
13
Years of Service
User Offline
Joined: 22nd Sep 2012
Location:
Posted: 22nd Sep 2012 20:51
Hi,

I'm the "other" developer of this game.

We're not looking to convert 3D player positions into 2D sprite positions.

We're looking to draw the network players x/y relative to the local players x/y and centre of the screen.

We thought we had the maths on the ball, however it still doesn't seem to be functioning as it logically should.
TheMeq
13
Years of Service
User Offline
Joined: 5th Sep 2012
Location: Nottingham
Posted: 22nd Sep 2012 22:09
Hi, we don't refer to any 3D objects in the script, just x and y 2D stuff

Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 23rd Sep 2012 07:53
Quote: "We're not looking to convert 3D player positions into 2D sprite positions.

We're looking to draw the network players x/y relative to the local players x/y and centre of the screen.

We thought we had the maths on the ball, however it still doesn't seem to be functioning as it logically should."

Hmm...I think I understand what you want.

I think this snippet of code can point you in the right direction. It's not tested in any way, though I tried to explain what it does in some detail.
Note: this snippet assumes that you have a player sprite in the center of the region you want the 'radar map' to be drawn.


If this isn't what you want, could you create a quick mock-up picture of what you want?

Artuan00
13
Years of Service
User Offline
Joined: 22nd Sep 2012
Location:
Posted: 23rd Sep 2012 12:20
We'll have a look into this when we're both awake a little more. But thanks for your input Dar13
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 24th Sep 2012 01:04
@TheMeq:
just as requested, i made new feature for you (banner option)

http://forum.thegamecreators.com/?m=forum_view&t=197858&b=8&p=0

Advanced Updater for your games!
TheMeq
13
Years of Service
User Offline
Joined: 5th Sep 2012
Location: Nottingham
Posted: 24th Sep 2012 20:02
Awesome! Will check it out!

Login to post a reply

Server time is: 2026-07-10 07:23:15
Your offset time is: 2026-07-10 07:23:15