Search found 50 matches

by pauls313
Sun Mar 25, 2018 5:34 am
Forum: Support and Development
Topic: Networking: How do I distinguish clients?
Replies: 5
Views: 2807

Re: Networking: How do I distinguish clients?

Do you set peer name? If so, the implementation will ignore datagrams from everyone but specified peer. Anyway the IP and port are the only pieces of identifying data you will get. Needless to say, that's not strong enough information to bind users by, so you must implement your own identification ...
by pauls313
Sun Mar 25, 2018 3:41 am
Forum: Support and Development
Topic: Networking: How do I distinguish clients?
Replies: 5
Views: 2807

Networking: How do I distinguish clients?

The Tutorial:Networking_with_UDP isn't very helpful on this subject. I already know how to pack, send, receive and unpack, but how do I find out who send what? I know I can get the data, IP and port through data, msg_or_ip, port_or_nil = udp:receivefrom() But it seems I'm only getting info from one ...
by pauls313
Sat Mar 24, 2018 11:56 pm
Forum: Support and Development
Topic: Table to String and back
Replies: 3
Views: 2276

Re: Table to String and back

zorg wrote: Sat Mar 24, 2018 11:03 pm as long as you only store variables that can be stringified, then there are a few libraries for that on github; binser, bitser just to name two; they also give back compact representations so they should be perfect for networking.
Well, Bitser did it! Thank you.
by pauls313
Sat Mar 24, 2018 10:20 pm
Forum: Support and Development
Topic: Table to String and back
Replies: 3
Views: 2276

Table to String and back

This is my first time messing with networking after years using Love2D, and the tutorial says I can only send and receive Strings through UDP. It's a tile based game, so all I want to send to the clients is a table with the 32 tiles around the player. What is the easiest and fastest way to convert a...
by pauls313
Tue Dec 19, 2017 4:27 pm
Forum: Support and Development
Topic: I'm desperate: After days there is still a bug
Replies: 4
Views: 2370

drunken_munki

My friend, you have NO idea how THANKFUL I am for that! I had almost given up! Even though I had considered that the timer could end up a little bit problematic due to the instantiating, since it had worked fine at first I forgot about it. I would have never linked it to the activefunctions problem!...
by pauls313
Tue Dec 19, 2017 4:42 am
Forum: Support and Development
Topic: I'm desperate: After days there is still a bug
Replies: 4
Views: 2370

I'm desperate: After days there is still a bug

I will try to explain the logic behind what is buggy in my code, how it should work, and how it works. LOGIC: In my game, when the player clicks an object, if it has an "active function", it creates an instance inside the table "activefunctions". Basically, that "active func...
by pauls313
Sat Dec 09, 2017 10:08 pm
Forum: Support and Development
Topic: [SOLVED] Attributing global function to table
Replies: 3
Views: 2294

Re: Attributing global function to table

grump wrote: Sat Dec 09, 2017 1:58 am Your example would work as intended if you assigned the actual function instead of the result of the function call to item[1].func

Code: Select all

item[1].func = gun -- no parentheses
Your also might want to look into a design pattern called Entity-Component-System.
That's perfect! Thanks.
by pauls313
Fri Dec 08, 2017 11:01 pm
Forum: Support and Development
Topic: [SOLVED] Attributing global function to table
Replies: 3
Views: 2294

[SOLVED] Attributing global function to table

I want my game to be very flexible, so no item will have fixed values. For example, a gun can work as if it were a sword. I wanted to do this by making a list of functions with each behavior function crowbar() ... end function gun() ... end And then, I'd instantiate the items like this item[1].func ...
by pauls313
Mon Feb 13, 2017 11:58 pm
Forum: Support and Development
Topic: Get pixel alpha of a quad
Replies: 0
Views: 1240

Get pixel alpha of a quad

In my tile-based game, if the player clicks an item I want to know if the coords where he clicked are part of the item sprite or not, thus I check the alpha. While iterating through the items, it uses this function to render each: love.graphics.draw(obj.image,obj.quad,x * drawsize,y * drawsize,0,dra...
by pauls313
Tue Jan 24, 2017 3:38 am
Forum: Support and Development
Topic: How to check if mouse is over image, exclude alpha
Replies: 3
Views: 2498

How to check if mouse is over image, exclude alpha

When the mouse clicks a tile, I iterate through all the items in the tile. I want to check if the mouse position is over the item image, excluding its alpha. If its not over the image, it continues iterating. If it is, the item is stored. How could I do that? Check if (x,y) coordinates are in the im...