Page 1 of 1

Help making an online chat box

Posted: Fri Jul 17, 2009 4:03 pm
by hellfiresage
hi and hello i'm fairly new to programming and i was trying to create something along the lines of an online chat box/forum where you could just open the program and whoever else had the program could open their and post a topic then you would be able to see it and connect to talk with that person. Is that possible with love? if so how would you go about scripting that out? :) thank you in advance!

Re: Help making an online chat box

Posted: Fri Jul 17, 2009 4:16 pm
by Tenoch
Techically it's possible. I have for instance a chat thingy included in my LÖVE project (https://launchpad.net/poyta, feel free to study and copy the code).

Keep in mind that:
  • - Right now text input is very limited (no charset conversion or automatic capitals with shift) except if you code it yourself for each keyboard layout existing...

    - To have a forum-like thing where text is memorised, you need a server that is always up, and possibly that reads and writes in files on the server's hard drive. That's more complex already, but you can also do it in LÖVE (although I'd recommand using pure Lua + LuaSocket for a server, since running a graphical app for a server is not always possible and not really CPU friendly. I did this in the aforementionned project (free advertising FTW) (nested parentheses too)).
So, yes, possible. Writing network code is - I found - quite easy, but necessitates to be very careful. And doing an app-like GUI in LÖVE is quite tedious (LÖVE is more meant for games than apps).

But possible :nyu:

Re: Help making an online chat box

Posted: Fri Jul 17, 2009 4:42 pm
by bartbes
Especially with this lua might be 'dangerous', because it accepts anything. This might sound weird, but what I mean is that your code is not as 'solid' as C, again vague. Let me say it good: you'll need a few checks, if you want to do it right, don't accept everything. (talking about data)

It is possible, but.. why? We have an active forum (oh.. so, that's where I keep spending my time..), we have IRC, it might not be an all-in-one program, but it works. And, as Tenoch said, LÖVE is made for games, not applications, this is the reason why creating such an application in LÖVE will not be CPU-friendly, not to mention: hard.

Re: Help making an online chat box

Posted: Fri Jul 17, 2009 4:47 pm
by hellfiresage
Ok i know i can use a server so i was wondering if you could somehow write a script where it would save the chats comments in a temporary file then when you log out it would delete it. Ok so a scenario here:
player 1 opens program
player 1 makes a nickname then hits "start chatting"
player 2 opens program makes a nickname and hits "start chatting"
player 1 makes a chat room and labels it "hi"
player 2 sees chat room and clicks on "hi"
player 1 sees him enter
player 1 starts chatting with player 2
the chat is displayed on the screen and saved in a file on each players computer. allowing them to scroll up and down the chat reviewing the history.
player 1 is done chatting and logs closes the program.
at this point the chat room is deleted and both player's chat history file is deleted.
player 2 logs closes the program.


in the chat box i would like certain functions like sign off, exit chat room, make a new chat room, join another chat room.

do you think that that way would be easier?

Re: Help making an online chat box

Posted: Fri Jul 17, 2009 4:58 pm
by Robin
bartbes wrote:Let me say it good: you'll need a few checks, if you want to do it right, don't accept everything. (talking about data)
Still a bit vague...
bartbes wrote:It is possible, but.. why?
I didn't get the impression hellfiresage wanted to replace the LÖVE CLUB with his app or anything. More likely just a project to learn from. To get experience in networking, general programming, etc. But, hellfiresage: it is not going to be easy. If it's too hard, you could try something less epic first. :P