Valhalla Legends Archive

Programming => General Programming => Topic started by: Anubis on July 28, 2003, 12:07 AM

Title: VB with websites
Post by: Anubis on July 28, 2003, 12:07 AM
Hi, I've been making a chat server/client (in VB6) and I've been having trouble getting it to work over networks (If I'm on a network and my friend is on a different network, it wont connect.) Is there a way to do something like WebBot (Where it connects and sends/recieves data on a website)? If anyone can give me any help on this that would be great. Also, if anyone could give me some sample code that would be nice too :) I'm new to using VB with websites... Thanks
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 01:12 PM
You are probably way in over your head, but I'll give you the benefit of the doubt and try to answer your question anyways.

There are basicly two approaches you can take: one is to use HTTP Push and Pulls to immediately send data as it is updated, and the other is to store all of the information in a database that a script will read and create html for. You will need some program -- be it a custom server or custom bot -- to have access to the database and update the database with chat/the userlist as they change. One alternative to this would be to use BotNet; I wont get too detailed on this method.

If you are new to any of these concepts, I suggest you do some research on SQL databases, PHP, and possibly even ODBC (unless you are going to use MySQL).
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 01:24 PM
Quote from: Camel on July 28, 2003, 01:12 PM
There are basicly two approaches you can take: one is to use HTTP Push and Pulls to immediately send data as it is updated,

Could you explain this method some more? What ways are there for pushing updates to a client? Like, know any better method for updating an image than pushing animated gif frames down to the client?
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 04:04 PM
Quote from: Adron on July 28, 2003, 01:24 PM
Quote from: Camel on July 28, 2003, 01:12 PM
There are basicly two approaches you can take: one is to use HTTP Push and Pulls to immediately send data as it is updated,

Could you explain this method some more? What ways are there for pushing updates to a client? Like, know any better method for updating an image than pushing animated gif frames down to the client?

One can do that? Wouldn't the browser not draw the picture until it's finished downloading, which would never happen?

Well, to answer your question, no I don't know a better method, per say. I would probably have the picture just refresh itself automaticly. If the browser refuses to download the picture because it wants to cache the image, you might try adding a random unused number at the end of the url, ex: http://www.domain.com/images/picture.php?seed=<random> (http://www.domain.com/images/picture.php?seed=<random>), and then using JavaScript to update the url of the picture with a new random seed on a timer.
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 04:06 PM
Well, if you look at my avatar you'll see a gif that keeps sending down frames to the browser... The problem is that because of their slow computers, some people complain that it's using 100% of their CPU after 30 seconds.
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 04:14 PM
Quote from: Adron on July 28, 2003, 04:06 PM
Well, if you look at my avatar you'll see a gif that keeps sending down frames to the browser... The problem is that because of their slow computers, some people complain that it's using 100% of their CPU after 30 seconds.

Right, that was what I was concerned with. I havn't played around with HTTP Push at all, but perhaps it is possible to send some command that will cause the client's browser to refresh the image? Then you would be able to send that, for example, every 30 seconds or whever the song changed or something.

[edit] Oh yeah, and how did you draw the spectrum? Is it winamp, and if so is there an sendmessage command or something?
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 04:30 PM
Hmm. I suppose I could actually send a Refresh header. I wonder if a browser will refresh an image though? I'm not sure if it only works for html pages...

I drew the spectrum "by hand" from raw spectrum data received from the Winamp plugin interface.
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 04:36 PM
Quote from: Adron on July 28, 2003, 04:30 PM
Hmm. I suppose I could actually send a Refresh header. I wonder if a browser will refresh an image though? I'm not sure if it only works for html pages...

I drew the spectrum "by hand" from raw spectrum data received from the Winamp plugin interface.

Possibly -- if the browser isn't crap, I dont see why it wouldn't...
Could you perhaps just assemble as many frames of the gif as is required to get the title to cycle once, and then have it loop?

Ahh, that makes sense. You must have been really bored, though. ;)
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 04:38 PM
Not all that bored, it was rather interesting. I learned:

How to write an ISAPI plugin

How to write a Winamp plugin

How to have a memory DC where I alternately write using GDI functions and touch the memory directly

How to compress data using the Lempel-Ziv algorithm (implemented compressor)

How to encode a GIF



I'd say 75-90% of the code was new and interesting things. A very good learning project. Very much more interesting than anything that has a GUI.
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 04:40 PM
Hmmbtw, by "by hand" I mean that I write it pixel by pixel in a loop...

And it's displaying data live from my Winamp - I'm seeing it moving in sync with the music.
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 04:41 PM
Quote from: Adron on July 28, 2003, 04:38 PM
Not all that bored, it was rather interesting. I learned:

How to write an ISAPI plugin

How to write a Winamp plugin

How to have a memory DC where I alternately write using GDI functions and touch the memory directly

