Rotate Object in world space – Raytracing

I’m programming a C raytracing project.

I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it.

For each object, I have its position (x, y, z) in the world space and its 3d normalized orientation vector.

For the moment, I do nothing more than applying once of the three following functions on the 3d normalized orientation vector. I don’t know if I’m doing it right. Rotation doesn’t work well.

For example, I want to rotate my object left with the j key and right with the l key (x_rotation), up with the i key and down with the k key (y_rotation). I’m not sure how to use the z axis.

I’m starting to despair, can you please help me?

I will be very grateful for your help 🙂

t_vec       x_rotation(t_vec vec, float alpha) {     t_vec   res;      res.x = vec.x;     res.y = vec.y * cos(alpha) - vec.z * sin(alpha);     res.z = vec.y * sin(alpha) + vec.z * cos(alpha);     return (res); }  t_vec       y_rotation(t_vec vec, float alpha) {     t_vec   res;      res.x = vec.z * sin(alpha) + vec.x * cos(alpha);     res.y = vec.y;     res.z = vec.z * cos(alpha) - vec.x * sin(alpha);     return (res); }  t_vec       z_rotation(t_vec vec, float alpha) {     t_vec   res;      res.x = vec.x * cos(alpha) - vec.y * sin(alpha);     res.y = vec.x * sin(alpha) + vec.y + cos(alpha);     res.z = vec.z;     return (res); } 

Dungeon World Monster Attacks

  • Forgive me if this seems a total newbie question…I’m not that, and have played ‘solo’ DW with my partner for at least two years…we both have a number of level 3 characters who we run through non-GM’d scenarios we generate from various GM emulators and in the spirit of DW explore the world and find out what is happening. So intro over….few days ago we had visitors and took them through some scenarios and they immediately raised a point we had never considered……how do ‘monsters’ attack if the PC’s don’t engage in combat first.
  • Do they simply deal damage?
  • Do the PC’s defend? OR,
  • Do they use their attack moves (via the GM or in our case via our adherence to the fiction) and make a hack and slash move, or again do they simply deal damage? I appreciate this is maybe a simplistic question, but, we have never really thought about it before. Surely there is some mechanism outside the fiction that governs their method of determining whether an attack move on their part is successful?

About the complexity of deciding if the closed world assumption for renamable Horn CNF is consistent


Let $ T$ be a theory that only contains renamable horn formulas. What is the complexity of deciding if the closed world assumption $ CWA(T)$ is consistent?

The closed world assumption is defined as follows:

$ CWA(T):=T\cup \{\neg p : p\text{ is atom } T \not\models p\}$

Renamable horn formulas are CNF formulas that can be renamed to horn formulas by negating a variable in the formula for example

$ (x_1\vee x_2 \vee x_3)\wedge (\neg x_3 \vee\neg x_4)$

is not a horn formula but can be renamed by the renaming $ R=\{x_2,x_3\}$ to get the equally satisfiable formula

$ (x_1\vee \neg x_2 \vee \neg x_3)\wedge (x_3 \vee\neg x_4)$

My findings so far:

We call a theory $ \Phi$ of first order logic inconsistent if $ \exists \phi \in \Phi$ such that $ \Phi\models \phi$ and $ \Phi\not\models \phi$ . Otherwise $ \Phi$ is consistent.

To check whether $ CWA(T)$ is consistent it is sufficient to check if $ \Phi=\bigwedge_{\phi\in CWA(T)}\phi$ is satisfiable.

Algorithm to construct CWA:

To compute $ CWA(T)$ we need to know if $ T\models x_i$ for all variables in $ T$ . This can be done by considering $ \Psi=\bigwedge_{\psi\in T}\psi$ and then checking if $ \Psi \rightarrow x_i$ or equivalently $ \neg x_i \rightarrow \neg\Psi$ . Therefore if we set $ x_i=0$ in $ \Psi$ and $ \Psi$ is not satisfiable it follows $ T\models x_i$ , otherwise $ T\not\models x_i$ .

First create an set $ I=\{\emptyset\}$

For all variables defined by the index $ i=0,…,n$ we do the following calculation:

1.] set $ x_i=0$ in $ \Psi=\bigwedge_{\psi\in T}\psi$

2.] if $ \Psi$ is not satisfiable $ I=I\cup\{x_i\}$

By considering the elements of $ I$ we can conclude $ CWA(T)=T\cup\{\neg x_i:x_i\not\in I\}$ .

Deciding if CWA(T) is consistent is at least NP-hard:

let $ C_1,…,C_m$ be clauses of an arbitrary 3-SAT instance and $ C_{m+1}=(u\vee v)$ such that $ u,v$ are fresh atoms. Then $ T=\{C_1,…,C_m,C_{m+1}\}$ contains only renamable Horn clauses.

