So, like many I am going through a tutorial on roguelikes using libtcod in python. http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod,_part_3
I finally got everything running but I am getting an error on a particular command and I have no idea how to fix it or what is wrong with it exactly. It appears to be working in the tutorial with same command and my code is literally identical as far as I can tell and I am using download links provided by author. I have libtcodpy, dundalk12x12_gs_tc.png, libtcod.dll, and SDL2.dll all in my project folder (copy and pasted in). If you need to see rest of .py then just look at code from tutorial part 3 dungeon generation. It is identical to mine, the only thing I can't see is his libtcodpy folder, but it is his download link. The error is:
C:\Python27\python.exe C:/Users/Chris/PycharmProjects/untitled/KingKong.py
Traceback (most recent call last):
File "C:/Users/Chris/PycharmProjects/untitled/KingKong.py", line 233, in <module>
render_all()
File "C:/Users/Chris/PycharmProjects/untitled/KingKong.py", line 172, in render_all
libtcod.console_set_char_background(con, x, y, color_dark_wall, libtcod.BKGND_SET )
File "C:\Users\Chris\PycharmProjects\untitled\libtcodpy\__init__.py", line 822, in console_set_char_background
_lib.TCOD_console_set_char_background(con, x, y, col, flag)
WindowsError: exception: access violation reading 0x0000000000640000
24 bits font.
key color : 0 0 0
24bits greyscale font. converting to 32bits
Process finished with exit code 1
The issue is in the renderall function when it is calling the libtcod.console_set_char_background(con, x, y, color_dark_wall, libtcod.BKGND_SET)
def render_all():
global color_dark_wall, color_light_wall
global color_dark_ground, color_light_ground
# Go through all tiles, and set their background color
for y in range(MAP_HEIGHT):
for x in range(MAP_WIDTH):
wall = map[x][y].block_sight
if wall:
libtcod.console_set_char_background(con, x, y, color_dark_wall, libtcod.BKGND_SET )
else:
libtcod.console_set_char_background(con, x, y, color_dark_ground, libtcod.BKGND_SET )
# Draw all objects in the list
for Object in objects:
Object.draw()
# Blit the contents of "con" to the root console
libtcod.console_blit(con, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0)
this is the library function
def console_set_char_background(con, x, y, col, flag=BKGND_SET):
_lib.TCOD_console_set_char_background(con, x, y, col, flag)
libtcodpy is in my project folder, along with libtcod.dll and SDL2.dll. All are 64 bit, including python and my PyCharm IDE on 64 bit windows 10. Tried 32 bit earlier, won't find SDL2.dll. Already fixed that stuff though on my own. Now I just can't figure out what is erroring and how to rewrite it within the tutorial XX. Sorry first time ever posting on here and did not see exact solution in another thread, had some others regarding SDL issue and 32 vs. 64 bit though.
Please either find me a thoroughly detailed, retard-proof youtube video on how to properly setup libtcodpy in python, or just let me know what I'm messing up.