How to compress data using the Lempel-Ziv algorithm (implemented compressor)

How to encode a GIF



I'd say 75-90% of the code was new and interesting things. A very good learning project. Very much more interesting than anything that has a GUI.

Ever used OpenGL? It's phuuuuuuuuun.
/me considers rendering a frame with OpenGL and then dumping it to a streaming online picture...
Hey Adron, you interested in doing that? PM me.
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 04:50 PM
What nice thing could I do with OpenGL? I'm a little sceptical mostly because I associate OpenGL with producing 3D graphics - lots of graphics at high speed - which would totally kill bandwidth if put as a streaming gif...
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 04:58 PM
I was thinking more along the lines of expanding the winamp thing -- it's easy to produce cool looking small images with OpenGL because of the effects it provides. One need not draw frames at high speeds.
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 05:01 PM
Hmmm... I like to draw this one at "realtime" speed so I see it move to the music. Any example of what I could do with OpenGL?
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 05:07 PM
Quote from: Adron on July 28, 2003, 05:01 PM
Hmmm... I like to draw this one at "realtime" speed so I see it move to the music. Any example of what I could do with OpenGL?

Meh, AIM me and I'll send you a screenshot or something.
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 05:08 PM
Well, I don't have AIM....
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 05:29 PM
ICQ? MSN? Yahoo?
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 05:30 PM
Couldn't you just simply post a link to it? That way everyone can see an example too...
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 05:38 PM
Well here's an extremely simple project I did to prove a friend wrong and win $5. He wrote a Boids! program (simulates flocking birds) with Java, and argued that it would be easier to do it in C with OpenGL.
This really doesnt do justice to the power of OpenGL, but it does prove a point: OpenGL isn't that hard to use.

There was no need to add any special effects such as those one might use in a winamp plugin.

(http://camel.ik0ns.com:84/images/boids.jpg)

[edit] Here's another screenshot -- each color is a "team" of birds that is avoiding eachother:
(http://camel.ik0ns.com:84/images/boids2.jpg)
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 05:40 PM
Hmm, it isn't immediately obvious how it would apply to Winamp? Of course, I could make generic graphics, but I can do that just using GDI - no need for OpenGL to do that?
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 05:47 PM
Quote from: Adron on July 28, 2003, 05:40 PM
Hmm, it isn't immediately obvious how it would apply to Winamp? Of course, I could make generic graphics, but I can do that just using GDI - no need for OpenGL to do that?

You could, but it would be much easier to do it using OpenGL. One of the things it does rather well is "glowing orbs" which can be used to produce a huge variety of effects.

[edit] Oh yeah, and it can do teapots. I mean, come on...teapots! Resistance is futile!
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 05:53 PM
I used to mess around with 3d studio max, but .. it got boring. What's a "glowing orb"?
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 05:54 PM
Do you have any more info for that birds program btw? It would be interesting to see the algorithm for how they fly...
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 06:00 PM
Quote from: Adron on July 28, 2003, 05:53 PM
I used to mess around with 3d studio max, but .. it got boring. What's a "glowing orb"?
It's like a luminous ball of light. They are extremely over-used in Unreal Tournament. If you've ever tried to set up a PLBot in counterstrike, you might recognize them as the yellow "nodes" used to tell the bots where they can go. I'll see if I can get you a screenshot.

Quote from: Adron on July 28, 2003, 05:54 PM
Do you have any more info for that birds program btw? It would be interesting to see the algorithm for how they fly...
I dont do it properly as I was just proving him wrong on the OpenGL part. I only glanced at his code, but it looked like it went through a loop for every bird and then another loop to find out all of the birds within a pact or something. It would then locate the centermost bird of the pact, and follow it around. The white circle represents a barrier that the birds must avoid.
With my code, the birds just turn based on obstacles and the direction of birds immediately surrounding them.
Title: Re:VB with websites
Post by: Adron on July 28, 2003, 06:05 PM
Ah. I like doing simulations. I might make a streaming simulation of flying birds instead, if I get the right algorithm.... ;)

The slowdown is a rather serious problem though. Trying to see if it works with Refresh will be interesting.
Title: Re:VB with websites
Post by: Camel on July 28, 2003, 06:26 PM
Quote from: Adron on July 28, 2003, 06:05 PM
Ah. I like doing simulations. I might make a streaming simulation of flying birds instead, if I get the right algorithm.... ;)

The slowdown is a rather serious problem though. Trying to see if it works with Refresh will be interesting.

Right, that's sort of what I was thinking of. I was a little more interested in having the picture reacting to the music though. It's not imperative to update immedately. Imagine having it update really quickly, but only taking one in every, say, 50 frames and sending that. Then stop drawing the other 49 frames. :)
Title: Re:VB with websites
Post by: CaBAM on July 28, 2003, 11:38 PM
Wow, i just noticed how much the subject changed...