architecture – Synchronizing clients – Game Development Stack Exchange

I have a server-client setup where each client has a number of screens attached, and the screens together form the display. As such, the visuals displayed by each client needs to be roughly in sync. Luckily the domain is not high speed, so I don’t have to have them all perfectly in sync, but obviously more in sync is better.

I am targeting a 100ms lead time between receiving states and acting upon them, I’m operating in a LAN so that is plenty, packets are sent out at 100Hz and interpolation is handled through a buffer which automatically selects the right packets. So I don’t have to worry about that. Visuals are running at 60 FPS so there is minimal difference frame to frame.

Right now there are two basic solutions: 1. have each client sync with a time server over the internet or locally, or 2. emulate the same logic in the code and do the synchronization as part of establishing connection. What would be the best way to synchronize time?

I’m concerned that I’m running into an XY problem here assuming that synchronizing time this way is a good idea at all.

I have noticed that existing questions on this topic are about 1 server connecting to several clients, each showing their own visuals. I think this problem of requiring sync between clients to maintain visual continuity is a bit different, so maybe there will be different approaches. I am aware of other questions that discuss the more common situation though.

web development – what is the next step after learning and building forms and databases

I am trying to shift my career into software. I have been doing self education mostly using YouTube videos. I have understood how form submission works and how a server accepts the data from form submission and saves it in a database. i taught myself crud operations and creating a rest API server that writes and reads to/from a database. what would be beneficial to my learning next ? what should i focus my efforts on ?

unit testing – Building a GTD Productivity App Designed through Test Driven Development (TDD)

First, thanks so much for looking at my code. Over the past decade, I have tried every task management apps imaginable. I finally realized that the only way I would ever find my perfect productivity system is if I build it myself.

To this end, I am creating ClearHeadTodo, a productivity app that seeks to bring the GTD model of productivity using entirely rust if possible.

While for now i’m only focused on the Command Line Interface (CLI) my ultimate goal is to make this a modular piece of software where the core productivity system works no matter what medium you are utilizing (GUI or CLI)

The Question: Control Flow Best-Practices for Testing and Scalability

The Code: 2 Main Files
For now, most of this work is broken into two files (lib.rs and main.rs respectively)

  • lib.rs contains the main logic for the Task List
  • While main.rs contains the CLI struct which the user actually interacts with to alter the task objects.

Current Code Status
For right now, users can only create tasks. Tasks have a name, priority, and completion status.

  • This is all loaded to and from a vector using a .csv to reduce database complexity

I’m very proud to say that everything works from all my testing, however, now that the code is all together, it feels… difficult to scale the code base since the main command loop is basically just a huge match statement.

I want to use best-practices like the result data type, but i am having trouble formatting the code in such a way that would propagate the result of each function properly to the end of the main command line.

Specifically, whenever i try using the ?, it throws an error saying that i’m not using the proper type (even though you can see there are several results in this code)

