Skip to content

u/stoplight

In this archive from Jan 2010 to Dec 2015

3
posts
60
comments
1
media
143
score

The proprietary driver doesnt support switching on the fly, so you have to configure X to use only the nvidia device. I followed that wiki page and got to the state I was in (x starts but winecfg hangs). So I used nvida-xconfig to generate an x config, but when x started it failed to detect any screens, so I looked at this and after following that everything works.

1 points

Turns out it was my x config. I have an NVIDIA Optimus laptop (intel integrated gpu and discrete nvidia gpu). It's hard to explain but the x config was correct enough to work. However, my best guess is that winecfg was trying to use a screen that didn't really exist to show the gui. Either way I fixed my x config and now everything works.

1 points

env | grep WINE gives me nothing. Completely removed wine and things:

$ sudo pacman -R wine wine-mono wine_gecko winetricks-svn
$ rm -rf ~/.wine
$ sudo pacman -S wine
$ winecfg

And then same issue. winecfg just hangs trying to read from a pipe:

$ $ sudo strace -fp 2256
Process 2256 attached
[ Process PID=2256 runs in 32 bit mode. ]
read(7,

Eventually after a few minutes of letting winecfg sit there I get this on the terminal

err:process:__wine_kernel_init boot event wait timed out
1 points

If I understand you correctly you want touchX and touchY to be in camera (aka tile) coordinates. If that's the case then you do need to unproject:

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Vector3 tileCoords = new Vector3();
    camera.unproject(tileCoords.set(screenX, screenY, 0));
    // tileCoords now holds the tile that was touched,
    // however if you dont need the precision (ie you dont care if the touch was actually between tiles) then
    // you can just cast to int:
    tileCoords.set((int)tileCoords.x, (int)tileCoords.y, 0);
    
    // rest of your code here
    }
1 points

How do you figure out the value for SCREEN_TO_VIEWPORT_RATIO? Is that pixels / blocks? So in this case that would be 1 px / 10 blocks because the sprite is 1 x 1px and we are showing 10 x 10 blocks?

Maybe it would be easier to explain what I'm trying to accomplish. I want to create a "world" of tiles 20 tiles wide and 15 tiles high (one tile is 64px X 64px). I want to show as much of the world as possible that the screen will allow (ie. larger screens show more of the world, smaller screens show less) while maintaining that my tiles stay square (otherwise they dont look good at all). This is where I'm stuck, I don't know how to create the camera to accomplish this. Right now the tiles look all stretched and horrible like this

2 points

Libgdx is very complicated and daunting. It also is a little more difficult to use it for 2d games; you have to worry about a camera, a viewport, make sure the aspect ratio is correct, working with different coordinate systems (virtual vs physical) etc. It felt like XNA did most of that behind the scenes for you. Perhaps it's just me though. However, while the documentation is pretty good, it's not so easy for beginners (or at least for me) who haven't dealt with game programming before.

Right now I'm struggling with doing something simple that I've been able to do in other frameworks easily (love2d and even XNA). I feel like I need a lot of handholding with libgdx, but for xna (and even love2d) I was able to easily grasp it and create something. This is actually part of the reason I've stopped working on my game (the other being I've been extremely busy).

Some things I'm struggling with:

  • The whole coordinate system. I just don't get this, I'm supposed to use some arbitrary screen independent measurement. For example, I want to create a "world" that's 10 tiles wide x 20 tiles high. OK I setup my camera and now the sprites are stretched. Now I have to worry about calculating the correct aspect ratio across screen resizes.
  • Using the TileMapRenderer (et al) to render a simple map (not based on tmx, but just a simple tilemap [ie 2d int array]) and allow a character to move around on it while also moving the camera as he approaches the edge of the screen. I've got the map and character rendering fine, but it's difficult to translate between 3 different coordinate systems (tiles, screen, and world). Hell just doing a simple camera.translate(3, 0, 0) to move it over doesnt seem to do anything (and in what coordinate system do I give the value in)?

I'm not sure why I can't grasp what libgdx has to offer, but I've been able to achieve all of this with other frameworks easily without having to worry about different coordinate systems, aspect ratios, etc. It just seems unnecessarily complicated to me.

3 points

What if you have two video cards (Intel and Nvidia)?

$ sudo pacman -S lib32-nvidia-libgl
resolving dependencies...
looking for inter-conflicts...
:: lib32-nvidia-libgl and lib32-mesa-libgl are in conflict (lib32-libgl). Remove lib32-mesa-libgl? [y/N] Y
error: failed to prepare transaction (could not satisfy dependencies)
:: lib32-intel-dri: requires lib32-mesa-libgl=9.1.1
1 points

Have a look at the dbus wiki page. Specifically the part about

gnome-session, startkde and startxfce4 will start a D-Bus session automatically if it isn't already running.

If you aren't using gnome, kde, or xfce then you can source scripts in /etc/X11/xinit/xinitrc.d in your ~/.xinitrc:

#!/bin/sh

# Source scripts in /etc/X11/xinit/xinitrc.d/
if [ -d /etc/X11/xinit/xinitrc.d ]; then
    for f in /etc/X11/xinit/xinitrc.d/*; do
        [ -x "$f" ] && . "$f"
    done
    unset f
fi

exec $your_window_manager
2 points

I didn't :P I got most of it from other sources since I can't draw too well myself.

  • The "wall" tile I drew myself using gimp and Paint.net.
  • The ground tile is a texture from Georges Grondin
  • The buttons on the menu screen I used the RPG GUI Construction Kit by Lamoot from open game art to make.
  • Same thing with the Character select screen title (the one that says "Choose Your Hero").
  • The borders (around the game screen and the "hud" on the right) also come from the RPG GUI Construction Kit.
  • The HP bars I made myself in gimp.
  • The Choose Your Hero Icons I got from reddit user Lorc. I just colored and resized them.
  • The character sprite you see I got from Philipp Lenssen
  • The goblin and spider monster you see I got from Redshrike on open game art.
  • The bat monster you see I got from Daniel Harris

Hope that helps!

2 points

I tried this the other day porting my XNA to MonoGame on Linux and it went alright. I started blogging about it but didn't finish because I came across a few issues. I was using the automatic content serialization to read in xml files for some of my content and MonoGame didn't like it.

The one thing that bothers me though is that assets have to be compiled to xnb files on Windows before using them with MonoGame. I couldn't ditch Windows altogether :(

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.