BlitzNet Optica availiable now!

BlitzMax Forums/BlitzMax Programming/BlitzNet Optica availiable now!

AntonyWells(Posted 2006) [#1]
Hi,

BlitzNet optica, my new networking library for all versions of BlitzMax (Full source code included so simply a matter of compiling on the platform of your choice.) is on sale now.

http://dreamspace.awardspace.com/

Here's the features section cut and paste from the site.


.Client/Server Model.



.UDP based for the best performance possible.



.Fully controllable reliable in ordered packets and out of order faster unreliable packets on a per variable basic.



.Revolutionary virtual classes methodology. Create and maintain virtual network classes the represent anything you wish. From players to bullets, to Chatter classes.



Example:



Local Ship:TClass = TClass.Create("Ship")

Ship.AddFloat("X")

Ship.AddFloat("Y")

Ship.AddString("Name")





.Smart message packeting and compression, means all messages bound to the same address are grouped of, compressed and send in a custom high performance format.



.Event Call backs. Coding networking has been easier, simply write a call back for all events possible in a simple to use design.



Unlimited amount of players. Code that MMORPG you've always dreamed of.



Intelligent update code, that never updates a virtual variable that has not changed

is not updated.



Create an unlimited amount of classes per server.



Inteligent server, routes and updates the network for you without requiring any interaction. Never worry again about sending the right data to the right client. The server knows when and how to update the right clients.

.





Dreamora(Posted 2006) [#2]
A chance to get a little demo game (with the sources to the game without the module logically :-) ) that especially shows those to points:



.UDP based for the best performance possible.



.Fully controllable reliable in ordered packets and out of order faster unreliable packets on a per variable basic.


To compare it to BMs own networking and BNetEx


AntonyWells(Posted 2006) [#3]
Don't twist my words, I was refering to it being the best protocol for network games, not having a dig at other libs.

I've not used ENET and BlitzNet is build on top of bnetex. What it brings to the table is an entirely new way of networking. (Based on my experience with other network libraries.)

Here's an example Server.

Import "Network.bmx"


Local server:TServer = TServer.Create(5555 )

Local player:TClass = Tclass.create("Ship")
player.AddFloat("X",100,False)
player.AddFloat("Y",100,False)
Local nl:TLogger = Tlogger.Create("Server")

server.addClassTemplate( player )

Local fc=0
Local play:TClass
Repeat

	nl.update()
	server.update()

	
	Delay 20
Forever



And an example client.

Strict
Import "Network.bmx"

Local ip$=Input("Network I.P(Leave blank for 127.0.0.1)")
If ip=""
	ip="127.0.0.1"
EndIf
Global name:String =  Input("Name>")
Local nl:TLogger = Tlogger.Create(name)

'Set up client.
Global client:TClient = TClient.Create( name,ip,5555 )

'Create player class template
Local ship:TClass = Tclass.create("Ship")
ship.addFloat("X",100,False)
ship.addFloat("Y",100,False)
client.addClassTemplate( ship )

'---Wait till connected
SeedRnd( MilliSecs() )


'Register Event call back

client.RegisterEventCallBack( New DemoCallBack )

'---Create Event callback class.
Type DemoCallBack Extends NEventCallBack
	Method OnNewClass( event:NEvent )
		
		Select event.own.class
			Case "Ship"
				Print "Spawned "+event.own.name
				Local b:Bot = CreateBot( event.own.name,event.own )
				event.own.setData( b )
				
		End Select
	
	End Method
	
	Method OnDeleteClass( event:NEvent )
		netlog.log "On delete called."
		
		Select event.own.class
			Case "Ship"
				netlog.log "Disconnecting"
				Local b:bot = Bot( event.own.getData() )
				If b = Null
					Print " no data to remove "
				EndIf
				bots.remove( b )
				
				Print event.own.name+" Disconnected"
		End Select
	
	End Method
	
	Method OnConnect( event:NEvent )

		Print "Connected.."
		Local play:TClass = client.SpawnClass("Ship",name )
		Player = CreateBot( name,play )
		player.loc = True
		play.SetData( Object( Player ) )
				
	End Method
	
	Method OnUpdateVar( event:NEvent )
	
		Local b:Bot = Bot( event.own.getData() )
		
		Select event.varo.name
		
			Case "X"
				
				b.x = event.varo.val
				Print "Updated X To:"+b.x		
			Case "Y"
			
				b.y = event.varo.val
				Print "Updated Y To:"+b.y
		
		End Select
	
	End Method

End Type


'Bot List and Local Player object
Global Bots:Tlist = CreateList()
Global Player:Bot

Type bot
	
	Field net:TClass
	Field x#,y#
	Field loc
	Method Draw()
		DrawRect x-10,y-10,20,20
	End Method

End Type

Graphics 320,240,0


Repeat
Cls
	
	nl.update()
	client.update()
	
	If MouseDown(1)
		If player.net<>Null
		client.deleteClass( player.net )
		player.net = Null
		EndIf
		
	End If
	
	If player<>Null And player.net<>Null
		player.x:+1
		player.y:+1
		player.x = MouseX()
		player.y = MouseY()	
		'If player.x>320
	'		player.x=0
	'	EndIf
	'	If player.y>240
	'		player.y=0
	'	End If
		player.net.setfloat("X",player.x,True )
		player.net.setfloat("Y",player.y,True )
	EndIf
	
	
	
	
	
	
	
	client.ClearEvents()
	For Local b:Bot = EachIn bots
		
		
		b.draw()
	Next
	If player<>Null
		DrawText "X:"+player.x+" Y:"+Player.y,1,1
	EndIf
	
Flip

Until KeyDown(KEY_ESCAPE)
	
Function CreateBot:Bot( name:String,class:TClass )
	
	Local b:Bot = New bot
	b.net = class
	bots.addlast( b )
	Return b
	
End Function






AntonyWells(Posted 2006) [#4]
But yeah, a demo is a good idea and definitely will release one soon. Writing it atm. Want it to look pretty spiffy.


SillyPutty(Posted 2006) [#5]
yeah, I really want to see some binaries and source, to see how it stacks up.


AntonyWells(Posted 2006) [#6]
I'm coding a game called Nova Wars to demonstrate it.

Just finished the first update(All updates are free) of the lib. It adds server side class objects. So now you can create virtual classes on the server and maintain them on the server.

This allows many things including co-op games, as the server can create and maitain the ai monsters and just pass the data to the clients.

Think I'll make nova wars co-op v ai to demonstrate this.


SillyPutty(Posted 2006) [#7]
sounds good

looking forward to it :)


Kanati(Posted 2006) [#8]
Once again... Supporting the community with a purchase sight-unseen... Library purchased.


tonyg(Posted 2006) [#9]
Kanati, could you play with it and write a review?


AntonyWells(Posted 2006) [#10]
Heh, thanks Kanati. Your money will go to a good cause. :)


RepeatUntil(Posted 2006) [#11]
This library sounds interesting!! I would like to see a demo (even a simple demo).
Why didn't you use ENet??


AntonyWells(Posted 2006) [#12]
I found Enet overly complicated and and not really orientated the way I'd like.

Now I have BlitzNet Optica I feel like there's no hurdle between any type of multiplayer game I want to create. It's just so natural. No messing about sending messages and listening for them. Just create objects and use them like you would a global variable.


Kanati(Posted 2006) [#13]
now if I could just GET the library. hint hint. :)


AntonyWells(Posted 2006) [#14]
No problem, was just waiting on the e-mail notification of the sale for your e-mail. Didn't come but I just checked the main site and it has the sale. No e-mail though. Same as in your profile?


SillyPutty(Posted 2006) [#15]
please write some demos Kanati :)

Would really like to see this in action.


Kanati(Posted 2006) [#16]
yeah... kanati@... or the paypal address will work just as well (e_stout@...)


Dreamora(Posted 2006) [#17]
The way it works looks a little like GNet (with automatic syncronisation of Local -> Remote objects of network objects between host and its client), just on a "more OO way" with callbacks and events.

Sounds interesting and will definitely have a look on it when there is some more available as I am working on a CO RPG which needs a scalable but reliable UDP networking layer. and I'm not that of a "UDP guy" :-)


Kanati(Posted 2006) [#18]
aaaaand... still waiting.

I'm one of those guys that gets impatient when ordering something online and don't get immediate gratification. :)


SillyPutty(Posted 2006) [#19]
hehe

I just want to see demo's


Kanati(Posted 2006) [#20]
<cough>Order number #468469<cough>


Regular K(Posted 2006) [#21]
Does it handle interpolation and extrapolation? or is that up to us?


AntonyWells(Posted 2006) [#22]
It's primary an inteligent network router so no smoothing is done on the numbers.

We'll be adding Cubic splines in a future update however which is a popular technique for combating lag. And by future I mean real soon. need it for our game.


AntonyWells(Posted 2006) [#23]
Sent Kanati. Sorry for the delay.


Regular K(Posted 2006) [#24]
I may buy it if its not a big hassle to send a money order. Not now though but in the future. Ive been looking for a good network for Blitzmax.


SillyPutty(Posted 2006) [#25]
I'll maybe buy if I can see some demo's


Kanati(Posted 2006) [#26]
Got it... thanks.

But... OUCH. No docs at all? That should be primary importance right now. I'm not even gonna look at it real hard til then.

Well... maybe a little bit.


AntonyWells(Posted 2006) [#27]
Yeah no docs, yet. Not sure what to use to create them. Can BBDOCS make docs for non brl mods?


RepeatUntil(Posted 2006) [#28]
Is it possible to send reliable UDP but NOT ordered?? I need reliable UDP, but I don't care about the order of the arrival. Is this possible in your lib to switch independently on and off reliable and ordered??

Also, do you plan to add encryption to this lib???


N(Posted 2006) [#29]
I'm waiting on the documentation and demo before I consider this for use. As-is, I'm using my own interface built on top of enet.

Yeah no docs, yet. Not sure what to use to create them. Can BBDOCS make docs for non brl mods?


Yes, or you could just write them in some text editor.


popcade(Posted 2006) [#30]
I can't access the site.....

Actually I'm interested to purchase it, but unable to visit your site...


AntonyWells(Posted 2006) [#31]

Is it possible to send reliable UDP but NOT ordered?? I need reliable UDP, but I don't care about the order of the arrival. Is this possible in your lib to switch independently on and off reliable and ordered??

Also, do you plan to add encryption to this lib???


Yeah easy enough to add. I'll that in the next update actually, in ordered packets are only useful for critical data.

Encrpytion I'm not sure of though, depends on whether I can find a good fast lib. :) I may try to write one myself but I'm not sure how effective it would be. Never wrote one before.

[quiote]Yes, or you could just write them in some text editor.[/quote]

Could do but then the user won't be able to click on a function and go to it's describtion. I may write a doc generator myself actually. Did one for vivid and it was pretty neat.

I can't access the site.....


Try it now, works fine for me.


AntonyWells(Posted 2006) [#32]
But just in case the site is down, here's the shop link. :)
https://gbp.swreg.org/soft_shop/50943/shopscr2.shtml


popcade(Posted 2006) [#33]
Placed the Order, I like the way the the module comes with source... in case BMax upgrade breaks the modules in the future...


N(Posted 2006) [#34]
Could do but then the user won't be able to click on a function and go to it's describtion. I may write a doc generator myself actually. Did one for vivid and it was pretty neat.


Been there, done that (three times), God forbid I have to do it again... most boring thing ever :S


AntonyWells(Posted 2006) [#35]
Been there, done that (three times), God forbid I have to do it again... most boring thing ever :S


Suppose it would be if you're parsing source. Lot of boring tokenization stuff. My one just parsed a plain text master doc and produces a fully index doc folder from it. Which was a satisfying feeling :)


RepeatUntil(Posted 2006) [#36]

Could do but then the user won't be able to click on a function and go to it's describtion. I may write a doc generator myself actually. Did one for vivid and it was pretty neat.


Don't do that! I am the author of Cod2Doc(see sig) and I can tell you that these things take a LOT of time!! I prefer you add some functionalities to your net lib ;-)
By the way, you could use Cod2Doc to document your lib, I did that for ETNA (see http://repeatuntil.free.fr/Etna/Etna_doc.html). If you need more details, drop me a line at "repeatuntil _AT_ free.fr".


Encrpytion I'm not sure of though, depends on whether I can find a good fast lib. :) I may try to write one myself but I'm not sure how effective it would be. Never wrote one before.


I am working on adding encryption to ETNA and we are using a very fast and standard function (RC4, see http://www.rsasecurity.com/rsalabs/node.asp?id=2250) to encrypt with a key. Here is the function if you want to use it (it's in PureBasic, but it should be easy to adapt to BM):
Procedure.s ETNA_RC4(Inp.s,Key.s)
  Dim S.w(255)
  Dim K.w(255)
  i.l=0: j.l=0: t.l=0: x.l=0
  temp.w=0: Y.w=0
  Outp.s=""

    For i = 0 To 255
        S(i) = i
    Next

    j = 1
    For i = 0 To 255
        If j > Len(key)
            j = 1
        EndIf
        K(i) = Asc(Mid(key, j, 1))
        j = j + 1
    Next i

    j = 0
    For i = 0 To 255
        j = (j + S(i) + K(i)) & 255
        temp = S(i)
        S(i) = S(j)
        S(j) = temp
    Next i

    i = 0
    j = 0
    For x = 1 To Len(inp)
        i = (i + 1) & 255
        j = (j + S(i)) & 255
        temp = S(i)
        S(i) = S(j)
        S(j) = temp
        t = (S(i) + (S(j) & 255)) & 255
        Y = S(t)
        Outp = Outp + Chr(Asc(Mid(inp, x, 1))!Y)
    Next
  ProcedureReturn Outp
EndProcedure



AntonyWells(Posted 2006) [#37]
Don't do that! I am the author of Cod2Doc(see sig) and I can tell you that these things take a LOT of time!! I prefer you add some functionalities to your net lib ;-)
By the way, you could use Cod2Doc to document your lib, I did that for ETNA (see repeatuntil.free.fr/Etna/Etna_doc.html). If you need more details, drop me a line at "repeatuntil _AT_ free.fr"


Yeah I think I used code2doc for vividgl before my writing my own. Wasn't aware it's been updated for bmax?

Is it free? If not, interested in a swap for a copy of blitznet? :)


am working on adding encryption to ETNA and we are using a very fast and standard function (RC4, see www.rsasecurity.com/rsalabs/node.asp?id=2250) to encrypt with a key. Here is the function if you want to use it (it's in PureBasic, but it should be easy to adapt to BM):



Man been awhile since I coded any pb.Are the S'ereseses strings?
Thanks anyway, I'll give it a go in the morning. 6am and i'm not asleep. :)


RepeatUntil(Posted 2006) [#38]
No, Cod2Doc was not updated for BlitzMax, but there is a simple trick to document any functions. In fact, in a BlitzBasic file, put the *empty* functions you want to document, with some comments that will be treated by Cod2Doc:
; Specify to ETNA the server address where are located the PHP files. 
; server = Server address.
Function ETNA_Initialise(server)
End Function 

Then run Cod2Doc on this file, and it will create a html page for you (7 or 8 styles are possible). The output will give something like this: http://repeatuntil.free.fr/Etna/Etna_doc.html . Not perfect solution, but very easy to have some nice docs. Now I am thinking of it, you can only document functions. If you want to document objects, then Cod2Doc won't work...
By the way, Cod2Doc is free...

For the encryption, the .s is string, the .w is word (I guess), the .l is float (or long). So pretty easy to convert I guess...


AntonyWells(Posted 2006) [#39]
Ah then I'm out of luck as Bnet is entirely oop. There are only about five procedural functions that are only called internally by the engine.

Thanks for cleaing up the pb code. I guess it's easy to assume what they are but so many bugs are born out of silly assumptions :) Good to know for sure.


RepeatUntil(Posted 2006) [#40]
for the encryption, I give you an equivalent in php, if you prefer:
	function encrypt ($pwd, $data)
		{

			$key[] = '';
			$box[] = '';
			$cipher = '';

			$pwd_length = strlen($pwd);
			$data_length = strlen($data);

			for ($i = 0; $i < 256; $i++)
			{
				$key[$i] = ord($pwd[$i % $pwd_length]);
				$box[$i] = $i;
			}
			for ($j = $i = 0; $i < 256; $i++)
			{
				$j = ($j + $box[$i] + $key[$i]) % 256;
				$tmp = $box[$i];
				$box[$i] = $box[$j];
				$box[$j] = $tmp;
			}
			for ($a = $j = $i = 0; $i < $data_length; $i++)
			{
				$a = ($a + 1) % 256;
				$j = ($j + $box[$a]) % 256;
				$tmp = $box[$a];
				$box[$a] = $box[$j];
				$box[$j] = $tmp;
				$k = $box[(($box[$a] + $box[$j]) % 256)];
				$cipher .= chr(ord($data[$i]) ^ $k);
			}
			return $cipher;
		}
	


		function decrypt ($pwd, $data)
		{
			return rc4crypt::encrypt($pwd, $data);
		}


Hope it helps!


AntonyWells(Posted 2006) [#41]
Dude, Pb was bad enough but php is off the radar :)

Thanks though, I'm sure if I squint hard enough it'll make sense. Now where did I leave my pair of Clark Kents.


SillyPutty(Posted 2006) [#42]
any demos yet ? Can anyone who bought this vouch for it ?


Kanati(Posted 2006) [#43]
Can't vouch for it yet... I need docs first. It looks good in theory though.


Booticus(Posted 2006) [#44]
Dont worry, I already bought it and am pestering Aurora as we speak for some demo code. ;) But I'll wait patiently on it till then.


AntonyWells(Posted 2006) [#45]
Heh I'm going to write a gui driven chat program with it tonight build in max. This does mean the demo requires maxgui though I'm afraid. I didn't want to do this but Mark saw that blitznet could drive up sales of maxgui tenfold so he bribed and asked me not to tell anyone. Wait a minute, ignore everything I just said.


SillyPutty(Posted 2006) [#46]
Why not release some binaries ? Is that so difficult ?


RepeatUntil(Posted 2006) [#47]
Argh, please, do a demo also for non maxGui owner like me!!! Anyway, it's easier to understand a code without to many fancy things...

By the way, for the encryption, I told you that the PureBasic code 5 or 6 posts above was not working perfectly. I was wrong. It's working correctly. So you can use any of the 2 functions I gave you for the RC4 encryption (php or PureBasic)... Give it a try, I have this in ETNA now, and this really cool!!!!!


AntonyWells(Posted 2006) [#48]
Why not release some binaries ? Is that so difficult ?


I will release an exe of the chat program. You'll only need maxgui to compile it if you buy the lib.


Argh, please, do a demo also for non maxGui owner like me!!! Anyway, it's easier to understand a code without to many fancy things...

By the way, for the encryption, I told you that the PureBasic code 5 or 6 posts above was not working perfectly. I was wrong. It's working correctly. So you can use any of the 2 functions I gave you for the RC4 encryption (php or PureBasic)... Give it a try, I have this in ETNA now, and this really cool!!!!!



*explitive deleted*

:)

Nah seriously I'll try to do something for non gui owners but I don't know how long it'll take. I'm supposed to be working on a game with this lib(And ogremax) and I've not put much work in lately, just been doing my own thing which ain't fair on the other guys.

Good to hear the pb one works because frankly I don't think I Was going to try and dechiper the php version :)


tonyg(Posted 2006) [#49]
I'm supposed to be working on a game with this lib(And ogremax)and I've not put much work in lately, just been doing my own thing which ain't fair on the other guys.

Sounds familiar and just a little bit ominous.
I'll look at this again in a couple of months to see what sort of support commitment is given to it and whether there is more feedback and information on the product itself.


AntonyWells(Posted 2006) [#50]
Sounds familiar and just a little bit ominous.


Paranoia, the destroyer.


tonyg(Posted 2006) [#51]
You maybe right.
However, it's difficult to sign-up when the announcement post has a statement saying commitment is to another project. I can believe the library is superb 'as-is' but it's still nice to see it working and be confident of future support.
<edit> It's not a problem just a suggestion you might want to rethink your announcement.


SillyPutty(Posted 2006) [#52]
just been doing my own thing which ain't fair on the other guys.


Also unfair to customers and potential buyers. I need to know that I am buying the product and support, and that the product will be actively maintained.

I for one will not be buying your modules.
No docs, even simple ones, No Examples whether in demo form or not.

You are selling an incomplete product IMHO.


AntonyWells(Posted 2006) [#53]
Also unfair to customers and potential buyers. I need to know that I am buying the product and support, and that the product will be actively maintained.


Are you even aware of what you are talking about? How can it possibly be unfair to customers if I meant working on the project they paid money for?

It would be unfair for me not to, not the other way around.

As for the example app it's complete and sitting on my hd. I've got no ftp space so I'll have to ask ad again when he comes online? Unless you're offering to host it? Didn't think so.


AntonyWells(Posted 2006) [#54]

However, it's difficult to sign-up when the announcement post has a statement saying commitment is to another project. I can believe the library is superb 'as-is' but it's still nice to see it working and be confident of future support.


You have to take into account the other project is a multiplayer game that uses BlitzNet Optica as it's network library. So if anything that commiment ensures BlitzNet's future much more so than the sales of it would.(Sold 4 copies thus far. Hardly a retirement fund :) )


AdrianT(Posted 2006) [#55]
It's true it might be used in our game, and if the engine works out then the netlib will be proven since MP is a fairly important part of the gameplay. It's still early days yet and all the stuff that relates to an unfinished engine kind of got me the wrong way first thing in the morning.


AntonyWells(Posted 2006) [#56]
Removed due to irate clown with a gun.


Kanati(Posted 2006) [#57]
just get me some damn docs. :)

and I can host for you if you want.


AdrianT(Posted 2006) [#58]
:P


AntonyWells(Posted 2006) [#59]
Removed due to court order.


AdrianT(Posted 2006) [#60]
.


AntonyWells(Posted 2006) [#61]
Removed due to the spice girls reforming.