Which service should I use to implement click tracking without a server and CGI? [closed]

I have a simple blog on blogger.com / blogspot.com, and I would like to implement some basic click tracking: which user or IP clicked on which links. How could I solve that? If I had a webserver and CGI, it could be solved relatively easily. Unfortunately I don’t have one, and can’t afford to maintain even a virtual server.

If I have only a handful links, I could use iplogger.org, but unfortunately I have about 300 links. Is there any similar service or website? Or something like Heroku, where I can run simplistic CGI apps, which only purpose is some basic logging: IP, time, user agent string, and the URL, which was clicked.

Raycasting in GameMaker Studio 2 to implement hitscan weapons?

I’m working on a 2D top-down shooter game in GameMaker Studio 2, featuring different weapons and obstacles all around the levels.

Since I don’t need a high degree of simulation, I’m implementing simple physics for character movement and interaction (e.g. weapons, bullets, doors…) myself via GML rather than using the dedicated physics library.

Currently, shooting works as follows:

  • The player presses the Left Mouse Button.
  • A bullet object spawns, according to the current weapon.
  • The bullet starts moving towards the mouse position at a given velocity.

Right now, the gameplay works quite well. However, I wanted to create different weapons with unique features, including different bullet speeds. And here’s my problem.

I tried to increase bullet velocity values, but they started behaving strangely: When shooting against objects, hits occur slightly before visual contact. Sometimes, bullets ‘warp’ beyond small objects or corners as if a collision hasn’t been detected at all.

There are two schematics, one for the general case:

Desired vs current behaviour 1

And one for the collision with thin objects:

Desired vs current behaviour 2

I think this is due to my code checking for collisions for given positions rather than sweeping along the expected motion trajectory. And, this doesn’t work well with laser weapons and sniper rifles, since players expect them to be precise when shooting.

My initial implementation was the following:

Create Event:

b_damage = 25; b_velocity = 100; b_direction = point_direction(x, y, mouse_x, mouse_y); 

Step Event:

