Help making an online chat box

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
hellfiresage
Prole
Posts: 49
Joined: Tue Feb 10, 2009 6:07 pm

Help making an online chat box

Post by hellfiresage » Fri Jul 17, 2009 4:03 pm

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!

User avatar
Tenoch
Citizen
Posts: 76
Joined: Mon Jul 21, 2008 7:49 am

Re: Help making an online chat box

Post by Tenoch » Fri Jul 17, 2009 4:16 pm

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:
"When in doubt, use brute force." Ken Thompson

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Help making an online chat box

Post by bartbes » Fri Jul 17, 2009 4:42 pm

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.

hellfiresage
Prole
Posts: 49
Joined: Tue Feb 10, 2009 6:07 pm

Re: Help making an online chat box

Post by hellfiresage » Fri Jul 17, 2009 4:47 pm

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?

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Help making an online chat box

Post by Robin » Fri Jul 17, 2009 4:58 pm

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
Help us help you: attach a .love.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests