#version 460
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
layout(set = 0, binding = 0, rgba8) uniform writeonly image2D img;
void main() {
vec2 norm_coordinates = (gl_GlobalInvocationID.xy + vec2(0.5)) / vec2(imageSize(img));
vec2 c = (norm_coordinates - vec2(0.5)) * 2.0 - vec2(1.0, 0.0);
vec2 z = vec2(0.0, 0.0);
float i;
for (i = 0.0; i < 1.0; i += 0.005) {
z = vec2(
z.x * z.x - z.y * z.y + c.x,
z.y * z.x + z.x * z.y + c.y
);
if (length(z) > 4.0) {
break;
}
}
vec4 to_write = vec4(vec3(i), 1.0);
imageStore(img, ivec2(gl_GlobalInvocationID.xy), to_write);
}
Sv_VoteStatusEx
at the bottom that contains all these fields plus the one you want to addSv_YourVote
that contains just your voteNetMessageEx("Sv_VoteStatusEx", "votestatus@netmsg.ddnet.tw", [
NetIntRange("m_Yes", 0, 'MAX_CLIENTS'),
NetIntRange("m_No", 0, 'MAX_CLIENTS'),
NetIntRange("m_Pass", 0, 'MAX_CLIENTS'),
NetIntRange("m_Total", 0, 'MAX_CLIENTS'),
NetIntRange("m_Voted", -1, 1),
]),
Kinda like this?@netmsg.ddnet.org
though#[repr(C)]
struct Game {
data: [u8; 32],
}
mem.grow(&mut store, bytes(std::mem::size_of::<Game>()));
mem.grow(&mut store, bytes(std::mem::size_of::<Game>()));
Sv_YourVote
instead, my question now is. How would I support servers that don't send this packet? Do I create a GameInfoFlag?Sv_YourVote
which can override it. This behavior is compatible with old and new servers.
The server can check the client DDNet version to decide whether it should (accept re-votes and) send Sv_YourVote
. (edited)#[derive(Debug, Clone)]
#[repr(C, packed)]
pub struct Game {
pub data: [u8; 32],
}
let play_game = instance.exports.get_typed_function::<u32, u8>(&store, "play_game")?;
let pages: Pages = Bytes(std::mem::size_of::<Game>()).try_into().unwrap();
let offset_game = mem.grow(&mut store, pages)?.0;
let game = Game {
data: [1; 32],
};
let game_ref = addr_of!(game) as *const u8;
let game_ref = unsafe {
std::slice::from_raw_parts(game_ref, std::mem::size_of::<Game>())
};
mem.view(&store).write(offset_game.into(), game_ref)?;
let result = play_game.call(&mut store, offset_game)?;
#[no_mangle]
pub fn play_game(game: *const u8) -> u8 {
assert!(!game.is_null());
let game: Game = unsafe {
std::ptr::read(game as *const _)
};
game.data[0]
}
#[no_mangle]
pub unsafe fn play_game(game: *const Game) -> u8 {
assert!(!game.is_null());
(*game).data[0]
}
Running `target/debug/host target/wasm32-unknown-unknown/debug/guest.wasm`
[host/src/main.rs:56] &result = 1
game: &Game
cl_show_direction
into cl_show_direction_other
and cl_show_direction_own
allowing players to toggle them independently.
cl_show_direction_own
shows dummy keypresses as well (doesnt work in playback)
9eb4cf7
CCoreCharacter: Add and use HookedPlayer() - Kaffeine
4c55e83
Character (cli and srv): Access WorldCore via GameWorld() - Kaffeine
7dab9e4
CCharacterCore: Break the friendship with CCharacter - Kaffeine
a1b7e0c
Move alloc.h to game/ and use it in client/prediction/entity.h - Kaffeine
a244e2c
prediction/gameworld.h: Drop unneeded friendship with CCharacter - Kaffeine
77fc14f
Server: Move player (ID) mapping update to GameContext - Kaffeine
f58eef4
Server: Use the tuning params via GameWorld (like in prediction) - Kaffeine
3fd4e10
World cleanup - Kaffeine
15bdef3
Merge pull request #7136 from infclass/for-ddnet2 - def-