To decide if $ CWA(T)$ is consistent we need to decide if $ u$ is free for negation. This follows by checking if $ T\models u$ . Therefore we assume $ u=0$ and check if $ C_1\wedge C_2 \wedge … \wedge v$ is not satisfiable. Since v occurs in no other clause, the formula is not satisfiable if $ C_1\wedge … \wedge C_m$ is not satisfiable, but $ C_1\wedge … \wedge C_m$ is an arbitrary 3-SAT instance and so checking if $ CWA(T)$ is consistent is at least NP-hard.

What’s the best way to present a sandbox world to your players?

In my sessions, I let my players play in a sand-box world. There is a main story that I always plan that they could follow, and I have no problems with them doing so.
However, I would like my players to fully realise this is a big, breathing world that they can fully explore however they like.

I have already shown them the map of the whole globe, given some standard lore about important places and told them that they can go wherever they like.
I’m hoping to be able to let go of the main story and let them wander around the world, but I’m afraid they’ll remain passive until I throw some encounters towards them, instead of them looking for adventure.

The party is currently level 6, and I would prefer it most if they would gradually expand their influence over the world.

What would be a good way to achieve this? How can I best present a sand-box world to my party, who’ve never done something similar before?

We’re playing D&D 3.5 if that changes anyone’s answer.

How to ask nicely in Dungeon World

(and some of the other Powered by the Apocalypse games)

There’s a basic move called Parley in DW:

When you have leverage on a GM Character and manipulate them, roll+Cha. Leverage is something they need or want. ✴On a 10+, they do what you ask if you first promise what they ask of you. ✴On a 7–9, they will do what you ask, but need some concrete assurance of your promise, right now.

It further elaborates:

Parley covers a lot of ground including old standbys like intimidation and diplomacy. You know you’re using parley when you’re trying to get someone to do something for you by holding a promise or threat over them. Your leverage can be nasty or nice, the tone doesn’t matter.

Merely asking someone politely isn’t parleying. That’s just talking. You say, “Can I have that magic sword?” and Sir Telric says, “Hell no, this is my blade, my father forged it and my mother enchanted it” and that’s that. To parley, you have to have leverage. Leverage is anything that could lure the target of your parley to do something for you. Maybe it’s something they want or something they don’t want you to do. Like a sack of gold. Or punching them in the face.

The prerequisites of the move are well defined. But what if my character is merely asking politely? The game seems to suggest that such interactions are entirely up to the GM, and sometimes it makes sense, like in the example provided. But often enough the GM doesn’t have a strong opinion on what should happen. That’s where dice come out in most other games, and skills like Diplomacy or Bluff.

Time and again this has tripped us up as we try to engage in some social interaction, reach a point where things could go either way, and then hum and haw over the move list. There is no leverage, there’s just a glib tongue. And even if we do manage to frame something as leverage, such as "I’ll chat with you for a few minutes if you let me through," it comes out forced and feels wrong.

It’s worth noting that the original move in AW is worded as "When you try to seduce or manipulate someone, tell them what you want and roll+hot." But the rest of the move still talks about making promises.

Are we handling social encounters wrong? PbtA games play differently, so it’s possible we’re dragging the baggage of Diplomacy and Bluff into it. If so, how should we handle leverage-less interactions?

Feasible engine for a world like Earthsea? [closed]

I am building a world emphasising on balance and chaos (where pretty much two sides of one coin), kind of like Earthsea.

As a consequence, the magic in D&D doesn’t work quite well with it. (powerful magic exists in my world, but unwise usage of powerful magic usually comes with deadly consequence.)

Also I want the bad consequence lasts longer, kind of like sanity in COC.

What is a feasible system for my world? Or any feasible way to modify any system to make it work? Or do I have to create one myself (I hope not)?

Murder in Dungeon World

I have a female fighter (level 3) just starting a personal quest to find her ‘missing’ twin sister.

For the whole game to evolve it has to start with her openly committing murder in a crowded Tavern.

She will do this by guile and subterfuge, playing on her beauty and apparent innocence, to obscure her real motive when approaching the un-armoured male victim – who is with a number of his associates – she declares that she wants to use her good looks and Charisma to fool the victim into thinking he has made a ‘score’. She will get close up and almost personal inviting an embrace from him at which time she guts him from crotch to sternum (with all the gory steaming details) with a concealed blade.

So how do I run this? She is not into a ‘hack and slash’ move, so should I use ‘deal damage’ with a + modifier, or simply take the murder as done and simply describe the ensuing scene and ask, ‘what happens next/what do you do next’?

I’m asking as a player and as a GM. I play solo most of the time, but sometimes also with a small group as either a player or a GM.