Operation all work is done through just running the main rust build with any arguments,
so cargo run create_task will create a new task which can be shown with `cargo run list_task
Main.rs

use std::io::{self, Write};
use std::io::stdout;
use clear_head_todo::TaskList;
use clear_head_todo::PriEnum;
use std::path::Path;

pub struct CLI{
    pub pattern: Option<String>,
    pub index: Option<String>,
    pub input: Option<String>,
    pub task_vec: TaskList
}

impl CLI {
        pub fn parse_arguments(&mut self) {
            match self.pattern.as_ref().unwrap_or(
                &"no command given".to_string()) as &str{
            "create_task" | "create" | "ct" | "new_task" | "new" =>
                self.task_vec
                .create_task(),
            "list_tasks" | "lt" | "list" | "list_all" =>
                self.task_vec.print_task_list(std::io::stdout()).unwrap_or(()),
            "remove_task" | "remove" | "rt" | "delete_task" | "delete" =>
                self.task_vec
                .remove_task(
                    self.index.as_ref()
                    .unwrap()
                    .to_string()
                    .parse::<usize>()
                    .unwrap(), 
                    io::stdout())
                    .expect("invalid index"),
            "complete_task" | "complete" | "mark_complete" =>
                self.task_vec.tasks(
                self.index.as_ref()
                .unwrap()
                .parse::<usize>()
                .unwrap())
                .mark_complete(),
            "change_priority" | "cp" | "new_priority" | "np" =>
                self.task_vec.tasks(
                self.index.as_ref()
                .unwrap()
                .parse::<usize>()
                .unwrap())
                .change_priority(
                        &self.input.as_ref().unwrap()(..)),
            "rename_task" | "rename" | "name" | "r" =>
                self.task_vec.tasks(
                self.index.as_ref()
               .unwrap()
               .parse::<usize>()
               .unwrap())
               .rename_task(
                    self.input.as_ref()
                   .unwrap()),
            _ => return
            };
    }
    pub fn cli_list_tasks(&self, mut writer: impl std::io::Write){
        self.task_vec.print_task_list(writer).unwrap_or(());
    }
}
fn main() {

    println!("starting program");
    
    let mut main_cli: CLI = CLI{
        pattern : std::env::args().nth(1),
        index: std::env::args().nth(2),
        input: std::env::args().nth(3),
        task_vec: TaskList{
            tasks: vec!()
        }
    };

    main_cli.task_vec.load_tasks("tasks.csv").unwrap();
    
    main_cli.parse_arguments();

    main_cli.task_vec.load_csv("tasks.csv").unwrap();
    
}

#(cfg(test))
mod tests {
    use super::*;

    #(test)
    fn cli_creation_test () {
        let mut test_cli = CLI {
            pattern: None, 
            index: None,
            input: None,
            task_vec: TaskList{tasks: vec!()}, 

        };
        assert!(test_cli.pattern == None);
        assert!(test_cli.index == None);
        assert!(test_cli.input == None);
        assert!(test_cli.task_vec.tasks.len() == 0);
        test_cli.parse_arguments();
    }

    #(test)
    fn cli_task_creation_test () {
        let mut test_cli = CLI {
            pattern: Some("create_task".to_string()), 
            index: None,
            input: None,
            task_vec: TaskList{tasks: vec!()}, 

        };
        test_cli.parse_arguments();
        assert!(test_cli.task_vec.tasks.len() == 1);
        assert!(test_cli.task_vec.tasks(0).name == "Test Task");
        assert!(test_cli.task_vec.tasks(0).completed == false);
        assert!(test_cli.task_vec.tasks(0).priority == PriEnum::Optional);
    }

    #(test)
    fn cli_task_list_test () {
        //let mut good_result = Vec::new();
        let mut test_cli = CLI {
            pattern: Some("list_tasks".to_string()), 
            index: None,
            input: None,
            task_vec: TaskList{tasks: vec!()}, 

        };

        test_cli.parse_arguments();
    }
}


Lib.rs (logical center of the app)

use std::error::Error;
use std::io::{Error as OtherError, ErrorKind};
use std::fmt;
use csv::Reader;
use csv::Writer;
use std::path::{Path, PathBuf};
use std::env;
use std::str::FromStr;
use serde::ser::{Serialize, SerializeStruct, Serializer};
use serde::Serialize as AltSerialize;

pub struct TaskList {
    pub tasks: Vec<Task>
}

#(derive(PartialEq))
#(derive(Debug))
#(repr(u8))
#(derive(AltSerialize))
pub enum PriEnum {
    Critical = 1,
    High = 2,
    Medium = 3,
    Low = 4,
    Optional = 5,
}

impl fmt::Display for PriEnum {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        let printable: &str = match *self {
            PriEnum::Critical => "Critical",
            PriEnum::High => "High",
            PriEnum::Medium => "Medium",
            PriEnum::Low => "Low",
            PriEnum::Optional => "Optional"
        };
        write!(f, "{}", printable)
    }
}

impl Serialize for Task {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> 
    where
            S: Serializer, 
        {
            let mut s = serializer.serialize_struct("Task", 3)?;
            s.serialize_field("name", &self.name)?;
            s.serialize_field("priority", &self.priority)?;
            s.serialize_field("completed", &self.completed)?;
            s.end()
        }
}
 
pub fn parse_priority(expr: &str) -> Result<PriEnum, String> {
    match expr.to_ascii_lowercase().trim() {
        "1" | "critical" | "crit" | "c" => Ok(PriEnum::Critical),
        "2" | "high" | "hi" | "h" => Ok(PriEnum::High),
        "3" | "medium" | "med" | "m" => Ok(PriEnum::Medium),
        "4" | "low" | "lo" | "l" => Ok(PriEnum::Low),
        "5" | "optional" | "opt" | "o" => Ok(PriEnum::Optional),
        "" => Ok(PriEnum::Optional), //defaults to this
        _ => Err(format!("Invalid priority value")),
    }
}

#(derive(PartialEq, Debug))
pub struct Task {
    pub name: String,
    pub completed: bool,
    pub priority: PriEnum, 
}

impl TaskList {
    //load tasks from either tasks.csv or testTasks.csv using the file_name
    pub fn load_tasks(&mut self, file_name: &str) -> Result<(), Box<dyn Error>> {
        let pathbuf = env::current_dir().unwrap().join("data").join(file_name);
        let mut rdr: Reader<std::fs::File> = Reader::from_path(pathbuf)?;
        for result in rdr.records() { 
            let record = result?;
            let new_task = Task {
                name: record(0).to_string(),
                completed: FromStr::from_str(&record(2))?,
                priority : parse_priority(&record(1))?,
            };
            self.tasks.push(new_task);
        }
        Ok(())
    }

    pub fn load_csv(&mut self, file_name: &str) -> Result<(), Box<dyn Error>> {
        let pathbuf = env::current_dir().unwrap().join("data").join(file_name);
        let mut wtr: Writer<std::fs::File> = Writer::from_path(pathbuf)?;
        for index in 0..=self.tasks.len()-1{
            wtr.serialize::<_>(&self.tasks(index)).unwrap();
        }
        Ok(())
    }

    pub fn create_task(&mut self) {
        let new_task: Task = Task {
            name: String::from("Test Task"),
            completed: false,
            priority: PriEnum::Optional,
        };
        self.tasks.push(new_task);
    }
    
    pub fn print_task_list(&self, mut writer: impl std::io::Write)->
    Result<(), std::io::Error> {
        if self.tasks.is_empty()==true{
            return Err(OtherError::new(ErrorKind::Other, "list is empty"));
        } else{
            for index in 0..=self.tasks.len()-1 {
                writeln!(writer, "{index},{name},{priority},{completed}",
                        index = index,
                        name = self.tasks(index).name,
                        priority = self.tasks(index).priority,
                        completed = self.tasks(index).completed)?;
            }
        }
        Ok(())
    }
    
    pub fn remove_task(&mut self, index: usize, mut writer: impl std::io::Write) -> 
    Result<(), std::io::Error>  {
        if index < self.tasks.len() {
            writeln!(writer, "Deleted {name} Task", 
                     name = self.tasks(index).name)?; 
            self.tasks.remove(index);
            return Ok(());
        }
        else {
            return Err(OtherError::new(ErrorKind::Other, "Invalid Index for Deletion"));
        }
    }

} //end 'impl TaskList'
 

impl Task {
    pub fn rename_task(&mut self, new_task_name: &String) {
        self.name = new_task_name.to_owned();
    }
    
    pub fn mark_complete(&mut self) {
        self.completed = true;
    }
    
    pub fn change_priority(&mut self, new_priority: &str) {
        let new_pri = parse_priority(new_priority);
        match new_pri {
            Ok(i) => self.priority = i,
            Err(err) => println!("{}", err),
        };
        
    }
   
} //end 'impl Task'

#(cfg(test))
mod tests {
    use super::*;
    
    #(test)
    fn task_creation_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();
        let test_task = &test_task_list.tasks(0);
        assert!(test_task.name == "Test Task");
        assert!(test_task.completed == false);
        assert!(test_task.priority == PriEnum::Optional);
        assert!(&test_task_list.tasks(0) == test_task);
    }
    
    #(test)
    fn task_rename_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();         
        let test_task = &mut test_task_list.tasks(0);
        test_task.rename_task(&"Changed Name".to_string());
        assert!(test_task.name == "Changed Name");
    }
    
    #(test)
    fn task_completion_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();
        let test_task = &mut test_task_list.tasks(0);
        test_task.mark_complete();
        assert!(test_task.completed == true);
    }
    
    #(test)
    fn task_successful_removal_test() {
        let mut test_task_list = TaskList{tasks: vec!()};
        let mut good_result = Vec::new();
        test_task_list.create_task();
        test_task_list.remove_task(0, &mut good_result).unwrap();
        assert!(test_task_list.tasks.is_empty());
        assert_eq!(&good_result(..), "Deleted Test Task Taskn".as_bytes());
    }
    
    #(test)
    fn task_removal_fail_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        let mut bad_result = Vec::new();
        let error = test_task_list.remove_task(0, &mut bad_result).unwrap_err();
        assert_eq!(error.to_string(), "Invalid Index for Deletion");
    }

    #(test)
    fn task_reprioritize_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();
        let test_task = &mut test_task_list.tasks(0);
        println!("{}", test_task.name);
        test_task.change_priority("4");
        assert!(test_task.priority == PriEnum::Low);
        test_task.change_priority("3");
        assert!(test_task.priority == PriEnum::Medium);
        test_task.change_priority("2");
        assert!(test_task.priority == PriEnum::High);
        test_task.change_priority("1");
        assert!(test_task.priority == PriEnum::Critical);
        test_task.change_priority("6");
        assert!(test_task.priority == PriEnum::Critical); //should NOT change on bad input
    }
    
    #(test)
    fn task_print_fail_test(){
        let test_task_list = TaskList{tasks: vec!()};
        let mut bad_result = Vec::new();
        let error = test_task_list.print_task_list(&mut bad_result).unwrap_err();
        assert_eq!(error.to_string(), "list is empty");
    }
    #(test)
    fn task_print_full_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        let mut good_result = Vec::new();
        test_task_list.create_task();
        test_task_list.print_task_list(&mut good_result).unwrap();
        assert_eq!(&good_result(..), "0,Test Task,Optional,falsen".as_bytes());
    }
    
    #(test)
    fn load_from_csv_sucessful_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        test_task_list.load_tasks("testTasks.csv").unwrap();
        let test_task = &test_task_list.tasks(0);
        assert!(test_task.name == "test csv task");
        assert!(test_task.completed == false);
        assert!(test_task.priority == PriEnum::Optional);
    }

    #(test)
    fn load_from_csv_fail_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        let error = test_task_list.load_tasks("bad_file").unwrap_err();
        assert!(error.to_string().contains("(os error 2)"));
    }
    
    #(test)
    fn load_to_csv_successful_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        test_task_list.create_task();
        test_task_list.tasks(0).rename_task(&"test csv task".to_string());
        test_task_list.load_csv("testTask.csv").unwrap();
        let rdr = Reader::from_path(
            env::current_dir().unwrap().join("data").join("testTasks.csv").as_path())
            .unwrap();
        let mut iter = rdr.into_records();
        if let Some(result) = iter.next() {
            let record = result.unwrap();
            assert_eq!(record, vec!("test csv task", "Optional", "false"));
        }
    }

}

Again, Thank you for taking the time to look at this, everything should run if you put these in a cargo project, if even cargo test fails, please send me the error code

Archive page with year/months – WordPress Development Stack Exchange

I need to create a date archive that would look like this:

2020 2019 2018 2017 2016
JANUARY FEBRUARY MARCH JUNE

Initially it shows the posts belonging to the most recent month/year but you can navigate through the archive and check posts like: i.e /2020 or /2020/08 or /2019/02 and so on.

I managed to show a list with all years and months inside them, but it’s not what I’m trying to achieve.

Any help is much appreciated.

<?php
                    global $wpdb;
                    $limit = 0;
                    $year_prev = null;
                    $months = $wpdb->get_results( "SELECT DISTINCT MONTH( post_date ) AS month ,  YEAR( post_date ) AS year, COUNT( id ) as post_count FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month , year ORDER BY post_date DESC" );
                    foreach( $months as $month ) :
                        $year_current = $month->year;
                        if ( $year_current != $year_prev ) {
                                if ( $year_prev != null ) { ?>
                                <?php } ?>
                                <ul class="date-year">
                        <li><a href="<?php bloginfo('url') ?>/<?php echo $month->year; ?>/"><?php echo $month->year; ?></a></li>
                                </ul>
                        <?php } ?>
                                <ul class="date-month">
                        <li><a href="<?php bloginfo('url') ?>/<?php echo $month->year; ?>/<?php echo date("m", mktime(0, 0, 0, $month->month, 1, $month->year)) ?>"><span class="archive-month"><?php echo date_i18n("F", mktime(0, 0, 0, $month->month, 1, $month->year)) ?></span></a></li>
                                </ul>
                    <?php
                    endforeach;
                    ?>

Automate clearing everything (database tables, log files, etc.) and starting from a fresh state during development?

Dropping tables, clearing log files and caches, etc. get pretty tedious to do every time the server is restarted, so right now I have a simple shell script that I run called drop.sh

Whatever you find to be tedious or repetitive, it’s likely to be so for whoever inherits the project or whoever is working alongside with you.

Automating repetitive task by implementing your own tools is (implicitly) what you are paid for. You would not be only a professional by doing this, you will be a good one because you are being efficient at managing your time and efforts. In other words, you are productive.

But I feel this is very clunky and also not sure whether to include this script in the .gitignore.

Any tool, shell script or not, should be in the right folder within the project and in the SCM. Absolutely. Because you will make others as productive as you by sharing these tools. Moreover, others might contribute to the improvement of these tools, making the day even more productive.

But it’s not only about to be productive. It’s also about knowledge/code reuse. These shells (if written properly) can be re-used. For instance, by CI1.

It’s only “clunky” when it’s not well implemented or when it’s not well documented. Introduce all these shells in the README.md file!

Should I be using a Makefile instead that can clear out the server state?

You should perhaps implement both! If your project is the one of those that Makefile allows 3rd party members to compile and package quickly, then go ahead. If you Makefile solves your compiling, assembling or packaging then go ahead. But don’t mix tasks. Don’t make a God Shell/Makefile.

Resetting dev environment is one job, compiling and packaging is another job. Releasing the binary is a different job and rolling out the binary is… a different job too. For simplicity make 1 tool for each so you can orchestrate them in the order that best serves you. It’s also easier to reason about if you have a tool that does only one thing.

Back again to the beginning, documentation is a must. Make sure you document well-enough these tools.


1: This is the main reason why I programme these shells, why I make them part of the project and why they are in the SCM. Because this way, I can tell Jenkins _- do use this shell to do this task – _ rather than rewriting the whole task in a different language. Again. It’s likely whatever works in my local env, will work in Jenkins (master or slave doesn’t matter). If I work on Windows, I implement the respective .cmd shells.

Is there any company who can help me with fantasy football software development? – Other Money Making Opportunities

Hello! It looks like you are planning to get into the fantasy sports industry. It is actually an interesting business opportunity and the best investment option. Gaming is a form of entertainment that never goes out of trend, and if you have a robust revenue model in your app, you will earn consistently. That is a vital factor due to which it has turned into a billion-dollar industry so soon. 

 

Another very interesting fact that you should know about the industry and its users is that if you provide them with a beneficial and attractive app, they will turn into a long period customer of your app and its services. Assisting you in building a fantasy football software can be done by Appdupe, an experienced firm. You might by now, know that expertise comes with experience, so you can talk to their team and obtain complete guidance. As far as I heard, they stay with you throughout the app development process and launch your fantasy sports development solution in no time. So, go ahead and meet up with their team. I am sure you will launch a successful brand in the market. All the best!

PHP Parse error – WordPress Development Stack Exchange

I’m getting this error:
“Parse error: syntax error, unexpected ‘endwhile’ (T_ENDWHILE) in /var/www/vhosts/website/httpdocs/wp-content/themes/website/blog-masonry-grid.php on line 209
There has been a critical error on your website.

Learn more about debugging in WordPress.”

The code is:

<?php
/*
Template Name: Blog Masonry Grid
*/
?>
<?php get_header(); ?>
<?php
global $wp_query;

$id = $wp_query->get_queried_object_id();
$category = "";
$post_number = $wp_query->max_num_pages;

if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }


?>

<div class="blogpage">

    <div class="container">
        <div class="section">
            <?php
            // Check Sidebar Layout
            $sidebar_layout = boc_page_sidebar_layout();

            // IF Sidebar Left
            if($sidebar_layout == 'left-sidebar'){
                get_sidebar();
            }

            if($sidebar_layout != 'full-width'){
                echo "<div class='col span_3_of_4'>";
            }
            ?>




    <?php
          //query_posts('post_type=post&paged='. $paged . '&cat=' . $category .'&posts_per_page=' . $post_number );
            query_posts('post_type=post&paged='. $paged . '&posts_per_page=' . $post_number );
    ?>



<?php /*
<ul id="filters">
    <li><a href="#" data-filter="*" class="selected">Everything</a></li>
    <?php
        $terms = get_terms("category"); // get all categories, but you can use any taxonomy
        $count = count($terms); //How many are they?
        if ( $count > 0 ){  //If there are more than 0 terms
            foreach ( $terms as $term ) {  //for each term:
                echo "<li><a href='#' data-filter='.".$term->slug."'>" . $term->name . "</a></li>n";
                //create a list item with the current term slug for sorting, and name for label
            }
        }
    ?>
</ul>*/

?>


<div class="blogholder">
    <div class="masonry_full_width">

<?php if(have_posts()) : while ( have_posts() ) : the_post(); ?>

<?php
    $classesfeat = '';
    $featuredback_styles = '';
    $featured_background_style = '';
    $termsString = '';

    $_post_format = get_post_format();
    $termsArray = get_the_terms( $post->ID, "category" );
        foreach ( $termsArray as $term ) { // for each term
            $termsString = $term->slug.' '; //create a string that has all the slugs
        }
?>



<?php

 $doublewidthblock =  get_post_meta($post->ID, 'boc_page_post_style_width', true);
 $buttonlight =  get_post_meta($post->ID, 'boc_featured_post_buttonlight', true);


 if(  (get_post_meta($post->ID, 'boc_featured_post_block', true) == "on") ){
    $classesfeat = 'featuredcat-post';

    $featuredback_styles = get_post_meta($post->ID, 'boc_featured_post_block_imgcolor', true);
    //background array has the following elements
    //echo $featuredback_style("background-color");
    //echo $featuredback_style("background-repeat");
    //echo $featuredback_style("background-attachment");
    //echo $featuredback_style("background-position");
    //echo $featuredback_style("background-image");

  $featured_background_style = 'style=" ';

  if( $doublewidthblock == "double_width"){
    $doubleclass = 'widepost';
  }else{
    $doubleclass = 'stdwidthpost';
  }


  if($featuredback_styles('background-color')){
    $featured_background_style .= ' background-color: '. $featuredback_styles('background-color') .'; ';
    }else{
     if($featuredback_styles('background-image')){$featured_background_style .= ' background-image: url('. $featuredback_styles('background-image') .'); '; }
     if($featuredback_styles('background-repeat')){$featured_background_style .= ' background-repeat: '. $featuredback_styles('background-repeat') .'; '; }
     if($featuredback_styles('background-attachment')) {$featured_background_style .= ' background-attachment: '. $featuredback_styles('background-attachment') .'; '; }
     if($featuredback_styles('background-position')){$featured_background_style .= ' background-position: '. $featuredback_styles('background-position') .'; '; }
  }




  $featured_background_style .= ' "';


 }
?>


    <div id="post-<?php the_ID(); ?>" class=" <?php if($doublewidthblock == "double_width") { ?> grid-item--width2 <?php } else { ?> grid-item <?php } ?> info_item isotope_element masitempc" >
        <div class="post_item_block boxed <?php echo $doubleclass;?> <?php echo $classesfeat; ?>" <?php echo $featured_background_style; ?> >


            <?php
            if((get_post_meta($post->ID, 'boc_featured_post_block', true) == "off")){
                if ( has_post_thumbnail() ) {
                    ?>
                        <a href="<?php the_permalink(); ?>" target="_self" title="<?php the_title_attribute(); ?>">
                            <?php the_post_thumbnail('boc_thin_blog'); ?>
                        </a>
                <?php
                }
          }

            ?>

            <div class="categorytitle">
                <?php
                $categories = get_the_category();
                 if ( ! empty( $categories ) ) {
                    echo esc_html( $categories(0)->name );
                }
                ?>
            </div>
            <div class="post_info_date">
                <?php echo get_the_date(); ?>
            </div>


            <div class="post_item_desc">
                <div class="post_text_inner">

                    <h4><a href="<?php the_permalink(); ?>" target="_self" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
                    </h4>

            <!--<span class="post_author">
                        <a class="post_author_link" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><i class="icon_pencil-edit" aria-hidden="true"></i><span><?php the_author_meta('display_name'); ?></span></a>
                      </span>-->

               <?php
                  //place excerpt here too
                  //the_content('Read More');

                  echo qode_excerpt();

               ?>

                    <!-- <a href="<?php echo get_permalink(); ?>"><?php echo __('Read more','portcafe');?></a>  -->


                    <?php if((get_post_meta($post->ID, 'boc_featured_post_block', true) == "on") ){



                                    if($buttonlight == "off"){

                                ?>
                                 <a href="<?php the_permalink(); ?>" class="button btn_medium btn_dark btn_squared btn_normal_style">Read More</a>

                                <?
                                    }else{
                                ?>
                                   <a href="<?php the_permalink(); ?>" class="button btn_medium btn_white btn_squared btn_normal_style">Read More</a>
                                <?
                                        }

                        }
                    ?>

                </div>
             </div>


            </div>
    </div>

                <?php endwhile; ?>              

                <?php else: //If no posts are present ?>
                <div class="entry">
                        <p><?php _e('No posts were found.', 'qode'); ?></p>
                </div>
                <?php endif; ?>

            </div>
         <?php
            if (get_next_posts_link()) { ?>
                <div class="blog_load_more_button_holder">
                    <?php //added a function to get_next_posts_link in functions.php which add a class to the button
                    ?>
                    <div class="blog_load_more_button"><span rel="<?php echo $wp_query->max_num_pages; ?>"><?php echo get_next_posts_link(__('Show more', 'qode')); ?></span></div>
                </div>
            <?php } ?>


      <?php wp_reset_query(); ?>

            <?php
            if($sidebar_layout != 'full-width'){
                echo "</div>";
            }

            // IF Sidebar Right
            if($sidebar_layout == 'right-sidebar'){
                get_sidebar();
            }
            ?>
    </div>
</div>
</div>

</div>
<?php get_footer(); ?>

Thanks in advance for your help.

unity – player softbody – Game Development Stack Exchange

I need some help with a softbody mechanic on a player in unity and I don’t know how to approach it yet.
I want to try rigidbody collision on individual sections of the mesh, or mess with the cloth component.
So far with the cloth component, my player’s rigidbody and collider move outside the actual mesh.
Idk how to get my movement script to actually move the cloth.

Incase you want the movement script:

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
public Rigidbody rb;

public float fowardForce = 60f;
public float sidewaysForce = 50f;

void FixedUpdate()
{


if (Input.GetKey("w") )
    {
    rb.AddForce(0, 0, fowardForce * Time.deltaTime);
}

if (Input.GetKey("s") )
    {
    rb.AddForce(0, 0, -fowardForce * Time.deltaTime);
}

    if (Input.GetKey("d") )
    {
    rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0);
}

if (Input.GetKey("a") )
    {
    rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0);
}

    if (Input.GetKey("i") )
    {
    rb.AddForce(0, fowardForce * Time.deltaTime, 0);
}

    if (Input.GetKey("o") )
    {
    rb.AddForce(0, -fowardForce * Time.deltaTime, 0);
}

I don’t really care if the softbody uses the cloth component, I mainly care that whatever method I use, it is easy for me to get and understand. If anyone can show me code to achieve this, it would be very appreciated.