Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug on trying to apply AZERTY input settings #5227

Open
firasmestiri opened this issue Mar 22, 2024 · 3 comments
Open

Bug on trying to apply AZERTY input settings #5227

firasmestiri opened this issue Mar 22, 2024 · 3 comments
Labels
Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Status: Needs Testing Requires to be tested in-game for reproducibility Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems

Comments

@firasmestiri
Copy link

General Info

Terasology Launcher Version: 4.8.0
Terasology Version: 5.3.0
Operating System: Windows 10
Onboard / Dedicated Graphics: Nvidia GTX 1650ti
Java Version: Version 8 361

What you were trying to do

I was trying to see the input settings to know how the controls work then I found the special keyboard section above, so i applied the AZERTY option since I have an AZERTY keyboard

What actually happened

After applying it, the controls changed as if it was QWERTY

How to reproduce

  1. Select Terasology version '5.3.0'
  2. Start Terasology
  3. Select gameplay 'Singleplayer'
  4. Create or load a game
  5. Start game
  6. Open the in game menu and go to the settings
  7. Choose Input settings
  8. Go over to the top section 'Special Keyboards' and apply AZERTY

Log details

No crash

Screenshots

image_2024-03-22_144317029

after applying the AZERTY option, the controls look like they're set to azerty correctly but when trying to move, the keybinds are different.

@firasmestiri firasmestiri added Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems labels Mar 22, 2024
@jdrueckert jdrueckert added the Status: Needs Testing Requires to be tested in-game for reproducibility label Apr 14, 2024
@firasmestiri
Copy link
Author

firasmestiri commented May 11, 2024

for further investigation, and to be able to trace the problem, i think it may be beneficial to add an overlay text that shows the currently pressed key(s) to see if the problem is related to the key ids

i already tried to implement something like this but it doesn't seem to work

