Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Quote:
Originally Posted by
Boraida
What version of Python are you using atm?
Python 3.5
Quote:
Originally Posted by
Francis Joseph
Python... although I do not know the language well, this sounds very interesting so I'll be following!
Good luck. :):
--- EDIT ---
It looks incredibly clean.
Thanks, I appreciate the kind words :):
- - - Updated - - -
Interesting stuff happens when you write model handling in Python for the first time :):
http://image.prntscr.com/image/2ba35...82e5377e75.png
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
1. I love you
2. I love your project.
keep it up!
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
I figured out the problem, the code below would cause the weird error, basically when adding "door_z" to a string, it should have been an integer, but instead PyMySQL was fetching it as a float (as defined in the database) and would add a .0 to the end of the number and would screw up the client.
Code:
string_builder += str(self.door_z)
The below fixed it:
Code:
string_builder += str(int(self.door_z))
Quote:
Originally Posted by
Kylon
1. I love you
2. I love your project.
keep it up!
Thanks for the kind words :D:
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Quote:
Originally Posted by
Quackster
I figured out the problem, the code below would cause the weird error, basically when adding "door_z" to a string, it should have been an integer, but instead PyMySQL was fetching it as a float (as defined in the database) and would add a
.0 to the end of the number and would screw up the client.
Code:
string_builder += str(self.door_z)
The below fixed it:
Code:
string_builder += str(int(self.door_z))
Thanks for the kind words :D:
Curious not critiquing but why did you use PyMySQL? Why not something like SQLAlchemy or another ORM? Then people could use other databases as well.
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Quote:
Originally Posted by
Moogly
Curious not critiquing but why did you use PyMySQL? Why not something like SQLAlchemy or another ORM? Then people could use other databases as well.
I chose PyMySQL because MySQL is what the majority of what people use here, it's the easiest to implement and works on all operating systems.
All data is processed through data access objects, so it's easy to rip out one database system and replace it with another.
I have no plans to use any other system right now.
http://git.alex-dev.org/Alex/Icarus/...access_objects
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Quote:
Originally Posted by
Quackster
I chose PyMySQL because MySQL is what the majority of what people use here, it's the easiest to implement and works on all operating systems.
All data is processed through data access objects, so it's easy to rip out one database system and replace it with another.
I have no plans to use any other system right now.
http://git.alex-dev.org/Alex/Icarus/...access_objects
No objections, but one more question: have you tested your DAO approach with more than just one library?
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Quote:
Originally Posted by
Moogly
No objections, but one more question: have you tested your DAO approach with more than just one library?
No. I'll probably do it later to demonstrate proof of concept that there can be more than one type of database system used :):
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
You should have a look at using SQLAlchemy and asyncio rather than MySQLDB and the older asnyccore module.
It's refreshing to see someone tackle the problem of writing an emulator in a language like Python, good luck!
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
So I'm thinking from now on, I'll do changelogs with [NEW] [CHANGED] [FIX] and [REMOVED] tags, I think this would be the most readable when sharing updates.
Changelog as of 6-7-2016
[NEW] Show rooms with people inside at Navigator
[NEW] Load heightmap models on start up
[NEW] Room entry implementation
[NEW] Joining and leaving rooms affects user count
[NEW] Leave room upon disconnection
[NEW] Remove room avatar when user leaves room
[NEW] Asynchronous room tasks, like walking
[NEW] Ported Comet Java's pathfinder to Python
[NEW] Pathfinder successfully implemented, users can now walk around the room
[NEW] Display multiple users inside room
[NEW] Collision map generation
[FIX] Show "Edit room" button for room owner
[FIX] Issue where kick/ban buttons wouldn't appear if a user had room ownership/rights and tried to kick someone
[FIX] Issue where pathfinder would return one value only
[FIX] After a user walks, their status would still repetitively send
[FIX] Issue where door ways would be glitched with missing tiles (datatype error, all too common in Python).
[FIX] User could enter the room they were already in, and freeze themselves up
http://image.prntscr.com/image/86a1b...548d07e355.png
If anyone's interested, here's the pathfinder ported to Python, I'm suprised works in a different language, as it was my first pathfinder port :):
Code:
"""
Pathfinder
Ported from Java by Alex (Quackster/TheAmazingAussie)
"""
from managers.pathfinder.point import Point
from managers.pathfinder.pathfinder_node import PathfinderNode
"""
All 8 compass points around a tile
"""
MOVE_POINTS = [
Point(0, -1, 0),
Point(0, 1, 0),
Point(1, 0, 0),
Point(-1, 0, 0),
Point(1, -1, 0),
Point(-1, 1, 0),
Point(1, 1, 0),
Point(-1, -1, 0)
]
def make_path(position, end, size_x, size_y, room):
"""
Create programming path
:param position:
:param end:
:param room:
:return:
"""
squares = []
nodes = make_path_reversed(position, end, size_x, size_y, room)
if nodes is not None:
while nodes.next_node is not None:
squares.append(Point(nodes.position.x, nodes.position.y, 0))
nodes = nodes.next_node
return squares[::-1] # Reverse list
def make_path_reversed(position, end, size_x, size_y, room):
open_list = []
map = [[None for y in range(0, size_y)] for x in range(0, size_x)]
node = None
tmp = None
cost = 0
diff = 0
current = PathfinderNode(position)
current.cost = 0
finish = PathfinderNode(end)
map[position.x][position.y] = current
open_list.append(current)
while len(open_list) > 0:
current = poll_first(open_list)
current.in_close = True
for temp_point in MOVE_POINTS:
tmp = current.position.add_point(temp_point)
is_final_move = (tmp.x == end.x) and (tmp.y == end.y)
if room.room_mapping.is_valid_step(Point(current.position.x, current.position.y, current.position.z), tmp, is_final_move):
if map[tmp.x][tmp.y] is None:
node = PathfinderNode(tmp)
map[tmp.x][tmp.y] = node
else:
node = map[tmp.x][tmp.y]
if node.in_close is not True:
diff = 0
if current.position.x != node.position.x:
diff += 1
if current.position.y != node.position.y:
diff += 1
cost = current.cost + diff + node.position.get_distance_squared(end)
if cost < node.cost:
node.cost = cost
node.next_node = current
if node.in_open is not True:
if node.position.x == finish.position.x and node.position.y == finish.position.y:
node.next_node = current
return node
node.in_open = True
open_list.append(node)
return None
def poll_first(list):
first_item = None
if len(list) > 0:
first_item = list[0]
list.pop(0)
return first_item
- - - Updated - - -
Quote:
Originally Posted by
Caustik
You should have a look at using SQLAlchemy and asyncio rather than MySQLDB and the older asnyccore module.
It's refreshing to see someone tackle the problem of writing an emulator in a language like Python, good luck!
I already said I have no plans to use any other system right now.
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Love the project keep up the good work.
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Good luck, I hope this project won't end up like Sierra.
Cheers! :thumbup1:
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Nice project man, good luck ! :w00t:
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Goodluck on your project Alexis!
Re: Icarus Server (Production) - [Python, Multi-DB/MySQL]
Oh, also, if you're gonna build a CMS, check out Flask. It's probably the most pleasant web framework I've used (very flexible and pluggable)