UDP Network library v1.12

Blitz3D Forums/Blitz3D Userlibs/UDP Network library v1.12

Flanker(Posted 2016) [#1]
To discuss the new version of the library, as the other thread is huge now :)

Worklog and examples : http://www.blitzbasic.com/logs/userlog.php?user=15074&log=1916


Rick Nasher(Posted 2016) [#2]
Appears pretty smooth!


Flanker(Posted 2016) [#3]
Yes, the advanced example should be smoother now and without flickering, as I fixed some interpolation issues :) You can use TAB key to see the pings and scores.

If you want to test it online, i'll be connected sometimes on channel #UDPNetwork_lib here : http://webchat.quakenet.org/


stayne(Posted 2016) [#4]
About to get started on a level for this. Found some nice textures for testing.


Rick Nasher(Posted 2016) [#5]
I've added a tile on the 'player creation spot' so easier to see where that is. To be added of course to Function CreateScene()
start = CreateSphere():EntityColor start ,255,255,255
ScaleEntity start ,1,.1,1:PositionEntity start ,-20,.1,-20

I'll delve into the health upgrade/item stuff. For GF taking too long. lol ;-)


Guy Fawkes(Posted 2016) [#6]
Sorry guys. I got an urgent Skype call so I had to go. I will be testing out this stuff tonight and tomorrow as well.! :D


RustyKristi(Posted 2016) [#7]
Heeey, this is awesome guys!! :D Wow, I was gone here for a couple of months and I did not expect something new and shiny like this library would come out. Big thanks Flanker for sharing!!! :)


RustyKristi(Posted 2016) [#8]
I quickly got to test this out and I have a question with the switch host thing, which is totally awesome btw. So once someone quits and another takes over, you cannot join that game/server anymore?

I initially set it to port 2000 and when I tried to quit the original host, the port is now set to 58746 or within that range. I tried to spawn another client but I always got a "failed to connect server" or the client crashes.


Guy Fawkes(Posted 2016) [#9]
No, I don't think it should disconnect other players. You probably found another bug. Can you fix that one Flanker? Also, did you make SURE that you port forwarded port 2000 & / or port 58746 on your router with TCP AND UDP? Did you also make sure that your firewall(s) are not blocking incoming connections? Some Anti Virus can do this as well. When another player takes over as a Server, others should still be able to connect.


RustyKristi(Posted 2016) [#10]
Hey Guy,

No it's all under one pc so I don't think it's a port forwarding or router issue. I have not said it is disconnecting, but you can't join an on-going game (or at least it fails to connect) once the original server quits the game. Maybe it is currently coded this way?

Thanks.


Guy Fawkes(Posted 2016) [#11]
The new Server must ALWAYS be port forwarded.


Guy Fawkes(Posted 2016) [#12]
Also, I have a feeling that it's not changing IPs & Ports from the old Server IP & Port to the new Server IP & Port.


RustyKristi(Posted 2016) [#13]
It turns out I just got a weird connection glitch earlier but it seems to be all working now, yes! :D


Flanker(Posted 2016) [#14]
@RustyKristi
When the server quits, another player becomes the server, so if you want to join the on-going game, you will have to connect to that player, as the first server is not active anymore.

For example, let's say all players are on the same computer, so everyone has IP=127.0.0.1. You create a server on port 2000. You make a client join that server on port 2000, and this client port is 3000. Then, if the server quits, the new server is on port 3000.

As you said, nothing to do with router port forwarding if you are local, it's just the normal behaviour of the library.

@Guy Fawkes
It does change IP and port, but only if the server is closed with the escape key. If you close it with the cross, he won't send the "switch host" packets and the only thing that players can do in that case is constating a server timeout, then you'll have a "connection lost" runtime error. It could be changed, but I will probably never do it for some reasons ^^


EDIT : oh I forgot, I fixed an horrible issue in the v1.1, probably causing some lags. Just a very little thing in the code but it can have weird effects :S I'll post a v1.11 or something like that tonight.


RustyKristi(Posted 2016) [#15]
For example, let's say all players are on the same computer, so everyone has IP=127.0.0.1. You create a server on port 2000. You make a client join that server on port 2000, and this client port is 3000. Then, if the server quits, the new server is on port 3000.


Yes, I knew that beforehand, but for some reason my first test were crashes and I was not sure why, I did not change anything code or settings wise. Anyways, it's all good now! thanks again :)


RustyKristi(Posted 2016) [#16]
I was also thinking of some feature additions that you might consider, like dedicated server mode and a port to Blitzmax?


stayne(Posted 2016) [#17]
Dedicated server is a must. I'd just run it bare minimum 2D of course in a small console or systray app. The ones I've seen and used are very simple with a few admin commands and chat logging.


Guy Fawkes(Posted 2016) [#18]
Or we can all FORGET elitist stayne's "suggestion" and continue working on this awesome library! We don't have to listen to you! :)

~GF


stayne(Posted 2016) [#19]
Flanker could you post a list of entities so I can create their locations in the map? Example: spawn, soandsotrigger, bullets, armor, light, etc. That way when the map is parsed you can place the entities at their corresponding x/y/z location. Makes things a whole lot easier! I started on the map last night, keeping it simple in case it doesn't work for you. I'm guessing you are looking for an FPS-type map similar to Quake?


Guy Fawkes(Posted 2016) [#20]
Yes. I'm thinking of Reading all positions, rotations, etc. from an Encrypted index.dat file.


Rick Nasher(Posted 2016) [#21]
Don't you guys just love all the commotion this lib creates? :-)
Looks like this is the 'missing link' in Blitz3d.

@stayne: can you post a preview screenie for the map?


stayne(Posted 2016) [#22]
I sure can around 7:00pm CST give or take a few ticks.


Rick Nasher(Posted 2016) [#23]
Can't wait to see what you're fabricating.


Flanker(Posted 2016) [#24]
Added version 1.11, I suggest you to use it ;)
Also I added a "simple" 2D example, kind of a tutorial if you want to know how to use the library.

@RustyKristi, what i fixed in v1.11 could be the cause to the problem you encountered, i'm not quite sure yet, but I was routing pings like normal packets :S So I guess the network was badly saturated at a moment.

We had some ugly problems when testing yesterday and this could also be the cause. I will go on quakenet tonight if someone wants to test it online.

About dedicated server, in fact it is already possible. The library just handle connections beetween server/clients, proper packets routing and server switch. You can code your side a 3D game and a dedicated server to go with, using the library commands.

A port to blitzmax is not to be considered for now as i'm quite a noob with it. I'm writing this library because like other said, it will probably be compatible with Hardwired/Hybrid that I will use in the future (I trust in Ploppy :).

@stayne
You can make the kind of map you want, quake style is ok, just try to make it light weight so not hundreds of textures ^^
For the map, just add some basic things as I'm not writing a game, just an advanced example for the library :
- spawns
- health
- ammunition


Guy Fawkes(Posted 2016) [#25]
I'M GAME! Meet u on Quakenet!


Rick Nasher(Posted 2016) [#26]
On there too.


stayne(Posted 2016) [#27]
http://imgur.com/SSylzi7 long way to go.


Flanker(Posted 2016) [#28]
Beautiful :) Maybe i'll write a little FPS example with your level.

We've tested the lib tonight again with Guy Fawkes and Rick Nasher. Still random connection problems but I finally found what is it. UDP packets can come in any order, and the connection routine didn't deal with that. It will be fixed soon. In local mode this doesn't appear as the connection is flawless, packets arrive in the right order. Another thing with UDP is that packets can never arrive, but it doesn't seems to appear too often, so for the moment I won't go into that, but I plan in the future to add a Net_SendCrucialMessage() command so it will ask an acknowledgement of the successful receipt.


stayne(Posted 2016) [#29]
UDP is best at handling single packets like streaming media unless you code in some packet sequencing and arrange them client-side.


Guy Fawkes(Posted 2016) [#30]
Ok, so got a question for you advanced Blitzers. How would I make it so that when a user type's in a slash command, it can have UP TO 3 parameters separated by a comma, but do NOT have to be filled out? I started to create this code and it only works if I type the full command such as "/kick playername" (without the double-quotes ).



Thank you for any help you can give me!

~GF


RustyKristi(Posted 2016) [#31]
Nice work there! I agree with stayne, dedicated server mode is a must so I brought up the blitzmax port and it would be key to getting it ported to Linux and having it to run dedicated or headless. :-)


what i fixed in v1.11 could be the cause to the problem you encountered, i'm not quite sure yet, but I was routing pings like normal packets :S So I guess the network was badly saturated at a moment.


Good to know!

@Guy Fawkes

Check how the CSV format works and look for some snippets in the code archives.

Edit CSV Format


Guy Fawkes(Posted 2016) [#32]
That doesn't make any sense. I just wanna be able to use slash commands with 1 to 3 parameters each, each parameter is NOT REQUIRED.


RustyKristi(Posted 2016) [#33]
That doesn't make any sense. I just wanna be able to use slash commands with 1 to 3 parameters each, each parameter is NOT REQUIRED.


Yes, but how are you going to parse it? you mentioned "comma separated", right?...

it can have UP TO 3 parameters separated by a comma,



RustyKristi(Posted 2016) [#34]
Typo at my end, I meant CSV format..

Maybe this is what you've been looking for:

http://www.blitzbasic.com/codearcs/codearcs.php?code=824


Guy Fawkes(Posted 2016) [#35]
By checking each parameter and whether or not it's allowed to even be IN the parameter(s) in the slash commands.


RustyKristi(Posted 2016) [#36]
Some more suggestions for enhancements:

- Animation States
- Client Side Prediction


stayne(Posted 2016) [#37]
I'd make a Type called Commands and a Field called Name$. When a command is entered, run through the list of names and verify it's an existing command before executing the command.

Type Command
Field Name$
End Type

For c.Command = Each Command
If c\Name$ = soandso$
do stuff
Else
don't do stuff
End If
Next


Rick Nasher(Posted 2016) [#38]
@stayne:

The level is starting of interesting. You are using 3d World Studio.
Question: How quickly and good is that for developing multi-floor buildings and how low poly are the results?

Before I used Sketchup which is really good(intuitive) and quick, but sloppy and a pain to convert to b3d.


Flanker(Posted 2016) [#39]
@stayne
UDP is best at handling single packets like streaming media unless you code in some packet sequencing and arrange them client-side.

Do you mean it's better to have a small amount of big packets instead of lots of small packets ? On the web I read that packets up to 576 bytes are safe on any network with UDP protocol, otherwise it increases packets loss. For the moment i'm very far from 576 bytes per packets and the advanced example doesn't use a lot of them, I think it's reliable but packets can still arrive in any order.

@RustyKristi
Animation states and client side prediction have to be coded in your game, according to the packets your send and receive using the network library.

@Guy Fawkes
Here is a function that will extract a command and all its parameters, the command will be in cmdParameter(0), and for example parameter 3 will be at cmdParameter(3). The function returns the number of parameters, you can have up to 255, and even more if you modify the table cmdParameter. It delete all spaces at the end if present. Putting two commas beetween 2 parameter will be considered as an empty parameter. Try the example :




Guy Fawkes(Posted 2016) [#40]
This is BEAUTIFUL, Flanker! Thank You!


stayne(Posted 2016) [#41]
Is it not an issue that packets arrive out of order? For instance if an entity is moving and its coordinates are sent every 10ms out of order won't it appear jerky? what about chat string packets?


Flanker(Posted 2016) [#42]
You're right it's an issue, and I think that's why interpolation still appears a bit jerky, because we can receive a previous position packet instead of a next position packet. Seems that it can't be avoided with UDP, but it can be fixed by checking packets numbers, so that we would just ignore a position packet if his number is before the last position packet we received. For chat it's not a huge issue to receive the wrong order I think...

I'm working on it but still have to fix the connection issue caused by the same problem.


stayne(Posted 2016) [#43]
Flanker send me an email so I can reply with the zipped up test map. Only entity I included is "spawn". No weapons, ammo, etc yet I just want to make sure you can parse it and everything looks ok. You'll probably need to scale it down a good deal. If you want to just load it leave out the parse code and just load the b3d to see how it looks.


Flanker(Posted 2016) [#44]
I updated my profile so you can see the email. I'll take a look at the map and see how to parse it :)


stayne(Posted 2016) [#45]
Thanks man...sent. Sent the textures (mind the license) along with the b3d and 3dw. The map is nowhere near done just wanted you to see if you can load it. Can't remember if the parser needs the 3dw or b3d. Otherwise just load the b3d like normal.


Flanker(Posted 2016) [#46]
Thanks, it looks nice sor far, I like the lighting and textures. What do you use to make the map ?


stayne(Posted 2016) [#47]
3D World Studio. Old school JoshK stuff still works great, I used to map for Quake 2 and Q3A (never was a texture artist). Glad you like how it looks. If it works decently I will add the other entity spawns and finish it. Just remember to read the texture license, they are not mine.


stayne(Posted 2016) [#48]
I drug out some animation code I use. Works for me. This way you can throw in one-shot animations (such as c\attackanim or c\hitanim) anywhere you want.

If Animating(c\mesh) = False And AnimSeq(c\mesh) <> c\idleanim
  Animate (c\mesh,1,c\animspeed,c\idleanim,10)
EndIf
		
If c\moving = True And c\running = False And AnimSeq(c\mesh) <> c\walkanim
  Animate (c\mesh,1,c\animspeed,c\walkanim,10)
Else If c\moving = True And c\running = True And AnimSeq(c\mesh) <> c\runanim
  Animate (c\mesh,1,c\animspeed,c\runanim,10)
Else If c\moving = False And c\angry = True And (AnimSeq(c\mesh) <> c\attackanim And AnimSeq(c\mesh) <> c\hitanim And AnimSeq(c\mesh) <> c\combatidle)
  Animate (c\mesh,1,c\animspeed,c\combatidle,10)
Else If c\angry = False And c\moving = False And (AnimSeq(c\mesh) <> c\attackanim And AnimSeq(c\mesh) <> c\hitanim And AnimSeq(c\mesh) <> c\idleanim)
  Animate (c\mesh,1,c\animspeed,c\idleanim,10)
EndIf



Guy Fawkes(Posted 2016) [#49]
Sweet, @stayne!


Flanker(Posted 2016) [#50]
Thanks, could be useful when I'll be at that point in the example.

I'm looking for someone to run some quick tests on UDP protocol. If interested, Quakenet at channel #UDPNetwork_lib. Thx.


Guy Fawkes(Posted 2016) [#51]
COUNT ME IN! <3

~GF


Rick Nasher(Posted 2016) [#52]
@Flamker:
Is the code of LAmaNet/Rottnet helpful to compare with or is it useless for resolving the internet connection issue?


stayne(Posted 2016) [#53]
Flanker: emailed you the "almost" done FPS map. Still just a spawn entity placed. Making sure it works for you first before I finish it.

Edit: Also sent you some ugly hacked up FPS code instead of the chasecam stuff. Change your camerazoom to 1.6 by the way, forgot to add that.


Guy Fawkes(Posted 2016) [#54]
Cannot WAIT to test this! :D


Guy Fawkes(Posted 2016) [#55]
@Flanker :: Me & Rick are on the chat! :)

~GF


Flanker(Posted 2016) [#56]
@Rick Nasher
Unfortunately the LAmaNet/Rottnet code is huge and commented in german that I can't read :-/ I didn't look too much in it, it's a pain to understand someone else network code.

@stayne thanks, all that will be useful and the map looks good.

EDIT :
Also, I wrote a little code to test the UDP protocol beetween two computers. Tested with Guy Fawkes (i'm in Europe, he's in USA), it showed that unless you send a lot a data, UDP is reliable. For example when I uploaded data at 5 KB/s, GF received near 100% of it, with no order problems. When I uploaded at 100 KB/s (my connection upload limit), arrival dropped up to 25% and causing packets disordering.


stayne(Posted 2016) [#57]
You are welcome. Just a thrown together sealed map for testing.


Flanker(Posted 2016) [#58]
The connection issues we found over internet are fixed. Strange behaviour from Blitz3D, seems I can't write that on the same line :
If RecvUDPMsg(net_stream) And UDPMsgIP(net_stream) = net_serverIP And UDPMsgPort(net_stream) = net_serverPort

Also, now, connection messages are sent multiple times until answer or timeout, to avoid packets loss.

@stayne we tested the map and your FPS code online, it works quite well for a "hack". I've been able to parse the spawn location and lights inside the b3d map file using the routine you provided on the other thread.

When the library is updated i'll start to write a little FPS with it. I converted a model from counter-strike to b3d with animations (not all) using milkshape, maybe it will be usable :



The gun is from Psionic's website.


stayne(Posted 2016) [#59]
Cool I'm glad it works! I'll go ahead and add 3 more spawns (hate spawn campers) some weapon/ammo spawns, check for leaks and do some texture tweaks.


Flanker(Posted 2016) [#60]
yes a lot of spawns because guy fawkes will spawnkill with minigun cheats... :D


Guy Fawkes(Posted 2016) [#61]
I DO THAT ON PURPOSE! >.< It helps find lag issues! LOL! ( And I get to murder Rick & Flanker :D )

~GF


Guy Fawkes(Posted 2016) [#62]
I'm on the chat, Flanker! :)

~GF


stayne(Posted 2016) [#63]
If RecvUDPMsg(net_stream) And UDPMsgIP(net_stream) = net_serverIP And UDPMsgPort(net_stream) = net_serverPort

Perhaps Blitz needs this:

If RecvUDPMsg(net_stream) = something And UDPMsgIP(net_stream) = net_serverIP And UDPMsgPort(net_stream) = net_serverPort

or

If RecvUDPMsg(net_stream) <> 0 And UDPMsgIP(net_stream) = net_serverIP And UDPMsgPort(net_stream) = net_serverPort


Rick Nasher(Posted 2016) [#64]
Or just the booleans True/False, but I've once too encountered a situation that it was working fine when nested, but not in one line, peculiar enough.


stayne(Posted 2016) [#65]
Yep like this:
If RecvUDPMsg(net_stream)
  If UDPMsgIP(net_stream) = net_serverIP And UDPMsgPort(net_stream) = net_serverPort
    Do stuff
  End If
End If



Rick Nasher(Posted 2016) [#66]
Indeed.


Guy Fawkes(Posted 2016) [#67]
Nasher, Flanker. I'm on the chat! :)

~GF


Flanker(Posted 2016) [#68]
If RecvUDPMsg(net_stream)
  If UDPMsgIP(net_stream) = net_serverIP And UDPMsgPort(net_stream) = net_serverPort
    Do stuff
  End If
End If

Yes that's what I had to do. Maybe Blitz3D doesn't check If And/Or in order or something. Anyway it is fixed, took long to find.


Guy Fawkes(Posted 2016) [#69]
Stayne, we should add the ability for there to be Admins / Mods / Players, as well as multiple-parameter optional as well as non-optional slash command parameters. It would make the game MUCH more interesting (AND prevent alot more players from cheating).

~GF


stayne(Posted 2016) [#70]
Nah I just wanted to help by making a decent map for the FPS example. Not my code nor my project and I am a horrible coder always have been. Flanker is doing a good job and is handling things just fine as far as I can tell. There is no "we" as far as I can tell anyway.


Rick Nasher(Posted 2016) [#71]
@Flanker: As colors are more or less the same, only slightly varying, isn't it likely that they are caused by some rounding/conversion of variables that hold the color values?


Flanker(Posted 2016) [#72]
Nope, this is because of the Net_RequestPlayer() command. I added it because when GF was the server, I often received player's color before the "new player" packet, I don't know why but it's like that. The problem is that you can't update a player you didn't create yet... So when you don't know a player you request it with that command, but this is handled by the library, and the library doesn't deal with colors or skins or things like that, it just resend the "new player" packet with name and ID. So something has to be added in the example to synchronize colors in any case.


Guy Fawkes(Posted 2016) [#73]
I'm on the chat guys! =D

~GF


Rick Nasher(Posted 2016) [#74]
Hmm, so there's a whole lot more to this library than I thought. But.. if all playera are created first in the same color and once created you send the color to all players wouldn't that have the desired effect?
This could then also be used to temporary change color for instance when being hit.
Additionally a newly created player could also be having an alpha value set to be transparent so it won't be noticed and then when color is set it could slowly appear using a timer as if being transported to the spawn spot. Or is this a bad idea or hard to realize?


Flanker(Posted 2016) [#75]
Yes, with UDP you must consider that each packet can never arrive, or arrive in any order. I'll maybe add TCP for connection and such important packets when I have time.


Rick Nasher(Posted 2016) [#76]
Hmm ok.


stayne(Posted 2016) [#77]
Read RemiD's post near the bottom:

http://www.blitzbasic.com/Community/posts.php?topic=100246


stayne(Posted 2016) [#78]
More info for you Flanker:

http://www.blitzbasic.com/Community/posts.php?topic=57491


Rick Nasher(Posted 2016) [#79]
That's very interesting intel, thanks stayne.


Guy Fawkes(Posted 2016) [#80]
@Nasher, @Flanker, I'm in the chat! :)

~GF


Flanker(Posted 2016) [#81]
Yes I've also read that maximum packet size in UDP should be 576 bytes, not sure exactly why, but maybe to avoid packet splitting like RemiD says. About packets integrity, I read that once you receive an UDP packet, it is necessarily intact, because its lenght is in the header, and it's verified at arrival so broken packets are ignored. With this behaviour, it seems useless to me to add the packet lenght to the packet itself because it can be read with ReadAvail(stream). However, a packet number can be usefull to track certain packet loss (important ones), reorder them, or eventually ask them back or confirm arrival to server. UDP is used for fast transmission, where it is preferable to drop a packet and read the next one, instead of waiting for that packet. But the engine has to be prepared for this. Otherwise, TCP is the way to go :)


stayne(Posted 2016) [#82]
Yep TCP is best for an FPS or any packet-sensitive game/app. Sorry you had to find out the hard way.


Raster Ron(Posted 2016) [#83]
This is a nice udp library. Btw, I made some small quick changes to 3d example chat text panel to support player colors.



I got the rgb to hex code here (Hex8.bb)

This is the diff for reference.



cheers. :)


Guy Fawkes(Posted 2016) [#84]
I love you! LOL!

Can I join you in beta testing?

I want to see 3 things.

1) Admin / Moderator / Player Status with different colors for Name tags as well as Status color.

2) Chat commands with multiple parameters ( optional AS WELL AS non-optional ) for Admins & Moderators & Players alike.

3) Status displayed in Name tag.

Thank you so much for the contribution! Keep up the great work! :)

~GF


Guy Fawkes(Posted 2016) [#85]
And for any of you nay-sayers out there who wanna bash me for asking for too much, I would like to inform you that I have done countless hours of beta testing to help make this dream a reality. So, @Raster Ron, if they try to bash me, or make you change your mind to help with these 3 requests, I ask that you kindly ignore them.

~GF


Rick Nasher(Posted 2016) [#86]
This is indeed a nice addition. Thanks Raster Ron.

Flanker is steering the pudle with this lib, more and more appreciated.


Flanker(Posted 2016) [#87]
@stayne
I would say that UDP is better for FPS and action games in general. The only thing is to write something to ensure that important packets are received, something TCP-like with acknoledgments. I'll try to add that before adding TCP because I'd prefer only one protocol, but that's a lot more work.

@Raster Ron
Nice one that's a good idea :) Also I didn't know the diffchecker website, it can be very useful !


Guy Fawkes(Posted 2016) [#88]
I'm on t3h chat, guys! :)

~GF


Guy Fawkes(Posted 2016) [#89]
This lib gets better & better every time I wake up! =D

~GF


Guy Fawkes(Posted 2016) [#90]
Working on an actual MySQLi Login / Register for Username & Password.

I got tired of people being able to use my name as their own.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Credits List ::

~* Guy Fawkes for creating / thinking of this idea
~* Flanker for the chat code & the Network Library itself

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This is v.0.1 (Alpha) of the Login. I need your help guys.

What I wanna do is essentially create a Login form like WoW (World of Warcraft ), and I cannot get the username & password to store in an array securely for later use to send it to the MySQLi Database using ETNA (Easy Database Network Access). I also want to have the form always display in the same place no matter WHAT size the resolution of the Game screen is. If you are interested, please help me fix it & I will add your name to the credits.

It only shows the skeleton for a simple login at this point. It IS afterall, a W.I.P.! ^_^

Thank you all & Enjoy! :)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Login.bb ::



Please note :: When this is done it will have a Username, Password, & Email form followed by a Register / Login interactive button.

I hope you all like!

~GF


RGR(Posted 2016) [#91]
Credits List ::

~* Guy Fawkes for creating / thinking of this idea

Wow - you are really the biggest thinker ever existed - not one has thought about a login with username and password or even email before ...

Lets not forget to announce that credits at CNN international and all mayor natworks of the globe ...


You got tired of people being able to use your name as their own?
Boy, the original Guy Fawkes would rotate in his grave if he'd knew what an ... is using his name!


Guy Fawkes(Posted 2016) [#92]
RGR, shut the HELL up, and get the HELL out of our thread! You have NOTHING to contribute but malice towards others & quite frankly, we are all SICK of it!


RemiD(Posted 2016) [#93]
Credits for ideas, really ? :P


Rick Nasher(Posted 2016) [#94]
Can I please copyright your last remark/idea RemiD? ;-D

Ohoh - now I got sucked into it too. No offence, but wish we all were a little bit less edgy and not so easily provoked though. Guess thread pollution is preferred over ignoring unimportant stuff(the smart thing to do). *guess this proves we're still kinda primal; monkeys with keyboards? Or is it just a p*ssing contest? ;-) No.. no need to reply to these rhetorical questions. I'm just typing out loud..

-Peace on planet earth- (yes, I am a hippy) :-P



RemiD(Posted 2016) [#95]
@Rick>>I agree with you, there is no point to create conflict for small unimportant things, but Guy Fawkes demonstrates a level of stupidity rarely seen. This is difficult to resist. :P (know that i sometimes moderate my posts or don't post to not be banned)


Guy Fawkes(Posted 2016) [#96]
THIS ENDS HERE! EITHER RGR LEAVES ME & MY FRIENDS ALONE, OR I WILL MAKE AS MANY THREADS AS NECESSARY TO KEEP THIS THREAD ALIVE AND TO STOP HIM FROM TREATING PEOPLE LIKE GARBAGE! That's ALL he god damn does and I'm SICK of it! He has NOTHING to contribute but B.S. & being mean & rude to people! I cannot WAIT until karma comes around and bites you in the ass. Incase you guys hadn't noticed, I was FINE til' someone decided to be rude, completely misguided, & a waste of DNA.

I DID edit my post a bit, but it's only for the sake of the mods & their rules.

But RGR DESERVES what he got!

All I want is to get back on track. But apparently, some minorly intelligent idiots decide to ruin a GOOD THING!

I WON'T LET THAT HAPPEN!

Lets get this thread back on track & ignore RGR.


Flanker(Posted 2016) [#97]
A little video to show the base of the next example for the library : https://www.youtube.com/watch?v=fLbXhhSIIrA

Just character control for the moment, it's not perfect because models are grabbed on internet and put together but it's quite responsive, it'll be enough. I'll probably add bones collision for bullets hits so hitting the head or the legs won't have the same effect. Then it will be time to add all collisions with the map (thanks stayne), and finally include the network library.

If someone knows how to animate one animated mesh with two different animations (example run for legs, reload for upper body), I'd like to know, I found nothing interesting in the forums and animating a bone returns an error (in my memory it was as simple...).

It would be cool if people on internet just don't post for only bashing people. I do it sometimes too, i'm human, but here about Guy Fawkes, I would just say that he helped me a lot testing the network library online with Rick Nasher.


Guy Fawkes(Posted 2016) [#98]
Sounds great, @Flanker! Thank you Flanker! :)

Nasher, Flanker, I'm in the chat!

~GF


Rick Nasher(Posted 2016) [#99]
OWWWW. This is just tooo great.


Rick Nasher(Posted 2016) [#100]
Talking about collisions..

I've added some simple stuff:
-added to initial selection; Enter=defaults.
-added spawner plate.
-added colored char txt by Raster Ron.
-added health upgrade(in progress), collision working, bug: health not upgrading..


Can anybody explain why these functions don't have the desired effect(health upgrade upon collision)?
Added 2 functions..


Perhaps more usefull: the full code..



RemiD(Posted 2016) [#101]
.


RemiD(Posted 2016) [#102]
Oh, even easier, and Rick probably has the files, since it is a test project not for commercial use, you can probably use the characters meshes from the old blitz3d project with the top down view "Alien Breed" if i remember correctly.


Rick Nasher(Posted 2016) [#103]
Ah that one. I think I have the Alien model somewhere indeed. Don't have the new code from Flanker yet though, he just showed a preview on youtube.

The idea is to create 2 versions. 1 more basic with in code gfx without media for the code archives and a more full blown example with media, which we are probably going to tweak forever until it's the ultimate blitz3d multiplayer example and the forum menbers can use to play against each other . :-)


RemiD(Posted 2016) [#104]
I have them here, they have only 5 animations per character :
upidleholdweapon
upidleshoot
upmoveforwardholdweapon
upmoveforwardshoot
upfallonground


Rick Nasher(Posted 2016) [#105]
@RemiD:
Are these are the ones you mean, from the AlienBreed3D demo I have here:


Animated b3d's.
Shame the sourcecode isn't included..


Flanker(Posted 2016) [#106]
@Rick Nasher
You don't use your type for the health in your functions. To create the health you must write something like h.healthpowerup = New healthpowerup, h\mesh = CreateCube(). Then in update health you have to parse all health so For h.healthpowerup = Each healthpowerup and check collisions on h\mesh.

@RemiD I saw your work on animations, it's pretty neat. Here I have all the animations I want because the model is ripped from counter-strike. But the problem is, for example i'm running, then I reload my weapon, but I can't animate only the upper body by applying the animation on a bone. I though it was possible to animate a bone and its children with a specific animation sequence in Blitz3D, but it seems it's not the case natively... :(

Anyway, if you want the model, tell me what format you would prefer. I have the .ms3d from milkshape, fragmotion should be able to import it properly.


Rick Nasher(Posted 2016) [#107]
@Flanker
I know. I first was trying with only 1 entity so could see how goes using just 1, for keeping it simple as possible. But shouldn't it work without this type too?
I'm a bit confused for I've used collision code before(on types and single entities), but been a long time and I can't see why it wouldn't work without a type..
.


Flanker(Posted 2016) [#108]
Then I guess you have to replace your Type healthpowerup at the top with a Global healthpowerup and it should work for the server.


Rick Nasher(Posted 2016) [#109]
Nogo just yet. Dunno, I must be missing something. Probably someth silly. Anyway, bedtime. Tomorrow's another day.


Flanker(Posted 2016) [#110]
There isn't all the things you added but here it is for the health :


Notice the new message type "8" in the network function and update health function, to tell players wich health has been picked up.


Guy Fawkes(Posted 2016) [#111]
AWESOME!


Raster Ron(Posted 2016) [#112]
Thanks guys and sure thing. I'm glad to help out and will post new stuff if I have more ideas to share. We are having some problems with our port forwarding and service provider so I'll be glad to join in as soon as they have fixed it. :)

The new health feature looks awesome! Keep it up and Good Day to All.


Guy Fawkes(Posted 2016) [#113]
Raster Ron, the 1st thing I wanna test for you is admin / moderator / player colors / status / name tags, and then slash commands with optional parameters in the slash commands. :)

Can't WAIT to test this to pieces! <3

~GF


stayne(Posted 2016) [#114]
welp I for one am outta here. I can't take this silly crap.


Rick Nasher(Posted 2016) [#115]
Many thanks Flanker, will take a look at tonight. Very curious to see where I'm taking a wrong turn with this. I must have gone daft during my burnout. :-/


RemiD(Posted 2016) [#116]

But the problem is, for example i'm running, then I reload my weapon, but I can't animate only the upper body by applying the animation on a bone. I though it was possible to animate a bone and its children with a specific animation sequence in Blitz3D, but it seems it's not the case natively...


Ah ok, after having watched your video, i didn't understood what you wanted because the animations seem already pretty good imo.
If i understand correctly you want to have a run animation and a run + shoot animation ?
If yes i can probably create another animation by mixing the rotations/positions of the joints/bones of the lower body while the character is running and the rotations/positions of the joints/bones of the upper body while the character is shooting.

Another way which may work (not tested) would be to have 2 hidden skeleton with the same animations. And one skeleton for the character.
When you want to animate the character, you animate one hidden skeleton with the animation run, then you get the rotations/positions of the joints/bones of the lower body and you use rotateentity/positionentity to rotate/position the joints/bones of the lower body of your character.
Then you animate the other hidden skeleton with the animation shoot, then you get the rotations/positions of the joints/bones of the upper body and you use rotateentity/positionentity to rotate/position the joints/bones of the upper body of your character.

Another way would be to create 2 separate skeletons for each character (one for the lower body, one for the upper boddy) but you will probably have to modify the mesh and then rerigg, reskin, so for these tests i don't think it is worth it to do it.


Rick Nasher(Posted 2016) [#117]
@Flanker
Well, that was a rather sad undertaking from my side. :-)
Main cause, was the location of CreateScene() along with some other bugs/silly mistakes I introduced after failure of the initial 'should have worked' version..
Fixed full code with colorchat, 2 spawnhills(anti spawncamper) and easyinputenter mods below. Also changed health increase +10 to a full 100 restore, which probably makes it more usefull, something GF is probably gonna love. ;-)




All fine now, but I also noticed what appears to be a very slight performance slowdown when using:
Collisions type_chara, type_scene ,meth_elp_to_pol  , resp_sli2 ; player to scene
Collisions type_chara, type_chara ,meth_elp_to_elp  , resp_sli2 ; player to player
	
Collisions type_projc, type_scene ,meth_elp_to_pol  , resp_stop ; bullet to scene
Collisions type_projc, type_chara ,meth_elp_to_elp  , resp_stop ; bullet to player
	
Collisions type_chara, type_healt ,meth_elp_to_elp  , resp_sli1 ; health powerup to player
	

instead of:
Collisions 2,1,2,3 ; player to scene
Collisions 2,2,1,3 ; player to player
	
Collisions 3,1,2,1 ; bullet to scene
Collisions 3,2,1,1 ; bullet to player
	
Collisions 2,4,1,2 ; player to health


-Is Blitz really taking a bit of a punch when using global variables for these kind of matters? Are constants better performance wise? I thought it shouldn't make any difference, only would contribute to easy usage. Also running from iDEal shouldn't make a difference right, as it's using the same compiler stuff?


Flanker(Posted 2016) [#118]
@Rick Nasher
I always see that people use constants to set collisions types, because there is no point to change them during the game. Using constants for that is just to avoid to have to remember that 3 is bullet type, 1 is elipsoid to elipsoid etc... But this shouldn't make a performance difference I guess...

The anti spawn kill dome is a good idea :D

@RemiD
Another way which may work (not tested) would be to have 2 hidden skeleton with the same animations. And one skeleton for the character.
When you want to animate the character, you animate one hidden skeleton with the animation run, then you get the rotations/positions of the joints/bones of the lower body and you use rotateentity/positionentity to rotate/position the joints/bones of the lower body of your character.
Then you animate the other hidden skeleton with the animation shoot, then you get the rotations/positions of the joints/bones of the upper body and you use rotateentity/positionentity to rotate/position the joints/bones of the upper body of your character.

Yes you're right, that would be the best solution. Quite surprising that Blitz3D doesn't handle that natively.


Rick Nasher(Posted 2016) [#119]
It's randomly selecting between 2 re-entry places, so less easy to hang round at the same spot and shoot on site.


Guy Fawkes(Posted 2016) [#120]
I'm on chat you guys :)

~GF


RemiD(Posted 2016) [#121]
@Flanker>>If i remember correctly there is a blitz3d function to get the current animframe (after the animation has been updated) and also a blitz3d function to set the current animframe (before the animation is updated).
This would allow you to use only one skeleton for all characters and only store the current animframe of the lowerbody and the current animframe of the upper body after the animations have been updated.

(That's why i have asked Bobysait recently to take a look at the Blitz3d source code, to see if there is a way to separate updateworld() in 2 separate functions like updateanimations() and detectcollisions(), so that we could update animations or collisions separately, or even better would be the possibility to update an animation per animated entity...)


stayne(Posted 2016) [#122]
Take a look at the .md3 (Quake 3) animation importer/format for torso/legs animations.

http://www.blitzmax.com/Community/posts.php?topic=30083

http://www.oocities.org/drago_blitz/

Also you might want to write some code that checks the enemy(s) coordinates and then pick the farthest spawn point to prevent spawn camping.


Rick Nasher(Posted 2016) [#123]
Added:
-Different health strengths and spawn times for each item, so have different value to the player when picked up and also the higher the value the longer it takes for the health item to get re-spawn, so gets more rare.
-Hide entities names when can't see each other(obscurers), so no more psychic abilities to see each other coming for a mile. Effectively: can now play hide and seek/sneak. ;-)

full code:


BTW: change your default player name so you don't need to type it in every time in the line:
Global localName$ = "", defaultName$ = "RCX" ; Predefined name, so just need To press enter.

You can then just press enter when the playername question comes up.
(will develop a neat and decent frontend with saveable prefs later, this is just easy for testing)


RemiD(Posted 2016) [#124]
A note about lower body animation and upper body animation : recently i have taken a look at how the animations of the game Rune (same engine than Unreal tournament) were made and i was surprised to see that the animations of the lower body and of the upper body were not separated but mixed. For example, there is an idle animation and an idle + shoot/attack animation, and a run forward animation and a run forward + shoot/attack animation, etc... Unlike some games (Quake 3 ?) where there are 2 skeletons, one for the lower body, one for the upper body...


Rick Nasher(Posted 2016) [#125]
@RemiD:
That's rather peculiar. When I'm ready to move onto the character animation stage, I want to be able to cut/shoot off limbs(arms,legs eventually the head :D ) with for instance a sword or gun. I've seen it been done in an little codearchive example:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1736

But haven't really gone into depth analyzing code, skeletons etc, so not entirely sure where the magic happens. Sofar I only used premade animated MD2 and B3D models.

-You think something like that would be possible in Blitz3d or should I go for a more simple approach?


RemiD(Posted 2016) [#126]
@Rick>>Destroying body parts has nothing to do with having separate skeletons or animations for the lower body and for the upper body, but rather how you can rebuild your mesh in code with parts (notskinned or skinned).

For this there are 2 methods, either you use separate notskinned parts ("limbs") and you build the character by positioning orienting each part depending on the appropriate joint/bone, then set it as child of the joint/bone so that it will turn move with the joint/bone, or you use separate skinned parts and you build the character by recreating the rigged skinned mesh with a skeleton (joints/bones) + the necessary skinned meshes (body parts, clothes, armors)
For this you will need to use the upgrade vB by Bobysait here : http://www.blitzbasic.com/Community/posts.php?topic=105408 (it is doable but not easy to do, because you need to model your mesh in a certain way so that some body parts can be removed without messing the skinning near the joints...)

(i don't understand the usefulness of the lib that you linked to...)


Rick Nasher(Posted 2016) [#127]
Thanks for the explanation RemiD. The code example was just one where the dwarf cuts the other guy in half.



RemiD(Posted 2016) [#128]
@Rick>>Can you share the code example + files, the link does not seem to work anymore.
Thanks,


Flanker(Posted 2016) [#129]
If i'm not wrong Quake III use 2 different meshes for animations, one for legs/pelvis and another for the upper body so they are not connected in the middle. It's an easy way but not the best looking IMO (and I'm a Q3 fan !). I'll try RemiD's suggestion to merge animations, it shouldn't be too heavy to compute for a low players count.

Currently i'm on another project so the network library and example won't advance much for some time...

@Rick Nasher I didn't go deep in skeletons and animations with B3D too, the only test I made was the same animated mesh from CFX converted to B3D, X and MD2. MD2 was by far the lightest to use in Blitz3D, but it doesn't use skeletons so impossible to place a weapon in the hand for example, and vertices positions were not accurate. MD2 can be very useful to render a lot of animated meshes though, in an RTS for example.


Rick Nasher(Posted 2016) [#130]
@Flanker:
I'm already very grateful for the work you did on the library and examples so far. Appears to be working quite good and stable so many many thanks for that, this was just what I was looking for and apparently not only me. CFX probably is the way to go then I guess for the example was looking pretty good already. BTW if it looks like you're not going to be working on it for some time, then I hope you are willing to share what you achieved up till now, for I'm pretty sure I/we can learn a lot from what you've done to accomplish all that?

@RemiD:
Oh, thought you would have known the anim example, for it was pretty common little while back. Good thing I've downloaded pretty much nearly all that's Blitz3d :-) so here you go: 1736(animation).rar


RemiD(Posted 2016) [#131]
@Rick>>Thanks, i had not seen this code example...
I have taken a look at the code and the meshes.
The character which is cut is made in separate notskinned parts ("limbs"), and as i have explained in my previous post, each part is probably set as a child of a joint/bone, and in this example the character is not cut but rather its parts ("limbs") are separated by the animation...

But now that we have the upgrade vB, we can get the position of skinned vertices so it is probably possible to code a routine to decide where to destroy a mesh and rebuild several static parts in code and then use a physics system (or a simple random linearvelocity + random angularvelocity + gravity) to make the parts turn move, rebound, until they reach the ground. (if that's your thing :P)


Rick Nasher(Posted 2016) [#132]
You're welcome. Sounds pretty cool to me. Dunno if you know/remember the decapitation action scene in Barbarian on the Amiga:
Now that should look awesome in a 3d knight kinda game. (love te troll/lizard kicking the head and dragging the body btw lol)


RemiD(Posted 2016) [#133]
If you like this kind of action games with sword axe hammer fighting, i suggest to try Rune, Severance : blade of darkness, Drakan : order of the flame, Blood omen 2.


Flanker(Posted 2016) [#134]
@Rick Nasher
If you want to take a look, here is what I have for animations for the moment : http://www.mediafire.com/download/t554acdttuhhgsc/animtest.zip

Turn around with mouse, fire with mouse left, move with ZQSD or WASD and crouch with left shift. Change weapons with 1,2,3.

Next step would be to add all of that in types and functions to handle players like in the network example, maybe add bones collider adjusted properly for bullets and finally recode the network example. For collisions with the scene, I think 2 or 3 spheres would be enough for each player.


Rick Nasher(Posted 2016) [#135]
@Flanker:
Ah thought you went for the networking thing right away. Nevertheless interesting piece of code, as always. Many thanks.

@RemiD:
Can't say I've played these games, I'm not a fanatic gamer, but I've heard of some of these indeed, like Rune. Some things could be done better I believe.


Rick Nasher(Posted 2016) [#136]
[double post]


Rick Nasher(Posted 2016) [#137]
Hmm. ResetPlayer (when killed) doesn't appear to always update the new position of the usage to the other players correctly. Perhaps it needs a separate update..?


Flanker(Posted 2016) [#138]
This can only happen if the killed player didn't receive the notification that he was killed, so he will still send his "normal" position. For the moment there is nothing to ensure packets arrival in the library or in the example, so you can experience that with any packet... That's what I called "important" messages. They definitely need to be checked for arrival. Something that could be handled by TCP.

Eventually you can create a new message type for player reset, and send it 10 times to the killed player but that's a dirty hack...


Guy Fawkes(Posted 2016) [#139]
Any updates yet, Flanker?

~GF


Rick Nasher(Posted 2016) [#140]
Well, dirty or not, it's better than nothing. I'll try to go the 10x road, otherwise it's looking funny.


stayne(Posted 2016) [#141]
You might want to try hiding the mesh before positioning during a resetplayer due to collisions.


Rick Nasher(Posted 2016) [#142]
Hmm, well dunno if that would help for when re-spawning on getting killed the player sometimes doesn't show up on the correct spot for all players, however for the player itself (locally)it appears in the normal spot. This probably means it doesn't transmit/receive the data probably to the other players. But worth the try. won't hurt..


stayne(Posted 2016) [#143]
Ah I see what you mean. Probably due to the x/y/z packets being transmitted outta whack.


Rick Nasher(Posted 2016) [#144]
Strangely enough, not noticeable(or at least not that I can see) when just moving round etc. Only happens when resetting the entity at the spawn location. Also I never noticed it before, until I introduced another spawn location for it to choose between randomly. Don't get why that would be occurring. Perhaps more packets are missed normally but doesn't show due to interpolation?


Rick Nasher(Posted 2016) [#145]
[Update]
In UpdatePlayers() I changed the line:
If p\id <> localID  ; update other players only

into:
If p\id <> localID  And p\nextX<>-20 And  p\nextZ<>-20 And p\nextX<>20 And p\nextZ<>20 ; update other players only

Thinking it might have been because of the interpolation routine there, for the player reset difference between locations is much larger then the usual difference between movements when a packet was dropped. Even more strengthened in my believe was that the player would appear half way spawn platforms.

However above code doesn't have the desired effect: the player shows up at spawn location1 while should be at spawn location2. So it appears this has something to with it indeed. Not sure how to fix it yet though..


Guy Fawkes(Posted 2016) [#146]
Can't you just add some special code that will only check CERTAIN packets before they're sent to ensure this doesn't happen? That way it's like a FAST version of TCP. =)

~GF


Rick Nasher(Posted 2016) [#147]
Well, not me. Way above my network skill stuff.
Love this library though working on a front end for the settings etc. Even did an ugly little test logo for the gui - nothing final, was late :-) - just a try for size/positioning on the gui screen.

But this is an issue that requires a fix/workaround.

Next I'll try Flanker's suggestion, but my guess is that it's because of the interpolation working on positions constantly, while should only be when moving around normally I think(may be wrong).


Guy Fawkes(Posted 2016) [#148]
If KeyDown ( blah ) Then MoveEntity ( ent, ..., ..., ... ) : moving = 1

If moving = 1 THEN activate_interpolation = 1



Rick Nasher(Posted 2016) [#149]
Is an idea I was thinking about too. However the result is still the same:



Guy Fawkes(Posted 2016) [#150]
What about if the packet drops then realign to the default spawn point?


Rick Nasher(Posted 2016) [#151]
@ GF: Uh, but how would you know package dropped? If that happens could just as well go to the other spawn point. BTW; Did you try the modified example in post #123?

If you like we can try see if online is different? ;-)


Guy Fawkes(Posted 2016) [#152]
Yes! Lets DO this! <3

~GF


Rick Nasher(Posted 2016) [#153]
Well I'm in the usual chat. I'll let you kill me if you like. But it's a bit less easy because of the hidden stuff. ;-)

http://webchat.quakenet.org/
channel #UDPNetwork_lib


Rick Nasher(Posted 2016) [#154]
@Flanker: too busy to join? It's funny. The odd spawning bug isn't manifesting itself anymore right now somehow.


Rick Nasher(Posted 2016) [#155]
Ok played round a bit. We(GF and me) added some stuff to it(not wise, should focus on bug fixing, but nevertheless much fun):
-no more spinning when clicked outside window and keycodes (GF)
-crude audio, 2 min add-on, shot and boom sounds(me).
Full download: here

Spawn issue returned 1x though while playing over the internet.


Rick Nasher(Posted 2016) [#156]
@GF:
It's not possible to fix the chat in that it will automatically do a linefeed due to the nature of the GetKey command: it will allow you to type in continuously until enter is being pressed.

For this we would need to rewrite the chat input routines to use KeyHit/ KeyDown, which is doable, but would take quite a bit of time. I'd rather get the bugs ironed out of the system first, for otherwise wouldn't be of much use anyway huh?

We can however set a custom limit to the input accepted as a msg(not on the input console)to reflect what's on screen.
Add in main under the chat variables:
Global maxlinelength% =79

and
In UpdateChat():
				If Len(chatMessage) > maxlinelength-(Len(localName)+2)  ; so exceeds max line length
					chatMessage = Left$(chatMessage,maxlinelength) ; so ignoring all surpassing max chars.
				EndIf	

Now this is not what you're after, but in due time it will be done, if bugs are gone.


Flanker512(Posted 2016) [#157]
Sorry guys as I said I can't focus on it for now but I will probably add TCP in the future to handle important messages.

For the spawn location problem, if you have two or more different player spawns, when you reset a player you need to know where to reset it. So you have to make a new message type and send the location to everyone. To reset properly, you must set nextX, nextY, nextZ AND previousX, previousY, previousZ so you won't have interpolation. Also, use a ResetEntity to avoid collision when reseting.


Guy Fawkes(Posted 2016) [#158]
:(


Rick Nasher(Posted 2016) [#159]
@Flanker(512). A pity, but understandable. Life is hard, then you die as some may say. ;-)
Function ResetPlayer(id)
	
	p.player = Object.player(GetPlayer(id))
	
	p\life = 100
	
	location=Rand (1,2)
	If location=1
		
		p\nextX = -20
		p\nextY = 6.5
		p\nextZ = -20
		
	Else 
		
		p\nextX = 20
		p\nextY = 6.5
		p\nextZ = 20
	EndIf
	
	p\nextYaw = -45
	
	
	
	p\previousX = p\nextX
	p\previousY = p\nextY
	p\previousZ = p\nextZ
	p\previousYaw = p\nextYaw
	;back to origin.
	PositionEntity p\mesh,p\nextX,p\nextY,p\nextZ
	RotateEntity p\mesh,0,p\nextYaw,0
	ResetEntity p\mesh
	
	p\currentY = p\nextY
	
	p\previousTime = MilliSecs()
	p\nextTime = MilliSecs()+1
	
End Function
Thanks for thinking along. I figured it was something like that. Above code appears to take that into account.

Somehow it didn't do the trick, gives strange results. Locally it shows up correctly, but the other players sometimes see it appearing half way the 2 spawnlocations(so on the cube scenery) instead of at the spawnlocation *with* correct spawn height though, so Y position gets across correctly, but *not* X and Z. That's why I was thinking has something to do with UpdatPlayers() still performing an action on it that's not taken into account by ResetPlayer(). Or perhaps I made a mistake somewhere. I'll retry.


Rick Nasher(Posted 2016) [#160]
[Update] Even more weird:
When I change the 2nd spawn location's X to -20(so both locations are in each others line of site) it doesn't happen anymore that the player is displayed half way these spawn locations when reset. I've changed these X -positions in the CreateScene(), CreatePlayer() and ResetPlayer().

I was then remembering stayne's comment about hiding entities when spawning could be the key and that this was just a collision issue(with the scenery). So I restored the spawnlocation to original and tested, then added HideEntity p\mesh in ResetPlayer(), repositioned the entity and then ShowEntity p\mesh, but that didn't resolve it.

So now I'm clueless.. Why on earth would it matter where the spawnlocation is located?? Why would it create a bug?

(BTW: For anybody interested in the library I've assembled all; lib, latest examples/tests, media and docs into one cleaned-up rar file. Download <here>)

[EDIT: updated archive, for didn't contain correct 'fixed' version]


Guy Fawkes(Posted 2016) [#161]
@Rick Nasher :: I'm in the chat! Lets test! :)

Also, it matters because I don't want players spawning INSIDE my 3D trees. LOL!

~GF


Rick Nasher(Posted 2016) [#162]
@ GF: Oops.. Sorry, didn't see your msg. Had to turn in early for need to do some work round the house.

But it's not a real fix of course, for I don't know why it works and if is consistent all of the time. First thing to try is a number of times re-spawning again and again to see if holds up. Then, if remains ok, I want to put a large cube or wall in between the spawn locations to see if has an adverse effect, similar as the cube scenery in the middle appears to affect the spawning. Guess we could also try hiding the cube scenery in the middle while spawning, just to see what happens.

Well need to do some work now. Perhaps later today?


Guy Fawkes(Posted 2016) [#163]
Yes

~GF


Rick Nasher(Posted 2016) [#164]
Bad news; my burnout has re-emerged in form of bad headache when concentrating/thinking just a little bit even. I have to postpone today unfortunately. Hope some good night sleep will help otherwise I'm screwed tomorrow at work.. :-(


Rick Nasher(Posted 2016) [#165]
Back from outta space. Well, just a little.. at least feel ready for a little testing.


Guy Fawkes(Posted 2016) [#166]
Lets test today! :)

~GF


Rick Nasher(Posted 2016) [#167]
Ok, it's now dinner time here, but in 1 hour I'm on.


Guy Fawkes(Posted 2016) [#168]
I'm here! :)

~GF


Guy Fawkes(Posted 2016) [#169]
Any updates lately?

~GF


Rick Nasher(Posted 2016) [#170]
Nah. Just had some fun experimenting with differrent cams to see what works best in our little test game. I took the one from stayne's example level to see if gives a better experience in the regular in game gfx version.
But I think my own combo cam works a slight bit better. Also I like the one from a code example with the flash light in the dark. Would be nice for a day/night cycle, which I'll implement later.

But now I'm gonna try see if the 'fix' (which isn't a real fix) is consistently showing the entity correctly.


stayne(Posted 2016) [#171]
Hey guys...maybe you should start a new thread? This one is getting gigantitron.


Rick Nasher(Posted 2016) [#172]
Hehehe. You are probably right. I'm moving to my own thread until, (hopefully, one day..) Flanker, our fearless UDP hero, returns for the unexplainable spawn bug fix. ;-)


Flanker(Posted 2016) [#173]
Here is an example for random multiple spawns. Find everything that involves "spawn" in the code. The spawn location is chosen by the server.




Guy Fawkes(Posted 2016) [#174]
Guys, lets test this. I found a few glitches that need tending to with the spawn points. Here's my current version for 1.12 with all the fixes added & now spawn points added as well.

============================USER32 DECLS===================================

user32.decls:

https://www.mediafire.com/?fkydso97l65ztew

---The above goes in your "blitz3d/userlibs" folder

=============================KEYFIX_CONSTANTS==============================

KeyFix_Constants.bb:



=================================HEX8==============================

Hex8.bb:



=============================MAIN SOURCE===================================

UDPNetwork_Test_1.12.bb:



~GF


Rick Nasher(Posted 2016) [#175]
I'm now testing, many thanks Flanker. At first sight your code fix seems to solve the issue by doing it on the server (case 9).
I'll do some more testing with GF.


RGR(Posted 2016) [#176]
You may want to calculate the Hexvalues instead of looping and searching through an array


Hex8.bb:

Function RGB_To_TriHex$(iR%,iG%,iB%)
	Return ToHex8(iR) + ToHex8(iG) + ToHex8(iB)
End Function


Function FromHex8%(sHex$)
	Local iValue%, iValue2%
	sHex=Upper(Right$("0"+sHex$,2))
	iValue=(Asc(Right(sHex, 1))-48)
	iValue=iValue-(iValue>9)*7

	iValue2=(Asc(Left(sHex, 1))-48)
	iValue2=(iValue2-(iValue2>9)*7)*16+iValue

	Return iValue2
End Function


Function ToHex8$(iValue%)
	Return Right("0"+Hex$(iValue And 255),2)
End Function


Function Set_Color_Hex(sColorHex$)
	Color FromHex8(Left(sColorHex,2)),FromHex8(Mid(sColorHex,3,2)),FromHex8(Right(sColorHex,2))
End Function



Guy Fawkes(Posted 2016) [#177]
Good point. Thanks, @RGR.

~GF


Guy Fawkes(Posted 2016) [#178]
@Flanker : It seems the spawn code works, BUT now it's created a new problem. When a player is either shot or killed by another player, the player killed once respawned cannot grab health at all.

It looks like it's a network thing from our Beta tests.

~GF


Rick Nasher(Posted 2016) [#179]
@Flanker:
fixed, though the fix may mess up other stuff..


Guy Fawkes(Posted 2016) [#180]
Not necessarily, @Rick Nasher. I just tested it last night after you left me with the Server. Whenever someone becomes the Server after the original user of the Server leaves, the same thing happens. I can't grab any health.

~GF


Rick Nasher(Posted 2016) [#181]
@Flanker:
Indeed it appears to fix the spawning issues, for which we thank you. However, after adding your previous health-upgrade code to this it introduces another issue:
only the host can now upgrade it's health. Don't really get why.

After comparing your 2 versions I see the following changes:
-ResetPlayer() has been replaced by SpawnPlayer() in UpdateNetwork().
-UpdateWorld() in the main loop has moved from just after UpdatePlayers() to after UpdateBullets().
-In UpdatePlayers() the line ";ResetEntity p\mesh" has been re-activated by removing the ";".

If I put back the ";" then it appears to work, but as GF pointed out, when the original host leaves, then the unable-to-upgrade-health issue re-emerges and remains and applies also when adding a new client.

Your 2 original code examples combined into 1 below.
ADVANCED 3D EXAMPLE(spawn and healthupgrade).bb


> Any idea what we are doing wrong here? <


RemiD(Posted 2016) [#182]
I have not followed the discussion in its entirety, but i see that you are talking about updateworld(), so maybe your positionning problem is because resetentity() does not seem reliable to desactivate an ellipsoid collider. See : http://www.blitzbasic.com/Community/posts.php?topic=98459

The solution is to destroy the ellipsoid collider, then reposition, then recreate the ellipsoid collider, then you can turn move your entity again...

(i don't have time now, but i have several ideas to improve the Blitz3d collisions system, for example add the possibility to activate or desactivate an ellipsoid collider before turning moving an entity so that it is considered or not considered for the calculations of collisions...)


Rick Nasher(Posted 2016) [#183]
Thanks for the info RemiD. That's really odd(and interesting) to hear, will study this more closely. But I don't know this is the issue here, because it worked ok before the latest modifications.

BTW if you're interested in trying the Multiplayer Host switching(Peer2Peer) code then you can download the lib from the worklog link here.


Guy Fawkes(Posted 2016) [#184]
@Rick Nasher, @Flanker | I am in the chat! :)

~GF


RemiD(Posted 2016) [#185]
Well, apparently hideentity() showentity() can be used to desactivate or activate collisions for an ellipsoid collider during one or several frame(s) see : http://www.blitzbasic.com/Community/posts.php?topic=98459 #6

Apparently my old code example has an error somewhere... So don't consider it...


Rick Nasher(Posted 2016) [#186]
@RemiD:
I tried this earlier as stayne pointed it out to me in post #141 when we were trying to solve the re-spawning bug(non local player sometimes showed up at incorrect locations), but it didn't have the desired effect.

This bug got fixed by Flanker, however it didn't take his earlier health upgrade routine into account and when I tried to add it back in, it resulted in a the new bug; not being able to collide with health items so not upgrading the health, especially when not being the host or original host.

I guess as Flanker said: "ResetEntity to avoid collision when reseting", or as said on the blitz site:

Zethrax (Posted 1+ years ago)

'ResetEntity' is the command to use when you want to reposition a collision enabled entity without it being stopped by the first object it encounters that it is enabled to collide with.

Just use 'ResetEntity' immediately after the positioning command (it can actually be used anywhere between the positioning command and the 'UpdateWorld' command) and the collision data for the entity will be reset, fooling the collision system into thinking that the entity was already at the new position, and had not been moved.

Very useful when you want to teleport game characters and items, for example.




Rick Nasher(Posted 2016) [#187]
Surely hope this health upgrade issue is fixable, for then we have a solid working Multi Player framework example and can extend from there.


RemiD(Posted 2016) [#188]
@Rick>>ResetEntity() is not reliable, test it you will see.
To reposition an ellipsoid or a pivot parent of a hull (made of several ellipsoids) you want to use either hideentity, then reposition, then showentity or delete all ellipsoids, then reposition, then recreate all ellipsoids.


Rick Nasher(Posted 2016) [#189]
Uhuh, but at the moment I don't think it's even registering a collision to a health upgrade item when the user isn't the host, while before the alternations, it did work very well, so I'm pretty sure it's a logic issue(somewhere).

To summarize:
before the spawn update code we had a glitch where sometimes the non-local player would show up on different location, like it collided with something(scenery), so that indeed would indicate what you describe.
After the spawn fix, which didn't hold the health update code, I brought it back in, but it didn't register collisions anymore to the healtupgrade items when not being the host.
So yes, I do believe it may have something to do with what you describe, but I'm not quite sure how to fix without killing the spawn glitch fix..


Flanker(Posted 2016) [#190]
Ok I'll look at it. In fact I guess the health code I posted didn't handle host change because collision with health are enabled only for the server, but I forgot to enable them for the new host if it changes.


RemiD(Posted 2016) [#191]
I have updated the code examples, see for yourself what works (hide ellipsoids, then reposition root, then show ellipsoids, or delete ellipsoids, then reposition root, then recreate ellipsoids) and what does not work (reset ellipsoids, then reposition root)
http://www.blitzbasic.com/Community/posts.php?topic=98459 #6

(Note that you can use only one ellipsoid same as the root and turn move the ellipsoid to be able detect collisions and to benefit from the automatic response of Blitz3d (repositioning...), but if you want to use several ellipsoids childs of a root (to create a hull) and turn move the root to be able to detect collisions, you have to manage the response yourself (for example by repositioning the root and then the ellipsoids using tformpoint))


Flanker(Posted 2016) [#192]
Ok for the health, just remove that in the UpdatePlayers() function :
ResetEntity p\mesh ; reset entity is useful here because of collisions
It's funny because when I added it there, I stated that it was useful for collisions :D But if you look back at the health example I already commented this line. I added it at the time of extrapolation but it's useless now as extrapolation is deactivated.

And here is the new UpdateHealthItems() function to handle server change :


@RemiD HideEntity seems to work fine in the network example to deactivate a collider when it's been picked.


RemiD(Posted 2016) [#193]
@Flanker>>if you use hideentity (before updateworld), then reposition (before updateworld), then showentity (after updateworld), it works well, you don't need to use resetentity...


Rick Nasher(Posted 2016) [#194]
@Flanker:
Thanks for the update. Testing..

Update:
Appears to work marvelously, already put it into our full whistles and bells version. Well.. not the full whistles & bells, but we've added:
- can't see players name/strength through walls(so can play hide&seek).
- different health item strengths, which are also displayed above the item and take time to become available again depending on strenght.
- chattext colors matched to playercolors.
- fixes to keybd input and window focus.
- shooting sounds.

Your health item fix should also be adaptable into weapon or other items systems, which is next on my list(I will see what I can come up with lol), along with adding some stuff from the Code Archives e.g. the Moving Platforms Demo, the Chasecam with Flashlight, a day and night cycle, fixes to the chat system for; input, cheat, kick(when being a server) etc.. blitz terrain, AI enemies, a nice portal for storable settings such as resolution, sound and network prefs.

Then put this All-In-One Multiplayer example with all in-game procedural gfx into Code Archives so anybody can use it even without media and then move all over to stayne's level, add character animations and all else that may come to mind that requires media.

Again: many, many thanks Flanker.


Guy Fawkes(Posted 2016) [#195]
Flanker, where are you man? The project needs you! :/

~GF


Rick Nasher(Posted 2016) [#196]
Little updates. Had bit of time to spare.. :-)


code + media:
UDPlib V1.12 and examples(share).rar


Rick Nasher(Posted 2016) [#197]
small update: Friendly fire bugfix(really easy actually).



Guy Fawkes(Posted 2016) [#198]
Glad to see you're actively still working on this, Nasher! =) I LOVE the enthusiasm! :)

~GF


Rick Nasher(Posted 2016) [#199]
Absolutely. Slowly but surely. :-)


Rick Nasher(Posted 2016) [#200]
UPDATE 12-05-2016:
V1.66.2 correctly displaying msg+snd.
V1.69.2:
-Added 2nd (and higher) ramp to fall and die from.
-F3=display current player coords.
-Exploring health loss when falling ability: back to v1, for too buggy.
V1.69.3:
-fixed bug where chat held onto keys that would turn into player controls after submit.e.g. space=jump.
-Temporary disabled health loss when falling ability.
-Changed death sound, fixed all sounds to play local and on networked players, added typwrittersounds for chat(only Local) and submit snd on network to attract attention. Only 1 audio bug remaining: producing hit sound while actually collecting an item or when player(client) gets introduced into game (unclear why).

KNOWN BUGS:
-producing hitsound while actually collecting health item or when player(client) gets introduced into game .
-when enabled 'health loss when falling ability' it works, but also kills the player when running down a ramp.




Code & sounds(changed) >Here<


RustyKristi(Posted 2016) [#201]
hey Rick Nasher, I was wondering how would you make the EntityRadius bigger so that it won't pass through the ground and fall endlessly. Currently it is set to 1 and would like to resize it. thanks.

Really great job you guys have done here!


Rick Nasher(Posted 2016) [#202]
@RustiKristi
Moved here: http://www.blitzbasic.com/Community/posts.php?topic=104840#1306157
For this is actually Flanker's thread.


Rick Nasher(Posted 2016) [#203]
EDIT:
Jumping of a too high cliff will now get you killed if not landing on something else higher up and falling reduces life(health actually).
Player can push each other, player color changes when died and revive delay installed as well as teleporting.
Update here