public class DebugOverlay extends CoreScreenLayer {
public static final float MB_SIZE = 1048576.0f;
@In
private Config config;
@In
private SystemConfig systemConfig;
@In
private CameraTargetSystem cameraTarget;
@In
private Time time;
@In
private EntityManager entityManager;
@In
private LocalPlayer localPlayer;
@In
private WorldProvider worldProvider;
@In
private DebugMetricsSystem debugMetricsSystem;
@In
private StorageManager storageManager;
private UILabel metricsLabel;
@Override
public void initialise() {
bindVisible(new ReadOnlyBinding<Boolean>() {
@Override
public Boolean get() {
return systemConfig.debugEnabled.get();
}
});
UILabel debugLine1 = find("debugLine1", UILabel.class);
// This limit doesn't change after start-up.
final long dataLimit = OperatingSystemMemory.isAvailable()
? OperatingSystemMemory.dataAndStackSizeLimit() : -1;
if (debugLine1 != null) {
debugLine1.bindText(new ReadOnlyBinding<>() {
@Override
public String get() {
Runtime runtime = Runtime.getRuntime();
long totalHeapSize = runtime.totalMemory();
float usedHeapMemory = ((float) totalHeapSize - (float) runtime.freeMemory()) / MB_SIZE;
String s = String.format(
"FPS: %.1f, Heap Usage: %.1f MB, Total Heap: %.1f MB, Max Heap: %.1f MB",
time.getFps(),
usedHeapMemory,
totalHeapSize / MB_SIZE,
runtime.maxMemory() / MB_SIZE
);
if (OperatingSystemMemory.isAvailable()) {
// Check data size, because that's the one comparable to Terasology#setMemoryLimit
long dataSize = OperatingSystemMemory.dataAndStackSize();
// How much bigger is that than the number reported by the Java runtime?
long nonJavaHeapDataSize = dataSize - totalHeapSize;
String limitString = (dataLimit > 0)
? String.format(" / %.1f MB (%02d%%)", dataLimit / MB_SIZE, 100 * dataSize / dataLimit)
: "";
return String.format(
"%s, Data: %.1f MB%s, Extra: %.1f MB",
s, dataSize / MB_SIZE, limitString, nonJavaHeapDataSize / MB_SIZE
);
} else {
return s;
}
}
});
}
UILabel debugLine2 = find("debugLine2", UILabel.class);
if (debugLine2 != null) {
debugLine2.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
return String.format("Active Entities: %s, Current Target: %s", entityManager.getActiveEntityCount(), cameraTarget.toString());
}
});
}
UILabel debugLine3 = find("debugLine3", UILabel.class);
if (debugLine3 != null) {
debugLine3.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
if (!localPlayer.isValid()) {
return "";
}
Vector3f pos = localPlayer.getPosition(new Vector3f());
Vector3i chunkPos = Chunks.toChunkPos(pos, new Vector3i());
Vector3f rotation = localPlayer.getViewDirection(new Vector3f());
Vector3f cameraPos = localPlayer.getViewPosition(new Vector3f());
String orientation = "";
switch (Orientation.fromDirection(rotation.x, rotation.z)) {
case NORTH:
orientation = "N";
break;
case EAST:
orientation = "E";
break;
case SOUTH:
orientation = "S";
break;
case WEST:
orientation = "W";
break;
case NORTHEAST:
orientation = "NE";
break;
case SOUTHEAST:
orientation = "SE";
break;
case SOUTHWEST:
orientation = "SW";
break;
case NORTHWEST:
orientation = "NW";
break;
}
return String.format(Locale.US, "Position: (%.2f, %.2f, %.2f), Chunk (%d, %d, %d), " +
"Eye (%.2f, %.2f, %.2f), Rot (%.2f, %.2f, %.2f) %s", pos.x, pos.y, pos.z,
chunkPos.x, chunkPos.y, chunkPos.z,
cameraPos.x, cameraPos.y, cameraPos.z,
rotation.x, rotation.y, rotation.z, orientation);
}
});
}
UILabel debugLine4 = find("debugLine4", UILabel.class);
if (debugLine4 != null) {
debugLine4.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
return String.format("World Time: %.3f, Time Dilation: %.1f",
worldProvider.getTime().getDays() - 0.0005f, // use floor instead of rounding up
time.getGameTimeDilation());
}
});
}
UILabel debugInfo = find("debugInfo", UILabel.class);
if (debugInfo != null) {
debugInfo.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
return "[H] : Debug Documentation";
}
});
}
UILabel saveStatusLabel = find("saveStatusLabel", UILabel.class);
// clients do not have a storage manager
if (saveStatusLabel != null && storageManager != null) {
saveStatusLabel.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
return "Saving... ";
}
});
saveStatusLabel.bindVisible(
new ReadOnlyBinding<Boolean>() {
@Override
public Boolean get() {
return storageManager.isSaving();
}
}
);
}
UILabel wireframeMode = find("wireframeMode", UILabel.class);
if (wireframeMode != null) {
wireframeMode.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
return "WIREFRAME MODE";
}
});
wireframeMode.bindVisible(
new ReadOnlyBinding<Boolean>() {
@Override
public Boolean get() {
return config.getRendering().getDebug().isWireframe();
}
}
);
}
UILabel chunkRenderMode = find("chunkBBRenderMode", UILabel.class);
if (chunkRenderMode != null) {
chunkRenderMode.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
return "CHUNK BOUNDING BOX RENDER MODE";
}
});
chunkRenderMode.bindVisible(
new ReadOnlyBinding<Boolean>() {
@Override
public Boolean get() {
return config.getRendering().getDebug().isRenderChunkBoundingBoxes();
}
}
);
}
metricsLabel = find("metrics", UILabel.class);
}
@Override
public void update(float delta) {
metricsLabel.setText(debugMetricsSystem.getCurrentMode().getMetrics());
}
@Override
public boolean isModal() {
return false;
}
@Override
protected boolean isEscapeToCloseAllowed() {
return false;
}
/**
* Moves forward through the MetricsMode instances and displays the content of the next available one.
*/
public void toggleMetricsMode() {
MetricsMode mode = debugMetricsSystem.toggle();
PerformanceMonitor.setEnabled(mode.isPerformanceManagerMode());
}
}

it can be done along the existing debug text

@firasmestiri
Copy link
Author

i also forgot to mention, i analyzed the classes and code related to input management

the main class responsible for this issue is most likely in this class Bind commands

public class BindCommands extends BaseComponentSystem {
public static final ImmutableMap<Integer, SimpleUri> AZERTY = new ImmutableMap.Builder<Integer, SimpleUri>()
.put(KeyId.Z, new SimpleUri("engine:forwards"))
.put(KeyId.S, new SimpleUri("engine:backwards"))
.put(KeyId.Q, new SimpleUri("engine:left"))
.build();

the issue might be in the AZERTY() method specifically, and the keyid could be mistranslated or not correctly mapped

@Cervator
Copy link
Member

Hi @firasmestiri and thank you for both the report and suggestions :-)

It can sometimes be a little easier to troubleshoot over on our Discord, but this may also work if patient.

AZERTY probably hasn't been touched for years at this point, and bugs do sneak in. I'm not sure which if any current maintainers even have an AZERTY keyboard to help test and validate things.

Are you able to run the game from source and maybe run it in debug mode to step through the code to see if it is simply skipping that method or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Status: Needs Testing Requires to be tested in-game for reproducibility Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems
Projects
Status: No status
Status: No status
Development

No branches or pull requests

3 participants