var _xvel = lengthdir_x(b_velocity, b_direction); var _yvel = lengthdir_y(b_velocity, b_direction);  var _coll = instance_place(x + _xvel, y + _yvel, obj_CollisionParent);  if ( _coll == noone ) {     // No collision occurred, bullet can travel     x += _xvel;     y += _yvel; } else {     // Destroy bullet (shows sparks)     instance_destroy();     // Deal damage if an enemy was hit     if ( _coll.object_index == obj_Enemy )     {         scr_DealDamage(_coll, b_damage);     } } 

I then tried to increase precision by subdividing the collision check into smaller steps:

Step Event:

var _xvel = lengthdir_x(b_velocity, b_direction); var _yvel = lengthdir_y(b_velocity, b_direction);  var _coll; var _steps = 10;  for (var i = 0; i < _steps; i++) {     _coll = instance_place(x + _xvel/_steps, y + _yvel/_steps, obj_CollisionParent);      if ( _coll == noone )     {         // No collision occurred, bullet can travel for 1/_steps distance         x += _xvel / _steps;         y += _yvel / _steps;     }     else     {         // Destroy bullet (shows sparks)         instance_destroy();         // Deal damage if an enemy was hit         if ( _coll.object_index == obj_Enemy )         {             scr_DealDamage(_coll, b_damage);         }     } } 

Now, collision is more precise, yet it’s far from perfect. I still cannot use high velocity values without increasing the number of _steps. Also, 100 collision checks per step for dozens of bullets seem too much for my CPU. I would like to improve this aspect of my game.

I would like to use a raycast-like function, similar to Unity’s Physics.Raycast. I need to find the final impact position with a low computational effort so that I can make bullets travel instantly, draw impact particles at the right position, and show realistic bullet trails.

How to implement texture slicing

I’m making a simple game in C# and i’m trying to slice my UI images into 9 smaller rectangles, so the image doesn’t get stretched when drawing to different resolutions, but i’m having lots of problems with my code.

Currently, i have the following method for slicing an image:

public Rectangle[] SliceImage (Rectangle rectangle) {     float x = rectangle.X;     float y = rectangle.Y;          float width = rectangle.Width;     float height = rectangle.Height;          float size= 32;          return new Rectangle[]     {         new Rectangle(x, y, size, size), // top left         new Rectangle(x + size, y, (width - (size * 2)), size), // top middle         new Rectangle(x + (width - size), y, size, size), // top right                  new Rectangle(x, y + size, size, height - (size * 2)), // middle left         new Rectangle(x + size, y + size, width - (size * 2), height - (size * 2)), // middle         new Rectangle(x + (width - size), y + size, size, height - (size * 2)), // middle right                  new Rectangle(x, y + (height - size), size, size), // bottom left         new Rectangle(x + size, y + (height - size), width - (size * 2), size), // bottom middle         new Rectangle(x + (width - size), y + (height - size), size, size) // bottom right     }; } 

And then i draw the sliced image like this:

public void Draw (Graphics graphics) {     var destinaton_slices = this.SliceImage(this.Bounds);     var source_slices = this.SliceImage(new Rectangle(0, 0, this.Texture.Width, this.Texture.Height));          for (int i = 0; i < source_patch.Length; i++)     {         graphics.DrawImage(this.Texture, destinaton_slices[i], source_slices[i], GraphicsUnit.Pixel);     } } 

Now, the problem is that this method is producing completely wrong results, such as:

  • The image slices are not sized correctly.
  • When changing the the Bounds rectangle values, the slices gets sized incorectly.
  • When changing the size value, the image gets cut off.
    • I believe the size is what is making the slices draw incorrectly, so i would like to know what value it should have.
  • If i remove either the destination or source slices, i also get wrong results.

I tried lots of different values and combinations, but could not make this method work, so i’m hoping someone here tests the code and help me find a solution to this problem.

Thanks in advance!

Best way to implement a to hit formula based on provided stats

There are a ton of these questions, some can get really mathy – which is fine, but I am looking for a simple way based on a few stats, I thought I came up with one, so I will share it in hopes that someone can tell me where I might be going wrong.

The goal is that the monster should, depending on how powerful you are, be able to have a chance to hit. Weaker monsters instant death to them, harder monsters possible instant death to you.

I also realize these are hard questions to answer because it is game dependant. I hope I have provided enough info for you to give some guidance.

Lets get the stats out the way:

  • To Hit Stat (Character): base stat / modded stat (ie: 12/100)
  • Accuracy / Dodge (Character): between 0.0001 – 1.0 (0.01% – 100% (can be higher))
  • Enemy Dodge / Enemy Accuracy: Between 0.0001 – 0.85 (0.01% – 85%)
  • To Hit (Monster): Dex / 10,000 – where 10k is 1k higher then max stats (9k) for monsters
  • Monsters do have a max level (if that will help)

When a character levels they get 1 point into their base stat – which is then used in conjunction with all equipment and so on to increase the modded stat additively (base stat + base stat * bonuses = modded stat)

Characters can cap out (Modded stat) Higher then 10K which might pose issues for a to hit formula. How ever at that point I would assume your skills are 100% as max level is 1000 – thus you should always be hitting

The idea I had was (based off another question asked):

(stat / modded stat) + (((accuracy - dodge) / accuracy) * 100) 

Some assumptions I made based on how I built the system:

  • Accuracy at 100%+ means you always hit
  • Dodge at 100%+ Means you always dodge.
  • Enemies dodge and accuracy do not go above 85% (they can start at 0.01% for both)
  • Monsters always use their dex (ie 12/max cap), monsters do not have modded stats
    • All Monster stats are the same, IE: if Dex is 9k all other stats, such as str, int, chr … are also 9k

There are some issues with this formula though:

  • If stat and stat mod are the same (no equipment or bonus for character only) I chose to use the stat (as opposed to stat / modded stat) so, if 11 === 11 – well, use 11. For the character (see below for example)
  • Because a character might never train (I don’t know why) Accuracy or Dodge their bonus might be 0.01% (there are equipment bonuses that can increase this to a max of 30% across all equipment with another 5% for boons (135% max) how ever in the following example we will assume you have nothing)

So:

   Level 1 (Character) = (11) + ((0.0001 - 0.0001) / 0.001) * 100) = 11 // Nothing equipped no bonuses     vs.     Rat (Enemy) = (8/10000) + ((0.0001 - 0.0001) / 0.001) * 100) = 0.0008 

This doesn’t seem right, so the player has a 11% to hit and the rat has a 0.0008% chance to hit?

Character : 100 – 11 = 82% chance to hit Rate : 100 – 0.0008 = 99.9992% chance to hit?

This doesn’t make sense to me. For context here’s a high level monster with a character that has a 95% dodge chance:

 (9000/10000) + ((0.75 - 0.95) / 0.75) * 100) = -25.7666666667 

That does not look right.

How to implement backscattering in Graphics3D?

First of all, I’ll explain what I mean.

Here’s a picture, where on the left is the result of

Graphics3D[Sphere[], Boxed -> False,   Lighting -> {{"Directional", White, ImageScaled[{0, 0, 10}]}},   Background -> Black] 

and on the right is a photo of the full Moon.

The Moon is not Lambertian

As you can see, the modelled sphere is brightest at the centre, but the full Moon is uniform. That’s because the modelled sphere reflects light using Lambertian formula, but the Moon is not Lambertian.

There’s a (quite recent) formula, where the author gives a nice physical explanation: https://arxiv.org/ftp/arxiv/papers/1808/1808.01024.pdf. Put succintly, the Moon has backscattering: the light is reflected mostly back to the light source, and its intensity is proportional to the cosine of the angle between directions to the source and the observer. When the Moon is full, the cosine is almost 1, and we get an uniform disk.

But it gets interesting when the Moon is not full. Of course, I could wrap the sphere in a calculated Texture, but that’s quite tedious when there are several objects. Is there a way to implement it in a more general manner, as something similar to Specularity?

How would I implement this in Raylib?

I am the developer of an upcoming 2d/3dRPG. I have a simple scene setup where there is a bridge over some acid and a cave entrance-like thing that I want to change the level with. I have used C and C++ in the past, and considered state machines, but I actually have no idea how to do this in raylib. plus I heard it’s only that good for transitioning from a title to a game or something, not loading levels on collision. also, the acid has to destroy the player.

any sort of help is appreciated. I also posted another question but no one seems to either see it, or answer it, and I posted it like 2 days ago.

What are some ways one might implement a more story-driven spell/skill acquisition?

What are some ways one might implement a more story-driven spell/skill acquisition? Hopefully in a way that isn’t a complete slog.

The idea of the players’ handbook being used as a shopping catalogue kinda ruins the immersion for me. It doesn’t make much sense that a character can go to sleep one day and then wake up the next suddenly knowing a bunch of new spells or skills if they happened to reach a new level. Especially that often those spells/skills have nothing to do with any in-game actions or backstory of the character. I’d love to see a game where the characters have to actively work towards acquiring their skills, and not just waiting till they’ve passed the next level threshold.

The question is largely about how a DnD5e system might get modified to fit my concerns because I don’t really have a group yet and 5e players are easiest to find. That said I’m open to hearing about other game systems.

In the context of 5e I was thinking of flipping the relationship between levels and skills/spells on its head and not have levels grant you skills but rather the achieving skills bumping your level up (at GM’s discretion). By "achieving skills" the character pursuing an RP way to acquire a skill. Depending on what’s going on in-game it might be super easy for some skills (e.g. you find that move that you’ve been trying to do all this time suddenly just works after enough practice) or verging on impossible for others (e.g. getting an ice-y spell for a character who is all about fire stuff). I imagine this could create a greater sense of anticipation and, ultimately, reward at the advancement of characters. Or I might be completely wrong and it’s only going to scare off potential players who just want to minmax.

How to implement multiclassing during character creation? [closed]

Assume I want to have characters defined by classes, archetypes, whatever. And there’s no advancement, or at least sufficiently little advancement that the choices made at chargen always define the character.

But I want to have multiclassing. Or, more exactly, I want to have characters with differing numbers of archetypes without imbalancing them.

So a class/archetype can’t be a package of mostly or entirely good abilities, because adding another class makes a character better. Thus, the first idea I had was to have chargen start with an “average” set of traits, and each class adds a package of advantages and disadvantages. Works numerically, but I know that “disadvantages cost negative points” systems are easily exploitable. That is, players will try to put PCs in situations that take advantage of their strong points. Only if players and their characters had no control over the situation would “disadvantages cost negative points” be balanced. Thus, having more advantages and disadvantages is generally a good thing. I presume it’s for this reason that the Fate versions I’ve seen don’t just give you a pool of points but specify how many skills of what value you must buy in chargen.

So what other options are there?

I recognize that this post is about something very similar, but there’s no answer satisfying my requirements.

From the description, Apocalypse World and its derivatives allow for cross-class abilities, but only through experience rather than at chargen. Other suggestions lean toward full point-buy, but that’s not what I’m talking about. I don’t want complex character generation. And again, I don’t want to add abilities from other classes in play, but to have class combination in chargen.

distribution implement for RandomVariate

I have a scalar function of two random matrices of dimension $ n$ which are in the Gaussian Unitary Ensemble $ $ f(x,y) \in \mathbb R, \quad x^{\dagger}=x \: \operatorname{and} \: y^{\dagger} = y, \:\operatorname{dim}(x)=\operatorname{dim}(y)=n$ $ I would like to generate a sample of various of values of $ f(x,y)$ for example, $ 10^8$ of them. To do this I use the following Mathematica program

RandomVariate[MatrixPropertyDistribution[f[x, y],                     {x \[Distributed] GaussianUnitaryMatrixDistribution[n],                      y \[Distributed] GaussianUnitaryMatrixDistribution[n]}],10^8] 

However, this program runs slow for large dimension $ n$ due to the complicated form of $ f(x,y)$ . So I work in a basis that the matrix $ x$ is diagonalized: $ $ x\rightarrow\operatorname{diag}(a_1,\dots,a_n), \: y \rightarrow U^\dagger y U,$ $ where $ U$ is the unitary matrix that diagonalizes $ x$ . The scalar function $ f$ is invariant under this transformation.

Now $ \{a_1,\dots,a_n\} $ is in a multinormal distribution wherein the covariance matrix is the identity matrix. At the same time, $ y$ is still in the Gaussian Unitary Ensemble. So I would like to generate a sample of values of $ f$ in terms these new random variable. But I find it is hard to implement the distribution. I tried

distx = Array[x, n] \[Distributed] MultinormalDistribution[ConstantArray[0, n], DiagonalMatrix[ConstantArray[1, n]]];  disty = y \[Distributed] GaussianUnitaryMatrixDistribution[n];  distribution = MatrixPropertyDistribution[f[x, y], Join[distx, {disty}]];  sample = RandomVariate[distribution,10^8]; 

However, I got the following message from Mathematica

enter image description here

Is there any way to solve this problem so that I can obtain the values from the random variables? Thanks very much.

Facing problem to implement SSL redirect

I want to add a checkbox button for automatically redirect to HTTPS if SSL is present. the process I added like below:

this is form area:

<form action="options.php" method="POST" id="<?php echo esc_attr( $  data['slug'] ); ?>_options">             <?php settings_fields( $  data['slug'] ); ?>             <?php $  this->render_form_sections(); ?>             <?php $  this->render_hidden_fields(); ?>             <input type="submit" class="wpr-button" id="wpr-options-submit" value="<?php echo esc_attr( $  data['btn_submit_text'] ); ?>"> </form>          

added new field in the form:

$  this->settings->add_settings_fields(         [                          'ssl_redirect'       => [                 'type'              => 'checkbox',                 'label'             => __( 'Enable SSL Redirect', 'rocket' ),                 'section'           => 'enable_ssl_section',                 'page'              => 'hub',                 'default'           => 0,                 'sanitize_callback' => 'sanitize_checkbox',             ], 

added this:

if ( $  wp_rocket_requirement_checks->check() ) {      require WP_ROCKET_INC_PATH . 'main.php';     require WP_ROCKET_INC_PATH . 'custom.php';   } 

this custom.php is added for making action function after checkbox is true state. this is my custom.php

<?PHP   defined( 'ABSPATH' ) || exit;    ?> 

I want to add this function code in cutom.php how to add this and how form action will perform please solve this.

function enable_ssl_redirect() {     if ( isset( $  _SERVER['HTTPS'] ) ) {         if ( 'on' === strtolower( $  _SERVER['HTTPS'] && strpos( home_url(), 'https' ) == false ) ) {         wp_redirect(str_replace( 'http', 'https', home_url() ));     }      if ( '1' == $  _SERVER['HTTPS'] ) {         wp_redirect(home_url());     } } elseif ( isset( $  _SERVER['SERVER_PORT'] ) && ( '443' == $  _SERVER['SERVER_PORT'] ) ) {      wp_redirect(home_url()); }  return false; }